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

{% block title %}学生管理 - {{ parent() }}{% endblock %}

{% set side_nav = 'students' %}
{% set script_controller = 'course-manage/students' %}

{% block main %}

<div class="panel panel-default panel-col">
  <div class="panel-heading">学生管理
    {% if app.user.isAdmin() or setting('course.teacher_export_student', false) %}
      <a class="btn btn-info btn-sm pull-right mhs" href="{{ path('course_manage_student_export_csv', {id:course.id}) }}"><i class="glyphicon glyphicon-export"></i> 导出学生</a>
    {% endif %}
    {% if app.user.isAdmin() or isTeacherAuthManageStudent == 1 %}
      <button class="btn btn-info btn-sm pull-right mhs" id="student-add-btn" data-toggle="modal" data-target="#modal" data-url="{{ path('course_manage_student_create', {id:course.id}) }}"><i class="glyphicon glyphicon-plus"></i> 添加学生</button>
    {% endif %}

  </div>
  
  <div class="panel-body">  
      <form class="form-inline well well-sm " action="" method="get" novalidate>

        <div class="form-group">
          <input class="form-control " type="text" placeholder="请输入用户名" name="nickName" value="{{ app.request.get('nickName') }}">

          <button class="btn btn-primary">搜索</button>
        </div>
        <div class="clearfix"></div>
        

    </form>
    <table class="table table-striped" id="course-student-list">
      <thead>
        <tr>
          <th width="40%">学生</th>
          <th width="30%">学习进度</th>
          <th width="30%">操作</th>
        </tr>
      </thead>
      <tbody>
        {% for student in students %}
          {% set user = users[student.userId] %}
          {% set progress = progresses[student.userId] %}
          {% set isFollowing = user.id in followingIds %}
          {% include 'TopxiaWebBundle:CourseStudentManage:tr.html.twig' %}
        {% else %}
          <tr class="empty"><td colspan="20">无学生记录</td></tr>
        {% endfor %}
      </tbody>
    </table>

    {{ web_macro.paginator(paginator) }}

  </div>

</div>


{% endblock %}