public function about() { if (I('get.eid')) { $eid = I('get.eid', '', 'intval'); $user_id = $this->userInfo['user_id']; $row = ExamadminModel::instance()->chkexamprivilege($eid, $user_id); if (!is_array($row)) { if ($row == 0) { $this->error('You have no privilege!'); } else { if ($row == -1) { $this->error('No Such Exam'); } else { if ($row == -2) { $this->error('Do not login in diff machine,Please Contact administrator'); } } } } $isruning = ExamadminModel::instance()->chkruning($row['start_time'], $row['end_time']); $name = M('users')->field('nick')->where("user_id='%s'", $user_id)->find(); $this->zadd('isruning', $isruning); $this->zadd('row', $row); $this->zadd('name', $name['nick']); $this->auto_display(); } else { $this->error('No Such Exam'); } }
public function index() { $this->start2Exam(); $allBaseScore = ExamService::instance()->getBaseScoreByExamId($this->examId); $judgearr = ExamService::instance()->getUserAnswer($this->examId, $this->userInfo['user_id'], JudgeBaseModel::JUDGE_PROBLEM_TYPE); $judgeans = ProblemService::instance()->getProblemsAndAnswer4Exam($this->examId, JudgeBaseModel::JUDGE_PROBLEM_TYPE); $judgesx = ExamadminModel::instance()->getProblemSequence($this->examId, JudgeBaseModel::JUDGE_PROBLEM_TYPE, $this->randnum); $this->zadd('allscore', $allBaseScore); $this->zadd('judgearr', $judgearr); $this->zadd('judgesx', $judgesx); $this->zadd('judgeans', $judgeans); $this->zadd('questionName', JudgeBaseModel::JUDGE_PROBLEM_NAME); $this->zadd('problemType', JudgeBaseModel::JUDGE_PROBLEM_TYPE); $this->auto_display('Exam:judge', 'exlayout'); }
protected function preExamQuestion() { $eid = I('eid', 0, 'intval'); if (empty($eid)) { $this->alertError('No Such Exam!', U('/Home')); } else { $this->examId = $eid; $userId = $this->userInfo['user_id']; $this->examBase = ExamadminModel::instance()->checkExamPrivilege($eid, $userId, true); $this->navigationUrl = U('Home/Question/navigation', array('eid' => $this->examId)); if (is_array($this->examBase)) { $isruning = ExamadminModel::instance()->getExamRunningStatus($this->examBase['start_time'], $this->examBase['end_time']); if ($isruning != ExamBaseModel::EXAM_RUNNING) { $this->alertError('exam is not running!', U('Home/Index/index')); } $this->isRunning = $isruning; $lefttime = strtotime($this->examBase['end_time']) - time(); $this->leftTime = $lefttime; } else { $row = $this->examBase; if ($row == 0) { $this->alertError('You have no privilege!', U('/Home/')); } else { if ($row == -1) { $this->alertError('No Such Exam!', U('/Home/')); } else { if ($row == -2) { $this->alertError('Do not login in diff machine,Please Contact administrator', U('/Home')); } else { if ($row == -3) { $this->alertError('You have taken part in it', U('/Home/')); } } } } } } }