{% extends 'TopxiaWebBundle:CourseManage:layout.html.twig' %}

{% block title %}基本信息 - {{ parent() }}{% endblock %}

{% set side_nav = 'base' %}
{% set script_controller = 'course-manage/base' %}
{% 
	set script_arguments = {
	  categoryUrl: path('category_all'),
	  tagMatchUrl: path('tag_match'),
	  locationUrl: path('location_all')
	} 
%}
{% block main %}

<div class="panel panel-default panel-col">
	<div class="panel-heading">基本信息</div>
	<div class="panel-body">
		<form class="form-horizontal" id="course-form" method="post">

		  {{ web_macro.flash_messages() }}

			<div class="form-group">
				<label class="col-md-2 control-label">标题</label>
				<div class="col-md-8 controls">
					<input type="text" id="course_title" name="title" required="required" class="form-control" value="{{ course.title|default('') }}">
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-md-2 control-label">副标题</label>
				<div class="col-md-8 controls">
					<textarea id="course_subtitle" name="subtitle" required="required" class="form-control">{{ course.subtitle|default('') }}</textarea>
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			<div class="form-group">
			  <label class="col-md-2 control-label">标签</label>
			  <div class="col-md-8 controls">
			  	<input type="text" id="course_tags" name="tags" required="required" class="width-full select2-offscreen" tabindex="-1" value="{{ tags|join(',') }}" data-explain="将会应用于按标签搜索课程、相关课程的提取等">
			  	<div class="help-block">将会应用于按标签搜索课程、相关课程的提取等</div>
			  </div>
			</div>

			{% if course.type == 'live' %}

			<div class="form-group">
			  <label class="col-md-2 control-label" for="maxStudentNum-field">直播最大{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}数</label>
			 <div class="col-md-8 controls">
					<input type="text" id="maxStudentNum-field" name="maxStudentNum" class="form-control width-input width-input-large" value="{{ course.maxStudentNum|default(20) }}" data-live-capacity="{{ liveCapacity }}"> 人
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			{% endif %}

			<div class="form-group">
			  <label class="col-md-2 control-label" for="course_expiryDay">{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}有效期</label>
			  <div class="col-md-8 controls">
			    <input type="text" id="course_expiryDay" name="expiryDay" required="required" class="form-control width-input width-input-large" value="{{ course.expiryDay }}" > 天
			    <div class="help-block">设置该值后，{{setting('default.user_name', '学员')}}只能在有效期内进行课程的相关操作，系统默认会在到期前10天提醒{{setting('default.user_name', '学员')}}。该值为0，则不做此限制。</div>
			  </div>
			</div>

			{% if course.type == 'normal' %}
				<div class="form-group">
					<label class="col-md-2 control-label">连载状态</label>
					<div class="col-md-8 controls radios">
						{{ radios('serializeMode', {'none':'非连载课程', 'serialize':'更新中', 'finished':'已完结'}, course.serializeMode|default('none') ) }}
					</div>
				</div>
			{% endif %}

			{% if setting('magic.lesson_watch_limit') %}
				<div class="form-group">
				  <label class="col-md-2 control-label">观看次数限制</label>
				  <div class="col-md-8 controls">
				    <input type="text" id="course_expiryDay" name="watchLimit" required="required" class="form-control width-input width-input-large" value="{{ course.watchLimit }}" > 次
				    <div class="help-block">每个课时学员最多只能观看的次数，0表示不限制。</div>
				  </div>
				</div>
			{% endif %}

			{% if setting('magic.buy_before_approval') %}
				<div class="form-group">
				  <label class="col-md-2 control-label">实名认证</label>
				  <div class="col-md-8 controls radios">
				    {{ radios('approval', {'1':'是', '0':'否'}, course.approval ) }}
				  	<div class="help-block">设置该值后，学员购买课程前，必须先去申请实名认证。</div>
				  </div>
				</div>
			{% endif %}
			
			<div class="form-group">
			  <label class="col-md-2 control-label">分类</label>
			  <div class="col-md-8 controls">
			    <select id="course_categoryId" name="categoryId" required="required" class="form-control width-input width-input-large">
			    	{{ select_options(category_choices('course'), course.categoryId, '分类') }}
			    </select>
			  	<div class="help-block" style="display:none;"></div>
			  </div>
			</div>
			{% if course.type == 'live'%}
			<div class="form-group">
			    <div class="col-md-offset-2 col-md-8 controls">
		    		<a href="http://www.edusoho.com/files/liveplugin/live_desktop_{{liveProvider}}.rar" target="_blank">直播“桌面分享”插件下载</a>
			    </div>
			</div>
			{% endif %}
		  <div class="form-group">
		    <div class="col-md-offset-2 col-md-8 controls">
		    	<button class="btn btn-fat btn-primary" id="course-create-btn" type="submit">保存</button>
		    </div>
		  </div>

		  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

		</form>
	</div>
</div>

{% endblock %}



