{% import "TopxiaAdminBundle::macro.html.twig" as admin_macro %}
<tr id="course-tr-{{ course.id }}">
  {# <td>{{ course.id }}</td> #}
  <td>
    <a href="{{ path('course_show', {id:course.id}) }}" target="_blank"><strong>{{ course.title }}</strong></a>{% if course.type == 'live' %}<span class="label label-success live-label mls">直播</span>{% endif %}

    {% if not course.parentId %}  
      <span class="label label-info " title="模板课程，所有更新会自动复制至关联课程">公有课程</span>
    {% else %}
      {% if course.structureChanged %}  
        <span class="label label-warning " title="已断开与公有课程的关联">私有课程</span>
      {% else %}
        <span class="label label-success " title="公有课程的改动会自动复制到该课程">关联课程</span>
      {% endif %}
    {% endif %}

    <br>

    <span class="text-muted text-sm" title="">
      教师： 
      {% if course.teacherIds|default(null) %}
        {% for id in course.teacherIds %}
          {% set teacher = teachers[id] %}
          {{ teacher.truename }}
        {% endfor %}
      {% endif  %}
    </span>

  </td>
  <td>
    {% if class|default(null) %}
      {{class_name(class)}}
    {% endif %}
  </td>
  <td class="text-center">
    {{ course.studentNum }}
  </td>
  <td class="text-center">{{ dict_text('courseStatus:html', course.status) }}</td>
  <td>
    {{ admin_macro.user_link(user) }}
    <br>
    <span class="text-muted text-sm">{{ course.createdTime|date('Y-n-d H:i') }}</span>
  </td>
  <td>
    <div class="btn-group">
      <a class="btn btn-default btn-sm" href="{{ path('course_manage', {id:course.id}) }}" target="_blank">管理</a>

      <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
      </a>
      <ul class="dropdown-menu pull-right">

       {#  <li><a class="recommend-course" href="#modal" data-toggle="modal" data-url="{{ path('admin_course_recommend', {id:course.id, ref:'courseList'}) }}"><span class="glyphicon glyphicon-hand-up"></span> 推荐课程</a></li> #}

        {% if course.recommended %}
          <li><a class="cancel-recommend-course" href="javascript:" data-url="{{ path('admin_course_cancel_recommend', {id:course.id}) }}"><span class="glyphicon glyphicon-hand-right"></span> 取消推荐</a></li>
        {% endif %}
        
        {# <li ><a class="copy-course" id="copy-course" href="javascript:" 
        {% if course.type == "live" %}
        title="直播课程不支持复制"
        style="color:#909090"
        {% endif %}
        data-toggle="modal" 
        data-target="#modal"  
        data-url="{{ path('admin_course_copy', {id:course.id}) }}" 
        data-type="{{course.type}}"
        ><span class="badge">new</span><span class="glyphicon glyphicon-plus-sign"></span> 复制课程</a></li> #}

        {# <li><a href="{{ path('course_show', {id:course.id, previewAs:'guest'}) }}" target="_blank"><span class="glyphicon glyphicon-eye-open"></span> 预览：作为未购买用户</a></li> hidden by wenqin #}
        <li><a href="{{ path('course_show', {id:course.id, previewAs:'member'}) }}" target="_blank"><span class="glyphicon glyphicon-eye-open"></span> 预览 </a></li>

        <li class="divider"></li>

        {% if course.status == 'published' %}
          <li><a class="close-course" href="javascript:" data-parentid="{{course.parentId}}" data-structurechanged="{{course.structureChanged}}" data-url="{{ path('admin_course_close', {id:course.id}) }}"><span class="glyphicon glyphicon-ban-circle"></span> 关闭课程</a></li>
        {% endif %}

        {% if course.status != 'published' %}
          <li><a class="publish-course" href="javascript:" data-parentid="{{course.parentId}}" data-structurechanged="{{course.structureChanged}}" data-url="{{ path('admin_course_publish', {id:course.id}) }}"><span class="glyphicon glyphicon-ok-circle"></span> 发布课程</a></li>
        {% endif %}

        <li class="divider"></li>

        <li><a class="delete-course" href="javascript:" data-parentid="{{course.parentId}}" data-url="{{ path('admin_course_delete', {id:course.id}) }}"><span class="glyphicon glyphicon-trash"></span> 删除课程</a></li>
      </ul>
    </div>
  </td>
</tr>
