{% set learnStatuses = learnStatuses|default([]) %}
{% set experience = experience|default(false) %}
<div class="course-item-list-wrap">
	{% set class = class|default('') %}
	<ul class="course-item-list {{ class }} " id="course-item-list" >
		{% for id, item in items %}
		  {% if 'chapter' in id %}
		    {% if item.type == 'unit' %}
				  <li class="item chapter-item chapter-item-unit clearfix">
				  	<span class="name">第 {{ item.number }} 节</span>
				  	<span class="title">{{ item.title }}</span>
		  	  </li>
		    {% else %}
				  <li class="item chapter-item clearfix">
				  	<span class="name">第 {{ item.number }} 章</span>
				  	<span class="title">{{ item.title }}</span>
		  	  </li>
		    {% endif %}
		  {% elseif 'lesson' in id %}
		  	{# {% if app.user.isParent() %}
		  		{% set lessonUrl = path('course_lesson_preview', {courseId:course.id,lessonId:item.id}) %}
		  	{% else %} #}
	    		{% set lessonUrl = path('course_learn', {id:course.id}) ~ '#lesson/' ~ item.id %}
		  	{# {% endif %} #}
		    <li class="item lesson-item {% if learnStatuses[item.id]|default(null) %}lesson-item-{{ learnStatuses[item.id] }}{% endif %} lesson-item-{{item.id}} hover-item clearfix " data-id="{{ item.id }}" data-num="{{loop.index}}">
		    	{% if item.status == 'published' %}	    	
			    	{% if item.type == 'video' %}
				    	<span class="type" title="视频时长{{ item.length|duration }}">
				    		<span>{{ item.length|duration }}</span>
				    		<span class="glyphicon glyphicon-play-circle"></span>
				    	</span>
				    {% elseif item.type == 'audio' %}
				      <span class="type" title="音频时长{{ item.length|duration }}">
				    		<span>{{ item.length|duration }}</span>
				    		<span class="glyphicon glyphicon-volume-up"></span>
				      </span>
				    {% elseif item.type == 'text' %}
				      <span class="type">图文 <span class="glyphicon glyphicon-picture"></span></span>
				    {% elseif item.type == 'testpaper' %}
				      <span class="type">试卷 <span class="glyphicon glyphicon-check"></span></span>
				    {% elseif item.type == 'ppt' %}
				      <span class="type">PPT <span class="glyphicon glyphicon-picture"></span></span>
				    {% elseif item.type == 'document' %}
				      <span class="type">文档 <span class="glyphicon glyphicon-file"></span>
				      </span>
				    {% elseif item.type == 'live' %}
				       	{% if item.startTime > currentTime %}
							<small class="type">{{ item.startTime|date('m月d日') }} 
								{% for key,week in weeks %}
									{% if key == item.startTime|date('w')  %}
										星期{{ week }}
									{% endif %}
							    {% endfor %}
								{{ item.startTime|date('H：i') }}
							</small>
						{% elseif item.startTime <= currentTime and item.endTime >= currentTime %}
							<small class="type">正在直播中</small>
						{% elseif item.endTime < currentTime %}

							<small class="type" >
					    		{% if item.replayStatus == 'generated' %}
					    		<span class="type">回放</span>
					    		<span class="glyphicon 
					    		glyphicon-play-circle"></span>
					    		{% else %}
					    		<span class="type">直播结束</span>
					    		{% endif %}
					    	</small>
							
						{% endif %}
				    {% endif %}
			    {% else %}
			      	<span class="status">未发布</span>
			    {% endif %}

		    	<span class="name ">课时{{ item.number }}</span>
		    	<span class="pie ">&nbsp;</span>

		    	<a class=" title" href="{{ lessonUrl }}" title="{{ item.title }}" data-id="{{ item.id }}" data-experience="{{ experience }}" style="white-space:nowrap; overflow:hidden; text-overflow: ellipsis;">
			    	{{ item.title }} 
			    	{% if item.type != 'text' and item.type != 'live' and item.type != 'testpaper' %}
			    		{% if item.mediaId != 0 and not (files[item.mediaId]|default(false)) and show|default(false) %}
							<span class="label label-danger fileDeletedLesson" title="课时文件已删除" >无效课时</span>
						{% endif %}
					{% endif %}

				    {% if item.materialNum > 0 %}
				      <span class="glyphicon  glyphicon-download" title="资料"></span>
				    {% endif %}

				    {% if item.giveCredit > 0 %}
				      <small class="text-muted">({{ item.giveCredit }}学分)</small>
				    {% endif %}

				    {% if item.requireCredit > 0 %}
				      <small class="text-muted">(需{{ item.requireCredit }}学分)</small>
				    {% endif %}

		    	</a>
		    	<button class="btn btn-success btn-mini action">开始学习</button>
		    </li>
		  {% endif  %}
		{% endfor %}
	</ul>
</div>