Example #1
0
 public function ACT_submit()
 {
     if (!$this->acl->check('general')) {
         $this->deny();
     }
     if ($this->config->getVar('judge_allowed') != 1) {
         $this->deny();
     }
     $user_id = $this->acl->getUser()->getID();
     $prob_id = $_POST['prob_id'];
     $lang = $_POST['lang'];
     $source = file_get_contents($_FILES['source']['tmp_name']);
     $problem = new MDL_Problem($prob_id);
     if (!$problem->getProblemMeta()->display || !$problem->getProblemMeta()->verified) {
         $this->deny();
     }
     $default_display = MDL_Config::getInstance()->getVar('record_display_default');
     $display = new MDL_Record_Display($default_display);
     $record_id = MDL_Judge_Single::submit($user_id, $prob_id, $lang, $source, $display);
     MDL_Judger_Process::processTaskQueue();
     $this->locator->redirect('record_detail', array(), '/' . $record_id);
 }
Example #2
0
 public function ACT_submit()
 {
     if (!$this->acl->check('general')) {
         $this->deny();
     }
     if ($this->config->getVar('judge_allowed') != 1) {
         $this->deny();
     }
     $user = $this->acl->getUser();
     $contest_id = $_POST['contest_id'];
     $contest = new MDL_Contest($contest_id);
     $contest_user = new MDL_Contest_User($contest, $user);
     if (!$contest_user->canSubmit()) {
         $this->deny();
     }
     $prob_id = $_POST['prob_id'];
     $language = $_POST['lang'];
     $source = file_get_contents($_FILES['source']['tmp_name']);
     $record_display = $contest->getConfig()->getRecordDisplay('during');
     $record_id = MDL_Judge_Single::submit($user->getID(), $prob_id, $language, $source, $record_display);
     $contest_user->addRecord($record_id);
     MDL_Judger_Process::processTaskQueue();
     $this->locator->redirect('record/detail', array(), '/' . $record_id);
 }
Example #3
0
 public static function recordComplete($info)
 {
     $record = new MDL_Record($info['record_id'], MDL_Record::GET_ALL);
     $record_meta = $record->getInfo()->getRecordMeta();
     if ($record_meta->getVar('status') == self::STATUS_STOPPED) {
         return;
     }
     $meta = array('result_text' => $info['fatal'], 'status' => self::STATUS_STOPPED, 'time' => $info['time'], 'memory' => $info['memory'], 'score' => $info['score']);
     $record_meta->setVars($meta);
     //unlock judger
     $judger = $record->getJudger();
     $judger->unlock();
     //process task queue
     MDL_Judger_Process::processTaskQueue();
 }
Example #4
0
 public static function rejudgeSingle($record_id)
 {
     MDL_Judge_Record::resetRecord($record_id);
     MDL_Judger_Process::processTaskQueue();
 }
Example #5
0
 public function ACT_process()
 {
     MDL_Judger_Process::processTaskQueue();
 }