本文整理汇总了PHP中Status::to_text方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::to_text方法的具体用法?PHP Status::to_text怎么用?PHP Status::to_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::to_text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_testset_outputs
function build_testset_outputs()
{
echo "\nNote: Testcase reference output does not exist or is out of date, generating it now.\n";
$this->create_output_dir();
if (($status = $this->prepare_and_compile()) != 0) {
$msg = "Compiling failed with status " . Status::to_text($status) . "\n";
if (file_exists($this->output_dir . '/compiler.err')) {
$msg .= file_get_contents($this->output_dir . '/compiler.err', 0, null, 0, 10000);
} else {
$msg .= "<no message>\n";
}
file_put_contents($this->output_dir . "/buildresult", "Failed to build reference implementation.");
Log::warning("Failed to build reference implementation.", $this->entity->path());
throw new Exception($msg);
}
// Now build all testcases
foreach ($this->entity->testcases() as $case) {
echo " case: " . $case . "\n";
if (!$this->run_case($case)) {
$msg = "Runtime error for case {$case}.\n";
if (file_exists($this->output_dir . "/{$case}.err")) {
$msg .= file_get_contents($this->output_dir . "/{$case}.err", 0, null, 0, 10000);
}
file_put_contents($this->output_dir . "/buildresult", "Failed to run reference implementation.");
Log::warning("Failed to run reference implementation.", $this->entity->path());
throw new Exception($msg);
}
}
// Done
echo "Reference output generated successfully.\n\n";
file_put_contents($this->output_dir . "/buildresult", "Reference output generated successfully.");
return true;
}
示例2: judge_a_single_submission
function judge_a_single_submission()
{
// Clear all caches, otherwise we would use old data!
Entity::clear_cache();
// Retrieve a submission
global $self;
$subm = Submission::get_pending_submission($self->name . micro_nonce());
if (!$subm) {
// no submissions right now
sleep(DAEMON_SLEEP_TIME);
return;
}
// Some information on this submission
if (VERBOSE) {
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
}
// Let's judge it
try {
$judgement = new SubmissionJudgement($subm);
$judgement->judge();
} catch (Exception $e) {
Log::error($e, $subm->entity_path, $self->name);
echo "Error during judging!\n", $e;
}
if (VERBOSE) {
echo "Result: ", Status::to_text($subm), "\n";
}
// free up some memory
unset($judgement);
unset($subm);
if (function_exists('gc_collect_cycles')) {
// this doesn't exist in PHP < 5.3.0 :(
gc_collect_cycles();
}
if (VERBOSE) {
echo "Memory usage: ", memory_get_usage(), "\n";
}
}
示例3: write_print_submission
function write_print_submission($subm)
{
// include this submission?
if (!isset($_REQUEST['include_failed'])) {
if (!Status::is_passed($subm->status) and !$subm->status == Status::MISSED_DEADLINE) {
return;
}
}
// does it match a user filter?
if (@$_REQUEST['user_filter'] != '') {
$match = stripos(User::names_text($subm->users()), $_REQUEST['user_filter']);
if ($match === false) {
return;
}
}
// submission header
echo '<div class="submission">';
echo '<div class="submission-head">';
echo "<table><tr><td>Submission</td><td>#" . $subm->submissionid . " for <tt>" . htmlspecialchars($subm->entity_path) . "</tt></td></tr>";
echo "<tr><td>by</td><td>" . User::names_html($subm->users()) . "</td></tr>";
echo "<tr><td>on</td><td>" . format_date($subm->time) . "</td></tr>";
if (!Status::is_passed($subm->status)) {
echo "<tr><td>status</td><td><strong>" . strtoupper(Status::to_text($subm)) . "</strong></td></tr>";
}
echo "</table>";
echo "</div>\n";
if ($subm->is_archived()) {
// file header
echo "<div class=\"file\">";
echo '<div class="file-head">';
echo 'This submission has been archived';
echo '</div></div>';
} else {
// submission files
foreach ($subm->get_code_filenames() as $code_name => $filename) {
$this->write_print_file($filename, $subm->get_file($code_name));
}
}
echo "</div>\n";
}
示例4: write_print_submission
function write_print_submission($subm)
{
// include this submission?
if (!isset($_REQUEST['include_failed'])) {
if (!Status::is_passed($subm->status)) {
return;
}
}
// does it match a user filter?
if (@$_REQUEST['user_filter'] != '') {
$match = stripos(User::names_text($subm->users()), $_REQUEST['user_filter']);
if ($match === false) {
return;
}
}
// submission header
echo "\\section*{Submission \\#" . $subm->submissionid . " for " . htmlspecialchars($subm->entity_path) . "}\n";
echo "by " . User::names_html($subm->users()) . ", ";
echo "on " . format_date($subm->time) . "\n\n";
if (!Status::is_passed($subm->status)) {
echo "(status " . Status::to_text($subm) . ")";
}
// submission files
foreach ($subm->get_code_filenames() as $code_name => $filename) {
$this->write_print_file($filename, $subm->get_file($code_name));
}
echo "\\cleardoublepage\n";
}