<ul class="course-wide-list">
  {% for course in courses %}
  <li class="course-item clearfix">
    <a class="course-picture-link" href="{{ path('course_show', {id:course.id}) }}">
      <img class="course-picture" src="{{ filepath(course.middlePicture, 'course.png') }}" alt="{{ course.title }}">
    </a>

    <div class="course-body">
     
      <div style="float:right;" class="text-muted mrm mls">
        {% include "TopxiaWebBundle:Course:price-widget.html.twig" with {shows: ['price', 'discount']} %}
      </div>

      <h4 class="course-title"><a href="{{ path('course_show', {id:course.id}) }}">{{ course.title }}</a>
      {% if course.serializeMode=='serialize' %}
        <span class="label label-success ">更新中</span>
      {% elseif course.serializeMode=='finished' %}
        <span class="label label-warning ">已完结</span>
      {% endif %}
      {% if course.type == 'live' %}
          {% set lesson = course['lesson']|default(null) %}
          {% if lesson and "now"|date("U") >= lesson.startTime and "now"|date("U") <= lesson.endTime %}
            <span class="label label-warning series-mode-label">正在直播中</span>
          {% else %}
            <span class="label label-success series-mode-label">直播</span>
          {% endif %}
      {% endif %}
      </h4>

      {% if course.type == 'live' %}
        {% set lesson = course.lesson|default(null) %}
        {% if lesson %}
          <div class="live-course-lesson mbm">
            <span class="text-success fsm mrm">{{ lesson.startTime|date('n月j日 H:i') }} ~ {{ lesson.endTime|date('H:i') }}</span>
            <span class="text-muted fsm mrm">第{{ lesson.number }}课时</span>
          </div>
        {% endif %}
      {% else %}
        <div class="course-about ellipsis">{{ course.subtitle }}</div>
      {% endif %}

      <div class="course-footer clearfix">
        {% set teacher = users[course.teacherIds|first]|default(null) %}
        {% if teacher %}
          <div class="teacher">
            <a href="{{ path('user_show', {id:teacher.id}) }}"><img src="{{ filepath(teacher.smallAvatar, 'avatar.png') }}" class="teacher-avatar"></a>
            <a class="teacher-nickname ellipsis" href="{{ path('user_show', {id:teacher.id}) }}">{{ teacher.nickname }}</a>
            <span class="teacher-title ellipsis">{{ teacher.title }}</span>
          </div>
        {% endif %}

        <div class="course-metas">
          <span class="stars-{{ (course.rating)|number_format }}">&nbsp;</span>
          {% if setting('course.show_student_num_enabled', '1') == 1 %}
          <span class="divider"></span>
          <span class="text-muted mrm mls"><strong>{{ course.studentNum }}</strong>{{setting('default.user_name', '学员')}}</span>
          {% endif %}

        </div>
      </div>
    </div>
  </li>
  {% endfor %}
</ul>