{% extends 'TopxiaWebBundle:My:layout.html.twig' %}

{% block title %}我的作业 - {{ parent() }}{% endblock %}

{% set side_nav = 'my-homeworks' %}

{% block main %}
	<div class="panel panel-default panel-col">
	  	<div class="panel-heading">我的作业</span></div>
	  	<div class="panel-body">
	  		<ul class="nav nav-tabs">
				<li class="{% if status == 'finished' %}active{% endif %}"><a href="{{ path('my_homework_list',{status:'finished'}) }}">已批改</a></li>
				<li class="{% if status == 'reviewing' %}active{% endif %}"><a href="{{ path('my_homework_list',{status:'reviewing'}) }}">批改中</a></li>
			</ul>
			{% if homeworkResults %}
			<table class="table table-striped">
				<thead>
			        <tr>
			          <th width="70%">作业</th>
			          <th width="30%">操作</th>
			        </tr>
		      	</thead>
				<tbody>
						{% for homeworkResult in homeworkResults %}

					<tr>
							<td>
								{% set course = courses[homeworkResult.courseId] %}
								{% set lesson = lessons[homeworkResult.lessonId] %}
								{% set lessonUrl = path('course_learn', {id:course.id}) ~ '#lesson/' ~ lesson.id %}
		      					{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}
									<div><a class="text-success" href="{{ path('course_show', {id:course.id}) }}">《{{ course.title }}》</a> <a class="text-success" href="{{ lessonUrl }}">第 {{ lesson.number }}课时</a><span class="mll text-muted">提交时间：{{ homeworkResult.usedTime|date('Y-n-d H:i') }}</span></div>
							</td>
							<td>

								<a class="btn btn-default btn-sm" href="{% if status == 'reviewing' %} {{ path('course_homework_check',{courseId:course.id,homeworkId:homeworkResult.homeworkId,userId:app.user.id}) }} {% else %} {{ path('course_homework_result',{courseId:course.id,homeworkId:homeworkResult.homeworkId,resultId:homeworkResult.id,userId:app.user.id}) }} {% endif %}" target="_blank">查看</a>
							</td>
					</tr>
						{% endfor %}
				</tbody>
			</table>
			{{ web_macro.paginator(paginator) }}
			{% else %}
				<div class="empty">目前暂无作业</div>
			{% endif %}
	  	</div>
	</div>
	

{% endblock %}



