Пример #1
0
 protected function isallow($eid, $isReturn = false)
 {
     $now = time();
     $field = array('creator, start_time, end_time');
     $res = ExamModel::instance()->getExamInfoById(intval($eid), $field);
     $hasPrivilege = 0;
     if ($now > strtotime($res['end_time']) && isset($_SESSION['contest_creator'])) {
         $hasPrivilege = 1;
     }
     if (!checkAdmin(5, $res['creator'], $hasPrivilege)) {
         $this->error('You have no privilege of this exam');
     }
     if ($isReturn) {
         return $res;
     }
 }
Пример #2
0
 public function exam()
 {
     $tmp = ExamModel::instance()->getExamInfoById($this->id, array('creator'));
     if (!checkAdmin(4, $tmp['creator'])) {
         $this->error('You have no privilege!');
     } else {
         $data['visible'] = 'N';
         ExamModel::instance()->updateExamInfoById($this->id, $data);
         $this->success("考试删除成功", U("Teacher/Index/index", array('page' => $this->page)), 2);
         //if the exam was deleted
         //the info of exam was deleted
         // $query="DELETE FROM `exp_question` WHERE `exam_id`='$id'";
         // $query="DELETE FROM `ex_privilege` WHERE `rightstr`='e$id'";
         // $query="DELETE FROM `ex_stuanswer` WHERE `exam_id`='$id'";
         // $query="DELETE FROM `ex_student` WHERE `exam_id`='$id'";
     }
 }