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

{% block title %}课程设置 - {{ parent() }}{% endblock %}

{% set menu = 'classSetting' %}

{% block main %}
<div class="page-header clearfix">
  <button class="btn btn-info btn-sm pull-right" id="add-navigation-btn" data-toggle="modal" data-target="#modal" data-url="{{path('admin_school_class_course_add', { classId:class.id, gradeId:class.gradeId, term:class.term, public:0 })}}" >选增课程</button>
  <h1 class="pull-left">
    课程设置
    <small class="text-success">
      {{ class_name(class) }}
      {{ class.year}}届
      {% if class.term == 'first' %}
        一学期  
      {% else %}
        二学期
      {% endif %}
    </small>
  </h1>

</div>

<div class="row">
  {% if courses %}
  {% for course in courses%}
  <div class="col-sm-4 col-md-3 class-course-grid">
    <div class="thumbnail course-thumbnail">
      {% if course.compulsory == '1' %}
        <span class="label label-success pull-left span-margin">必修</span>
      {% else %}
        <span class="label label-warning pull-left span-margin">选修</span>
      {% endif %}
      <a type="button" class="close pull-right course-thumbnail-a" href="{{ path('admin_school_class_course_remove', {classId:class.id, courseId:course.id}) }}" onclick="return confirm('确定关闭该课程吗？\n关闭后在本班内将不再显示该课程，但老师仍然可以管理该课程。');"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></a>
      
      <a href="{{ path('course_show',{id:course.id}) }}"><img  alt="{{ course.title }}" src="{{ file_path(course.middlePicture, 'course-large.png') }}"></a>
      <div class="caption">
        <a href="{{ path('course_show',{id:course.id}) }}"><h3 class="title">{{ course.title }}</h3></a>
        <div class="metas clearfix">
          <span class="pull-left">
            {{ dict_text('gradeName', course.gradeId) }}
            {% if course.term == 'first' %}
            一学期  
            {% else %}
            二学期
            {% endif %}
          </span>
          <span class="pull-right">{{ course.teachername[0]}}</span>
        </div>
      </div>
    </div>
  </div>
  {% endfor %}
  {% else %}
    <div class="empty">该班级暂无课程，快去增加课程吧！</div>
  {% endif %}
</div>


{% endblock %}