{% extends 'TopxiaWebBundle:CourseManage:layout.html.twig' %}
{% import 'TopxiaWebBundle::macro.html.twig' as macro %}

{% block title %}试卷管理 - {{ parent() }}{% endblock %}

{% set side_nav = 'testpaper' %}
{% set parentId = parentId | default(null)%}
{% set script_controller = 'test-paper/index' %}

{% block main %}

<div class="panel panel-default panel-col">
  <div class="panel-heading">
    <a href="{{ path('course_manage_testpaper_create',{courseId:course.id}) }}" class="btn btn-info btn-sm pull-right mls" {% if course.parentId and not course.structureChanged %}onclick="return confirm('创建试卷后该课程将不再与模板课程同步信息，是否确认创建？');"{% endif %}><span class="glyphicon glyphicon-plus"></span> 创建试卷</a>
    试卷管理
  </div>

  <div class="panel-body " id="quiz-table-container">

  <table class="table table-striped table-hover" id="quiz-table">
  {{ web_macro.flash_messages() }}
    <thead>
    <tr>
        <th><input type="checkbox"  autocomplete="off"  data-role="batch-select"></th>
        <th width="38%">名称</th>
        <th>状态</th>
        <th>题目统计</th>
        <th>时间限制</th>
        <th>更新人/时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
      {% for testpaper in testpapers %}
        {% set user = users[testpaper.updatedUserId] %}
        {% include 'TopxiaWebBundle:CourseTestpaperManage:tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">还没有试卷，请点击右上角按钮，<a href="{{ path('course_manage_testpaper_create',{courseId:course.id}) }}">创建一个新试卷</a></div></td></tr>
      {% endfor %}
    </tbody>
  </table>
  <div>
    <label class="checkbox-inline"><input type="checkbox"  autocomplete="off" data-role="batch-select"> 全选</label>
    <button class="btn btn-default btn-sm mlm" data-role="batch-delete"  data-name="试卷" data-parentid="{{course.parentId}}" data-structurechanged="{{course.structureChanged}}" data-url="{{ path('course_manage_testpaper_deletes',{courseId:course.id}) }}">删除</button>
  </div>

  {{ web_macro.paginator(paginator) }}

  <div class="text-muted mtl">提示：只有已发布的试卷才能被添加到课程中去，试卷一旦发布后将不能修改。</div>


  </div>
</div>

{% endblock %}



