<?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> <span class="layui-badge"><?php echo $course->questinum; ?></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 class="layui-badge"><?php echo $onechapter->questinum; ?></span>
    </h2>
    <div class="layui-colla-content<?php if(stripos($treepath, ','. $onechapter->id .',')!==false){echo ' layui-show';} ?>">
      <div class="layui-btn-group" style="margin-bottom: 10px;" id="chapterresoubox_<?php echo $onechapter->id; ?>">
        <?php foreach($onechapter->questistems as $onestem){ ?>
        <a class="layui-btn layui-btn-normal layui-btn-sm" style="margin-bottom: 5px;" onclick="javascript:showResourViewBox(<?php echo $onestem->id; ?>);"><?php echo QuestionHelper::ShowStemtypeName($onestem->typechild); ?></a>
        <?php } ?>
        <a class="layui-btn layui-btn-sm" style="margin-bottom: 5px;" title="管理题目" onclick="javascript:return showResourListBox(<?php echo $onechapter->id; ?>);">详情</a>
      </div>
      <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> <span class="layui-badge"><?php echo $onesection->questinum; ?></span>
          </h2>
          <div class="layui-colla-content<?php if(stripos($treepath, ','. $onesection->id .',')!==false){echo ' layui-show';} ?>">
            <div class="layui-btn-group" style="margin-bottom: 10px;" id="sectionresoubox_<?php echo $onesection->id; ?>">
              <?php foreach($onesection->questistems as $onestem){ ?>
              <a class="layui-btn layui-btn-normal layui-btn-sm" onclick="javascript:showResourViewBox(<?php echo $onestem->id; ?>);"><?php echo QuestionHelper::ShowStemtypeName($onestem->typechild); ?></a>
              <?php } ?>
              <a class="layui-btn layui-btn-sm" title="管理题目" onclick="javascript:return showResourListBox(<?php echo $onesection->id; ?>);">详情</a>
            </div>
            <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> <span class="layui-badge"><?php echo $oneknowled->questinum; ?></span>
                </h2>
                <div class="layui-colla-content<?php if(stripos($treepath, ','. $oneknowled->id .',')!==false){echo ' layui-show';} ?>">
                  <div class="layui-btn-group" id="knowledresoubox_<?php echo $oneknowled->id; ?>">
                    <?php foreach($oneknowled->questistems as $onestem){ ?>
                    <a class="layui-btn layui-btn-normal layui-btn-sm" onclick="javascript:showResourViewBox(<?php echo $onestem->id; ?>);"><?php echo QuestionHelper::ShowStemtypeName($onestem->typechild); ?></a>
                    <?php } ?>
                    <a class="layui-btn layui-btn-sm" title="管理题目" onclick="javascript:return showResourListBox(<?php echo $oneknowled->id; ?>);">详情</a>
                  </div>
                </div>
              </div>
              <?php } } ?>
            </div>
          </div>
        </div>
        <?php } } ?>
      </div>
    </div>
  </div>
<?php } ?>
</div>

</div>

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

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