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

{% set menu = 'admin_setting_course' %}
{% set script_controller = 'setting/course' %}

{% block main %}


{{ web_macro.flash_messages() }}

<form class="form-horizontal" method="post" id="course-form" novalidate>

  <fieldset>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >给新{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}发送欢迎私信</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('welcome_message_enabled', {1:'开启', 0:'关闭'}, courseSetting.welcome_message_enabled) }}
      <p class="help-block">开启后，新{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}加入课程后，会收到教师的欢迎私信</p>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label for="welcome_message_body">欢迎私信内容</label>
      </div>
      <div class="controls col-md-8">
        <textarea id="welcome_message_body" name="welcome_message_body" class="form-control" rows="5">{{ courseSetting.welcome_message_body }}</textarea>
        <div class="help-block">
          {% verbatim %}
          <div>变量说明：</div>
          <ul>
            <li>{{nickname}} 为接收方用户昵称</li>
            <li>{{course}} 为课程名称</li>
          </ul>
          {% endverbatim %}
        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >购买课程时填写个人资料</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('buy_fill_userinfo', {1:'开启', 0:'关闭'}, courseSetting.buy_fill_userinfo) }}
      <p class="help-block">开启后，{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}购买课程时，需填写个人资料</p>
      </div>
      <div class="controls col-md-8 col-md-offset-3"  id="show-list">
        {% for sort in courseSetting.userinfoFields%}
            {% if sort=='truename' %}
            <button type="button" class="btn btn-default btn-xs">真实姓名</button>
            {% endif %}
            {% if sort=='mobile' %}
            <button type="button" class="btn btn-default btn-xs">手机号码</button>
            {% endif %}
            {% if sort=='qq' %}
            <button type="button" class="btn btn-default btn-xs">QQ</button>
            {% endif %}
            {% if sort=='company' %}
            <button type="button" class="btn btn-default btn-xs">所在公司</button>
            {% endif %}
            {% if sort=='idcard' %}
            <button type="button" class="btn btn-default btn-xs">身份证号码</button>
            {% endif %}
             {% if sort=='gender' %}
            <button type="button" class="btn btn-default btn-xs">性别</button>
            {% endif %}
             {% if sort=='job' %}
            <button type="button" class="btn btn-default btn-xs">职业</button>
            {% endif %}
             {% if sort=='weibo' %}
            <button type="button" class="btn btn-default btn-xs">微博</button>
            {% endif %}
             {% if sort=='weixin' %}
            <button type="button" class="btn btn-default btn-xs">微信</button>
            {% endif %}
            {% if  userFields %}
                {% for field in userFields %}
                      {% if sort==field.fieldName %}
                           <button type="button" class="btn btn-default btn-xs">{{field.title}}</button>
                     {% endif %}
                {% endfor %}
            {% endif %}
        {% endfor %}
        <div class="pull-right "><a href="javascript:" id="show-list-btn">编辑 <span class="
  glyphicon glyphicon-chevron-down"></span></a></div>
      </div>
      <div  class="controls col-md-8 col-md-offset-2" id="buy-userinfo-list">
            <div class="form-group"><ul class="buy-userinfo-list sortable-list" data-role="list">
            {% if courseSetting.userinfoFieldNameArray %}
            {% for sort in courseSetting.userinfoFieldNameArray %}
               {% if sort=='truename' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" name="userinfoFields[]" value="truename"  {% for sort in courseSetting.userinfoFields %}{% if sort=="truename"%}checked=true{% endif %}{% endfor %}></input><input type="hidden"  name="userinfoFieldNameArray[]" value="truename"></input> 真实姓名
                </li>
               {% endif %}
               {% if sort=='mobile' %}
                  <li class="list-group-item clearfix" data-role="item" >
                    <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                    &nbsp;<input type="checkbox" name="userinfoFields[]" value="mobile" {% for sort in courseSetting.userinfoFields %}{% if sort=="mobile"%}checked=true{% endif %}{% endfor %}></input><input type="hidden"  name="userinfoFieldNameArray[]" value="mobile"></input> 手机号码(带格式校检)
                  </li>
               {% endif %}
               {% if sort=='qq' %}
                      <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox"  {% for sort in courseSetting.userinfoFields %}{% if sort=="qq"%}checked=true{% endif %}{% endfor %}  name="userinfoFields[]" value="qq"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="qq"></input> QQ（带格式校验）
                    </li>
               {% endif %}
               {% if sort=='company' %}
                    <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="company"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="company"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="company"></input> 所在公司
                    </li>
               {% endif %}
               {% if sort=='idcard' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="idcard"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="idcard"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="idcard"></input> 身份证号码(带格式校检)
                </li>
               {% endif %}
               {% if sort=='gender' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="gender"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="gender"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="gender"></input> 性别
                </li>
               {% endif %}
               {% if sort=='job' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="job"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="job"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="job"></input> 职业
                </li>
               {% endif %}
               {% if sort=='weibo' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="weibo"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="weibo"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weibo"></input> 微博
                </li>
               {% endif %}
               {% if sort=='weixin' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="weixin"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="weixin"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weixin"></input> 微信
                </li>
               {% endif %}
               {% if userFields %}
               {% for field in userFields %}
                {% if sort==field.fieldName %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox"  {% for sort in courseSetting.userinfoFields %}{% if sort==field.fieldName%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="{{sort}}"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="{{sort}}"></input> {{field.title}}
                </li>            
               {% endif %}
               {% endfor %}
               {% endif %}
            {% endfor %}
            {% else %}
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="truename" ></input><input type="hidden"  name="userinfoFieldNameArray[]" value="truename"></input> 真实姓名
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="mobile" ></input><input type="hidden"  name="userinfoFieldNameArray[]" value="mobile"></input> 手机号码(带格式校检)
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="qq"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="qq"></input> QQ（带格式校验）
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="company"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="company"></input> 所在公司
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="job"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="job"></input> 职业
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="gender"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="gender"></input> 性别
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="idcard"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="idcard"></input> 身份证号码(带格式校检)
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="weibo"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weibo"></input> 微博
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="weixin"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weixin"></input> 微信
            </li>
            {% if  userFields %}
                {% for field in userFields %}
                    <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox" name="userinfoFields[]" value="{{field.fieldName}}"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="{{field.fieldName}}"></input> {{field.title}}
                    </li>
                {% endfor %}
            {% endif %}
          {% endif %}
            </ul><div style="text-align:center;"><a href="javascript:" id="hide-list-btn">收起 <span class="
glyphicon glyphicon-chevron-up"></span></a></div>
  </div></div>

    </div>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师设置课程价格</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_modify_price', {1:'是', 0:'否'}, courseSetting.teacher_modify_price) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师添加/移除{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_manage_student', {1:'是', 0:'否'}, courseSetting.teacher_manage_student) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师导出{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}资料</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_export_student', {1:'是', 0:'否'}, courseSetting.teacher_export_student) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}下载课时的音视频</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('student_download_media', {0:'不允许', 1:'允许'}, courseSetting.student_download_media) }}
        <div class="help-block">开启此项设置后，{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}可在课时学习界面侧栏的"资料"面板中下载。</div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>课程详情页显示相关课程</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('relatedCourses', {1:'开启', 0:'关闭'}, courseSetting.relatedCourses) }}
        <div class="help-block">根据课程的标签，显示相关课程</div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>免费课时允许未登录用户观看</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('allowAnonymousPreview', {1:'允许', 0:'不允许'}, courseSetting.allowAnonymousPreview) }}
        <div class="help-block">如果允许此项设置,未登录用户（游客）可观看免费课时</div>
      </div>
    </div>

     <div class="form-group">
      <div class="col-md-3 control-label">
        <label>图文课时防复制</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('copy_enabled', {1:'开启', 0:'关闭'}, courseSetting.copy_enabled) }}
        <div class="help-block"></div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>课程图片预览</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('picturePreview_enabled', {1:'开启', 0:'关闭'}, courseSetting.picturePreview_enabled) }}
        <div class="help-block">如果允许此项设置,点击课程图片预览课程首个免费视频</div>
      </div>
    </div>

    <div class="form-group">
      <label class="col-md-3 control-label">课程中允许显示{{setting('default.user_name', '学员')}}人数</label>
      <div class="col-md-8 controls radios">
        {{ radios('show_student_num_enabled', {'1':'开启', '0':'关闭'}, courseSetting.show_student_num_enabled|default('1') ) }}
      </div>
    </div>

  </fieldset>
  <fieldset>
      <legend>名称设置</legend>
      
        <div class="row form-group">
          <div class="col-md-2 col-md-offset-2 control-label">
              <label for="chapter_name">课程章名称</label>
          </div>
          <div class="controls col-md-4">
            <input  type="text" id="chapter_name" name="chapter_name" class="form-control" {% if defaultSetting.chapter_name %}value="{{defaultSetting.chapter_name}}" {% else %} value="章" {% endif %}>
          </div>

      </div>


      <div class="row form-group">
          <div class="col-md-2 col-md-offset-2 control-label">
              <label for="part_name">课程节名称</label>
          </div>
          <div class="controls col-md-4">
            <input  type="text" id="part_name" name="part_name" class="form-control" {% if defaultSetting.part_name %} value="{{defaultSetting.part_name}}" {% else %} value="节" {% endif %}>
          </div>
      </div>

    <div class="alert alert-info deduction text-center">
    <p><strong>
    注：修改网校字段后，站内相关字段名称都会相应修改为已保存的名称
    </strong></p>
    </div>

  </fieldset>

  <div class="form-group">
    <div class="controls col-md-offset-3 col-md-8">
      <button type="submit" class="btn btn-primary">提交</button>
    </div>
  </div>
  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
</form>

{% endblock %}



