{% extends 'layout.html.twig' %}

{% block title %}
  {{ course.title }} - {{ parent() }}
{% endblock %}

{% block keywords %}
  {% set tags = data('Tags', {tagIds: tagIds}) %}
  {% for tag in tags %}{{tag.name}}{% if not loop.last%},{% endif %}{% else %}{{ parent() }}{% endfor %}
{% endblock %}

{% block description %}
  {% if course.about %}
    {{ course.about|purify_and_trim_html|default('')|plain_text(100) }}
  {% else %}
    {{ parent() }}
  {% endif %}
{% endblock %}

{% block content %}
  <ol class="breadcrumb open-course-breadcrumb">
    <li><a href="{{ path('homepage') }}">首页</a></li>
    <li><a href="{{ path('open_course_explore') }}" >公开课</a></li>
    <li>{{ course.title }}</li>
  </ol>
  {# {% cache 'open/course/' ~ course.id ~ '/header' 600 %} #}
  <div class="open-course-header">
    <div class="row">

      {{ render(controller('AppBundle:OpenCourse:header',{course:course, lessonId:lessonId|default(null)})) }}

      <div class="col-md-3 open-course-tab js-open-course-tab">
        <ul class="clearfix">
          <li class="tab-header active"><i class="es-icon es-icon-staroutline prm"></i>推荐课程</li>
          {#{% if course.type == 'open' %}
            <li class="tab-header"><i class="es-icon es-icon-videocam prm"></i>课时列表</li>
          {% endif %}#}
        </ul>
        <div id="content">
          <ul id="recommand-tab">
            {% include 'open-course/recommend-course-list.html.twig' %}
          </ul>
          {# <ul id="live-tab" style="display:none">
            {% include 'open-course/open-course-lesson-list.html.twig' with {currentLessonId:lessonId|default(null)} %}
          </ul> #}
        </div>
      </div>
    </div>
  </div>
  {# {% endcache %} #}

  {{ render(controller('AppBundle:OpenCourse:infoBar',{courseId:course.id, as:app.request.get('as')|default('')})) }}

  <div class="open-course-detail row">
    <div class="col-md-9">
      <div class="es-section gray-darker editor-text">
        {% if course.about %}
          {{ course.about|raw }}
        {% else %}
          <div class="empty">暂无简介</div>
        {% endif %}
      </div>
      {{ render(controller('AppBundle:OpenCourse:comment',{request:app.request,courseId:course.id, as:app.request.get('as')|default('')})) }}
    </div>

    {# {% cache 'open/course/' ~ course.id ~ '/right_side' 600 %} #}
    <div class="col-md-3 hidden-sm hidden-xs">
      {{ render(controller('AppBundle:OpenCourse:teachers',{courseId:course.id})) }}
	    {% if app.user and app.user.id %}
		    {{ render(controller('AppBundle:OpenCourse:materialList',{id:course.id})) }}
	    {% endif %}
    </div>
    {# {% endcache %} #}
  </div>
  {% include 'common/weixin-share.html.twig' with {
  'title': course.title,
  'desc': course.about|striptags|purify_and_trim_html,
  'link': app.request.uri,
  'imgUrl': fileurl(course.largePicture,'course.png'),
  }%}

  {% do load_script('open-course/open-course') %}
  {% include 'seajs_loader_compatible.html.twig' with {topxiawebbundle: true} %}
{% endblock %}
    