本文整理匯總了PHP中Submission::by_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Submission::by_id方法的具體用法?PHP Submission::by_id怎麽用?PHP Submission::by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Submission
的用法示例。
在下文中一共展示了Submission::by_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
Authentication::require_admin();
$this->is_admin_page = true;
// find submission
if (!isset($_REQUEST['submissionid'])) {
throw new NotFoundException("Missing parameter: submissionid");
}
$this->subm = Submission::by_id(intval($_REQUEST['submissionid']));
$this->entity = $this->subm->entity();
// rejudge?
if (isset($_REQUEST['rejudge'])) {
$this->subm->rejudge();
// redirect to this page, so a refresh doesn't rejudge again
Util::redirect('admin_view_submission.php?submissionid=' . $_REQUEST['submissionid']);
}
// delete?
if (isset($_REQUEST['delete'], $_POST['confirm']) && $_POST['confirm'] == sha1('confirmed' . $this->subm->submissionid)) {
$this->subm->delete();
Util::redirect('index.php' . $this->entity->path());
}
}
示例2: die
require_once '../lib/bootstrap.inc';
require_once '../lib/DateRange.php';
// -----------------------------------------------------------------------------
// Judge a single submission
// -----------------------------------------------------------------------------
if (!isset($_SERVER['argv'])) {
die("This program must be started from the console.");
}
if (count($_SERVER['argv']) < 2) {
die("Usage: try_to_judge_submission <SUBMISSIONID>.\n\n" . "For debug purposes, try to judge a submission and don't discard the temporary files.\n");
} else {
$submissionid = $_SERVER['argv'][1];
}
try {
// Retrieve the submission
$subm = Submission::by_id($submissionid);
// Some information on this submission
echo "\n";
echo "Submission id: ", $subm->submissionid, "\n";
echo "Submission to: ", $subm->entity_path, "\n";
echo "Submited on: ", format_date($subm->time), "\n";
echo "Submission by: ", User::names_text($subm->users()), "\n";
// this slows things down
echo "\n";
// Let's judge it
try {
$judgement = new SubmissionJudgement($subm);
$judgement->judge(false);
} catch (Exception $e) {
echo "Error during judging!\n", $e;
}