{% extends 'TopxiaAdminBundle:Course:layout.html.twig' %}

{% block title %}文件管理 - {{ parent() }}{% endblock %}

{% set menu = 'course-disk' %}

{% set script_controller = 'course/disk' %}


{% block main %}

  <div class="page-header clearfix">
    <h1>文件管理</h1>
  </div>

  <form id="file-search-form" class="form-inline well well-sm" action="" method="get" novalidate>

    <div class="form-group">
      <select class="form-control" name="type">
        {{ select_options(dict('fileType'), app.request.get('type'), '文件类型') }}
      </select>
    </div>

    <span class="divider"></span>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="创建人" name="nickname" value="{{ app.request.get('nickname') }}">
    </div>

    <div class="form-group">
      <input class="form-control" type="text" name="filename" value="{{ app.request.get('filename') }}" placeholder="文件名称">
    </div>

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

  </form>

  <div id="disk-table-container">

    <table class="table table-striped table-hover" id="disk-table">
      <thead>
        <tr>
          <th width="3%"><input type="checkbox" data-role="batch-select"></th>
          <th width="10%">名称</th>
          <th width="10%">大小</th>
          <th width="10%">类型</th>
          <th width="10%">存储方式</th>
          <th width="10%">创建人</th>
          <th width="10%">创建时间</th>
          <th width="10%">操作</th>
        </tr>
      </thead>
      <tbody>
        {% for file in files %}
          {% set creator = users[file.userId]|default(null) %}
          {% include 'TopxiaAdminBundle:CourseDisk:tr.html.twig' %}
        {% else %}
          <tr><td colspan="20"><div class="empty">无课程文件</div></td></tr>
        {% endfor %}
      </tbody>
    </table>

    <div>
      <label class="checkbox-inline"><input type="checkbox" data-role="batch-select"> 全选</label>
      <button class="btn btn-default btn-sm mlm" data-role="batch-delete"  data-name="文件" data-url="{{ path('admin_course_disk_batch_delete') }}">删除</button>
    </div>

  </div>

  <div class="paginator">
    {{ web_macro.paginator(paginator) }} 
  </div>

{% endblock %}
