<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugins/ueditor/kityformula-plugin/defaultFilterFix.js"></script>

<div class="layui-form" style="margin-top: 15px; padding-right: 15px;"><span style="font-size: 20px;"><?php echo $specialty->name; ?> - </span><span style="font-size: 16px;"><?php echo $course->name; ?></span></div>

<div class="layui-form" style="margin-top: 15px; padding-right: 15px;">
<form id="detail_form" method="post" action="/glquesti/basic1/basicok">
  <div class="layui-form-item">
    <label class="layui-form-label">所属知识点</label>
    <div class="layui-input-block">
      <select name="treeid">
        <option value=""></option>
        <?php foreach($chapters as $onechapter){ ?>
        <option value="<?php echo $onechapter->id; ?>"<?php if($tree->id==$onechapter->id){echo ' selected';} ?>><?php echo $onechapter->name; ?></option>
          <?php if(!empty($onechapter->sections)){ foreach($onechapter->sections as $onesection){ ?>
          <option value="<?php echo $onesection->id; ?>"<?php if($tree->id==$onesection->id){echo ' selected';} ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|_<?php echo $onesection->name; ?></option>
          <?php if(!empty($onesection->knowledges)){ foreach($onesection->knowledges as $oneknowled){ ?>
          <option value="<?php echo $oneknowled->id; ?>"<?php if($tree->id==$oneknowled->id){echo ' selected';} ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|_<?php echo $oneknowled->name; ?></option>
          <?php } } ?>
          <?php } } ?>
        <?php } ?>
      </select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">难度系数</label>
    <div class="layui-input-block">
      <input type="radio" name="levels" value="1" title="简单"<?php if($stem->levels==1){echo ' checked';} ?>>
      <input type="radio" name="levels" value="2" title="一般"<?php if($stem->levels==2){echo ' checked';} ?>>
      <input type="radio" name="levels" value="3" title="困难"<?php if($stem->levels==3){echo ' checked';} ?>>
    </div>
  </div>

  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">题目标题</label>
    <div class="layui-input-block">
      <textarea name="content" id="editor_cont" class="layui-textarea" style="border: none;"><?php echo $stem->content; ?></textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
      <div>
        <a id="pickfiles" href="javascript:;" class='layui-btn layui-btn-sm' onclick="layer.alert('更多功能请至官网http://oa.iefeel.com体验');"><i class="layui-icon layui-icon-add-circle"></i>  上传音视频 (仅支持mp3, mp4)</a>
      </div>
    </div>
  </div>

  <script type="text/javascript">
  var ue_cont = UE.getEditor('editor_cont',{
    initialFrameWidth: '99.99%',
    initialFrameHeight: '80',
    scaleEnabled: false,
    toolbars: [
      [ 'source', 'undo', 'redo', 'bold', 'indent', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'formatmatch', 'blockquote', 'pasteplain', 'selectall', 'horizontal', 'removeformat', 'time', 'date', 'cleardoc', 'simpleupload', 'inserttable', 'edittable', 'edittd', 'insertrow', 'insertcol', 'deletetable', 'spechars', 'searchreplace', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'insertorderedlist', 'insertunorderedlist', 'pagebreak', 'imagenone', 'imageleft', 'imageright', 'imagecenter', 'lineheight', 'touppercase', 'tolowercase', 'kityformula', 'preview', 'fullscreen']
    ]
  });
  </script>

  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">试题解析</label>
    <div class="layui-input-block">
      <textarea name="explains" id="editor_expl" class="layui-textarea" style="border: none;"><?php echo $stem->explains; ?></textarea>
    </div>
  </div>
  <script type="text/javascript">
  var ue_expl = UE.getEditor('editor_expl',{
    initialFrameWidth: '99.99%',
    initialFrameHeight: '80',
    scaleEnabled: false,
    toolbars: [
      [ 'source', 'undo', 'redo', 'bold', 'indent', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'formatmatch', 'blockquote', 'pasteplain', 'selectall', 'horizontal', 'removeformat', 'time', 'date', 'cleardoc', 'simpleupload', 'inserttable', 'edittable', 'edittd', 'insertrow', 'insertcol', 'deletetable', 'spechars', 'searchreplace', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'insertorderedlist', 'insertunorderedlist', 'pagebreak', 'imagenone', 'imageleft', 'imageright', 'imagecenter', 'lineheight', 'touppercase', 'tolowercase', 'kityformula', 'preview', 'fullscreen']
    ]
  });
  </script>

  <?php if(empty($stem->options)){ ?>
  <input type="hidden" id="lastcodeindex" value="-1">
  <?php }else{ ?>
  <?php foreach($stem->options as $oneoption){ ?>
  <div class="layui-form-item layui-form-text" id="optionbox_<?php echo $oneoption->code; ?>">
    <label class="layui-form-label">选项 <?php echo $oneoption->code; ?></label>
    <div class="layui-input-block">
      <textarea name="optioncontent[]" id="editor_<?php echo $oneoption->code; ?>" class="layui-textarea" style="border: none;"><?php echo $oneoption->content; ?></textarea>
    </div>
    <input type="hidden" name="optioncode[]" value="<?php echo $oneoption->code; ?>">
  <script type="text/javascript">
  var ue_A = UE.getEditor('editor_<?php echo $oneoption->code; ?>',{
    initialFrameWidth: '99.99%',
    initialFrameHeight: '80',
    scaleEnabled: false,
    toolbars: [
      [ 'source', 'undo', 'redo', 'bold', 'indent', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'formatmatch', 'blockquote', 'pasteplain', 'selectall', 'horizontal', 'removeformat', 'time', 'date', 'cleardoc', 'simpleupload', 'inserttable', 'edittable', 'edittd', 'insertrow', 'insertcol', 'deletetable', 'spechars', 'searchreplace', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'insertorderedlist', 'insertunorderedlist', 'pagebreak', 'imagenone', 'imageleft', 'imageright', 'imagecenter', 'lineheight', 'touppercase', 'tolowercase', 'kityformula', 'preview', 'fullscreen']
    ]
  });
  </script>
  </div>
  <?php } ?>
  <input type="hidden" id="lastcodeindex" value="<?php echo count($stem->options)-1; ?>">
  <?php } ?>

  <div class="layui-form-item" id="addordelbuttonbox">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
      <a class="layui-btn layui-btn-sm" onclick="javascript:optionAdded();"><i class="layui-icon layui-icon-add-circle"></i> 增加选项</a>
      <a class="layui-btn layui-btn-sm" onclick="javascript:optionDelete();"><i class="fa fa-minus-circle"></i> 减少选项</a>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">试题答案</label>
    <div class="layui-input-block" id="answerbox_big">
    <?php if(!empty($stem->options)){ ?>
    <?php foreach($stem->options as $oneoption){ ?>
      <input type="radio" name="answercode" value="<?php echo $oneoption->code; ?>" title="<?php echo $oneoption->code; ?>" id="answerbox_<?php echo $oneoption->code; ?>"<?php if(stripos($stem->answer, $oneoption->code)!==false){echo ' checked';} ?>>
    <?php } ?>
    <?php } ?>
    </div>
  </div>  
  
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="button" class="layui-btn" id="finished_button">提交</button>
    </div>
  </div>
  <input type="hidden" name="courseid" value="<?php echo $course->id; ?>">
  <input type="hidden" name="stemid" value="<?php echo $stem->id; ?>">
  <input type="hidden" name="typechild" value="<?php echo $stem->typechild; ?>">
  <input type="hidden" name="listview" value="<?php echo $listview; ?>">
</form>
</div>

<form id="goback_form" method="post">
  <input type="hidden" name="treepath" value="<?php echo $tree->nodepath; ?>">
</form>

<script>
//题目选项字母集合
var questmaxoption = <?php echo Yii::$app->params["questmaxoption"]; ?>;
var optioncodestr = "<?php echo Yii::$app->params["en_letters"]; ?>";
var optioncodearr = optioncodestr.split(",");
</script>
<script src="/public/modules/glquesti/basic1/index.js"></script>