<?php use app\components\QuestionHelper; ?>
<div class="layui-form"><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;">
<div class="layui-collapse" lay-accordion id="chapterlistbox">
<?php foreach($chapters as $chapterkey => $onechapter){ ?>
  <div class="layui-colla-item">
    <h2 class="layui-colla-title"><span><?php echo $onechapter->name; ?></span></span>
    <?php if($icandoedit==1){ ?>
    <div class="layui-btn-group" style="float: right;">
      <a class="layui-btn layui-btn-sm" title="添加节" onclick="javascript:return showSectionEditBox(0, <?php echo $onechapter->id; ?>);"><i class="layui-icon layui-icon-add-circle"></i> 添加节</a>
      <a class="layui-btn layui-btn-sm" title="编辑章" onclick="javascript:return showChapterEditBox(<?php echo $onechapter->id; ?>);">编辑</a>
      <a class="layui-btn layui-btn-sm" title="上移" onclick="javascript:return showNodeMoveupBox(<?php echo $onechapter->id; ?>, 'up');">上移</a>
      <a class="layui-btn layui-btn-sm" title="下移" onclick="javascript:return showNodeMoveupBox(<?php echo $onechapter->id; ?>, 'down');">下移</a>
      <a class="layui-btn layui-btn-sm" title="删除章" onclick="javascript:return showChapterDeleBox(<?php echo $onechapter->id; ?>);">删除</a>
    </div>
    <?php } ?>
    </h2>
    <div class="layui-colla-content<?php if(stripos($treepath, ','. $onechapter->id .',')!==false){echo ' layui-show';} ?>">
      <div class="layui-collapse" lay-accordion id="sectionlistbox_<?php echo $onechapter->id; ?>">
        <?php if(!empty($onechapter->sections)){ foreach($onechapter->sections as $sectionkey => $onesection){ ?>
        <div class="layui-colla-item">
          <h2 class="layui-colla-title"><span><?php echo $onesection->name; ?></span>
            <?php if($icandoedit==1){ ?>
            <div class="layui-btn-group" style="float: right;">
              <a class="layui-btn layui-btn-sm" title="添加知识点" onclick="javascript:return showKnowledEditBox(0, <?php echo $onesection->id; ?>);"><i class="layui-icon layui-icon-add-circle"></i> 添加知识点</a>
              <a class="layui-btn layui-btn-sm" title="编辑节" onclick="javascript:return showSectionEditBox(<?php echo $onesection->id; ?>, <?php echo $onechapter->id; ?>);">编辑</a>
              <a class="layui-btn layui-btn-sm" title="上移" onclick="javascript:return showNodeMoveupBox(<?php echo $onesection->id; ?>, 'up');">上移</a>
              <a class="layui-btn layui-btn-sm" title="下移" onclick="javascript:return showNodeMoveupBox(<?php echo $onesection->id; ?>, 'down');">下移</a>
              <a class="layui-btn layui-btn-sm" title="删除节" onclick="javascript:return showSectionDeleBox(<?php echo $onesection->id; ?>);">删除</a>
            </div>
            <?php } ?>
          </h2>
          <div class="layui-colla-content<?php if(stripos($treepath, ','. $onesection->id .',')!==false){echo ' layui-show';} ?>">
            <div class="layui-collapse" lay-accordion id="knowledlistbox_<?php echo $onesection->id; ?>">
              <?php if(!empty($onesection->knowledges)){ foreach($onesection->knowledges as $knowledkey => $oneknowled){ ?>
              <div class="layui-colla-item">
                <h2 class="layui-colla-title"><span><?php echo $oneknowled->name; ?></span>
                  <?php if($icandoedit==1){ ?>
                  <div class="layui-btn-group" style="float: right;">
                    <a class="layui-btn layui-btn-sm" title="编辑知识点" onclick="javascript:return showKnowledEditBox(<?php echo $oneknowled->id; ?>, <?php echo $onesection->id; ?>);">编辑</a>
                    <a class="layui-btn layui-btn-sm" title="上移" onclick="javascript:return showNodeMoveupBox(<?php echo $oneknowled->id; ?>, 'up');">上移</a>
                    <a class="layui-btn layui-btn-sm" title="下移" onclick="javascript:return showNodeMoveupBox(<?php echo $oneknowled->id; ?>, 'down');">下移</a>
                    <a class="layui-btn layui-btn-sm" title="删除知识点" onclick="javascript:return showKnowledDeleBox(<?php echo $oneknowled->id; ?>);">删除</a>
                  </div>
                  <?php } ?>
                </h2>
                <div class="layui-colla-content<?php if(stripos($treepath, ','. $oneknowled->id .',')!==false){echo ' layui-show';} ?>">
                </div>
              </div>
              <?php } } ?>
            </div>
          </div>
        </div>
        <?php } } ?>
      </div>
    </div>
  </div>
<?php } ?>
</div>
<?php if($icandoedit==1){ ?>
<div style="margin-top: 20px;"><a class="layui-btn" title="添加章" onclick="javascript:return showChapterEditBox(0);"><i class="layui-icon layui-icon-add-circle"></i> 添加章</a></div>
<?php } ?>
</div>

<input type="hidden" id="courseid" value="<?php echo $course->id; ?>">

<script src="/public/modules/glqcourse/tree/index.js"></script>