<div class="layui-tab layui-tab-brief">
  <ul class="layui-tab-title">
    <?php include(__DIR__ ."/menu.php"); ?>
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">

<form class="layui-form" id="detail_form" method="post" style="margin-top:15px;">
  <div class="layui-form-item">
    <label class="layui-form-label">考试标题</label>
    <div class="layui-input-block">
      <input type="text" name="title" placeholder="请输入" class="layui-input" value="<?php echo $exam->title; ?>">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">所属课程</label>
    <div class="layui-input-block" id="coursenamebox"><?php if(!empty($exam->course)){echo '<span class="layui-badge layui-bg-blue" style="height:36px;line-height:36px;">'. $exam->course->name .'</span>';} ?></div>
    <?php if(empty($exam->courseid)){ ?>
    <div class="layui-input-block" style="margin-top:5px;"><a class="layui-btn layui-btn-sm" onclick="showCourseList();"><i class="layui-icon layui-icon-add-circle"></i> 选择课程</a></div>
    <?php } ?>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">适用班级</label>
    <div class="layui-input-block" id="forclassnamebox">
    <?php foreach ($forclasses as $oneclass) {
      echo '<span class="layui-badge layui-bg-blue" style="height:36px;line-height:36px;">'. $oneclass->name .'</span>&nbsp;&nbsp;';
    } ?></div>
    <?php if(empty($exam->ispublish)){ ?>
    <div class="layui-input-block" style="margin-top:5px;"><a class="layui-btn layui-btn-sm" onclick="showXzclassList();"><i class="layui-icon layui-icon-add-circle"></i> 选择班级</a>
    <a class="layui-btn layui-btn-sm" onclick="clearForclassnames();">删除 清空班级</a></div>
    <?php } ?>
  </div>
  
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">考试时间</label>
      <div class="layui-input-inline" style="width: 180px;">
        <input type="text" name="begintime" placeholder="请选择" autocomplete="off" class="layui-input" readonly value="<?php echo $exam->begintime; ?>">
      </div>
      <div class="layui-form-mid">-</div>
      <div class="layui-input-inline" style="width: 180px;">
        <input type="text" name="endtime" placeholder="请选择" autocomplete="off" class="layui-input" readonly value="<?php echo $exam->endtime; ?>">
      </div>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">总分</label>
    <div class="layui-input-block">
      <input type="text" name="points" placeholder="请输入" class="layui-input" value="<?php echo $exam->points; ?>">
    </div>
  </div>

  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">考试说明</label>
    <div class="layui-input-block">
      <textarea name="descrip" placeholder="请输入" class="layui-textarea"><?php echo $exam->descrip; ?></textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="button" class="layui-btn" id="finished_button">提交</button>
      <button type="button" class="layui-btn layui-btn-primary" onclick="javascript:window.history.back();">取消</button>
    </div>
  </div>

  <input type="hidden" name="examid" value="<?php echo $exam->id; ?>">
  <input type="hidden" name="courseid" value="<?php echo $exam->courseid; ?>">
  <input type="hidden" name="forclass" value="<?php echo $exam->forclass; ?>">
</form>

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

<script src="/public/modules/glexam/basic/index.js"></script>