<?php use app\components\ExamHelper; ?>
<fieldset class="layui-elem-field layui-field-title">
  <legend>欢迎回来！</legend>
</fieldset>

<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title">
  <li class="layui-this"><a>最近参加的考试</a></li>
</ul>
<div class="layui-tab-content">
  <div class="layui-tab-item layui-show">
    <table class="layui-table" lay-skin="line">
      <thead>
        <tr>
          <th>考试名称</th>
	      <th>所属课程</th>
	      <th>开始时间</th>
	      <th>结束时间</th>
	      <th>得分</th>
	      <th>操作</th>
        </tr> 
      </thead>
      <tbody>
		<?php foreach($exams_canjia as $oneexam){ ?>
	    <tr>
	      <td><?php echo $oneexam->title; ?></td>
	      <td><?php echo ExamHelper::showCourseName($oneexam->courseid); ?></td>
	      <td><?php echo $oneexam->begintime; ?></td>
	      <td><?php echo $oneexam->endtime; ?></td>
	      <td><?php if(empty($oneexam->doexam)){echo '暂无';}else{echo $oneexam->doexam->points; } ?></td>
	      <td><?php if(empty($oneexam->doexam)){ ?>
	      	<a class="layui-btn layui-btn-sm" href="/doexam/question<?php if($oneexam->questway==2){echo 'chou';} ?>/<?php echo $oneexam->id; ?>">进入答题</a>
	      	<?php }else{
	        if($oneexam->doexam->isdone==2 || $oneexam->doexam->isdone==3){ ?><a class="layui-btn layui-btn-sm" onclick="showDoexamResult(<?php echo $oneexam->doexam->id; ?>, <?php echo $oneexam->questway; ?>);">查看结果</a><?php }else{ ?>
	        	<a class="layui-btn layui-btn-sm" href="/doexam/question<?php if($oneexam->questway==2){echo 'chou';} ?>/<?php echo $oneexam->id; ?>">进入答题</a>
	        	<?php }
	      } ?></td>
	    </tr>
		<?php } ?>
      </tbody>
    </table>
  </div>
</div>
</div>
<script src="/public/modules/user/default/index.js"></script>

<?php if($userobj->roleid==1 || $userobj->roleid==3){ ?>
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title">
  <li class="layui-this"><a>最近发布的考试</a></li>
</ul>
<div class="layui-tab-content">
  <div class="layui-tab-item layui-show">
    <table class="layui-table" lay-skin="line">
      <thead>
        <tr>
          <th>考试名称</th>
	      <th>所属课程</th>
	      <th>开始时间</th>
	      <th>结束时间</th>
	      <th>总分</th>
	      <th>操作</th>
        </tr> 
      </thead>
      <tbody>
        <?php foreach($exams_fabu as $oneexam){ ?>
	    <tr>
	      <td><?php echo $oneexam->title; ?></td>
	      <td><?php echo ExamHelper::showCourseName($oneexam->courseid); ?></td>
	      <td><?php echo $oneexam->begintime; ?></td>
	      <td><?php echo $oneexam->endtime; ?></td>
	      <td><?php echo $oneexam->points; ?></td>
	      <td><div class="layui-btn-group">
	      <a class="layui-btn layui-btn-sm" href="/glexam/basic/<?php echo $oneexam->id; ?>">编辑</a>
	      <?php if($oneexam->questway!=2){ ?>
	      <a class="layui-btn layui-btn-sm" onclick="javascript:return showExamPreviewBox(<?php echo $oneexam->id; ?>);">预览</a>
	      <?php } ?>
	      <?php if($oneexam->questway==2){ ?>
	      <a class="layui-btn layui-btn-sm" title="导出试卷" onclick="exportPaperPerson(<?php echo $oneexam->id; ?>)">导出试卷</a>
	      <?php }else{ ?>
	      <a class="layui-btn layui-btn-sm" title="导出试卷" target="_blank" href="/glexam/exportpaper/<?php echo $oneexam->id; ?>">导出试卷</a>
	      <?php } ?>
	      <?php if($oneexam->ispublish==1){ ?>
	      <a class="layui-btn layui-btn-sm" title="批改" href="/glexam/pigai/<?php echo $oneexam->id; ?>">批改</a>
	      <a class="layui-btn layui-btn-sm" onclick="showExamTongjiBox(<?php echo $oneexam->id; ?>);">统计</a>
	      <a class="layui-btn layui-btn-sm" target="_blank" href="/glexam/export/<?php echo $oneexam->id; ?>">导出成绩</a>
	      <?php } ?>
	      </div></td>
	    </tr>
		<?php } ?>
      </tbody>
    </table>
  </div>
</div>
</div>
<script src="/public/modules/user/default/index_tea.js"></script>
<?php } ?>