本文整理汇总了PHP中Record::setJudgeStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::setJudgeStatus方法的具体用法?PHP Record::setJudgeStatus怎么用?PHP Record::setJudgeStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::setJudgeStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateJudgeStatus
public function updateJudgeStatus()
{
try {
$op = strtolower(trim(fRequest::get('status', 'string')));
$judge_message = base64_decode(fRequest::get('judgeMessage', 'string'));
$verdict = fRequest::get('verdict', 'integer');
$id = fRequest::get('id', 'integer');
$r = new Record($id);
if ($op == 'running') {
$r->setJudgeStatus(JudgeStatus::RUNNING);
$r->setJudgeMessage($r->getJudgeMessage() . "\n{$judge_message}");
$r->store();
} else {
if ($op == 'done') {
$r->setJudgeStatus(JudgeStatus::DONE);
if (!empty($judge_message)) {
$r->setJudgeMessage($judge_message);
}
$r->setVerdict($verdict);
$r->store();
}
}
echo "{$op}\n";
echo "{$judge_message}\n";
echo "{$verdict}\n";
echo "{$id}\n";
} catch (fException $e) {
echo -1;
}
}
示例2: submit
public function submit($problem_id)
{
try {
$problem = new Problem($problem_id);
$language = fRequest::get('language', 'integer');
if (!array_key_exists($language, static::$languages)) {
throw new fValidationException('Invalid language.');
}
fSession::set('last_language', $language);
$code = trim(fRequest::get('code', 'string'));
if (strlen($code) == 0) {
throw new fValidationException('Code cannot be empty.');
}
if ($problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
}
}
$record = new Record();
$record->setOwner(fAuthorization::getUserToken());
$record->setProblemId($problem->getId());
$record->setSubmitCode($code);
$record->setCodeLanguage($language);
$record->setSubmitDatetime(Util::currentTime());
$record->setJudgeStatus(JudgeStatus::PENDING);
$record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
$record->setVerdict(Verdict::UNKNOWN);
$record->store();
Util::redirect('/status');
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
Util::redirect("/submit?problem={$problem_id}");
}
}
示例3: rejudge
public function rejudge($id)
{
try {
if (!User::can('rejudge-record')) {
throw new fAuthorizationException('You are not allowed to rejudge records.');
}
$old_record = new Record($id);
$new_record = new Record();
$new_record->setOwner($old_record->getOwner());
$new_record->setProblemId($old_record->getProblemId());
$new_record->setSubmitCode($old_record->getSubmitCode());
$new_record->setCodeLanguage($old_record->getCodeLanguage());
$new_record->setSubmitDatetime($old_record->getSubmitDatetime());
$new_record->setJudgeStatus(JudgeStatus::PENDING);
$new_record->setJudgeMessage('Rejudging... PROB=' . $old_record->getProblemId() . ' LANG=' . $old_record->getLanguageName());
$new_record->setVerdict(Verdict::UNKNOWN);
$new_record->store();
fMessaging::create('success', "Record {$id} rejudged.");
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
}
fURL::redirect(Util::getReferer());
}