Example #1
0
<p>请注意,点击下面任意一个题目的链接以后即开始计时。</p>
<table border="1">
	<tr>
		<td>代号</td>
		<td>题目</td>
		<td>分值</td>
		<td>状态</td>
	</tr>
<?php 
    foreach ($contest_config->getProblems() as $problem) {
        ?>
	<?php 
        $problem_url = $this->locator->getURL('contest/entry') . '/' . $contest_id . '/' . $problem->alias;
        ?>
	<?php 
        $contest_user = new MDL_Contest_User($contest, MDL_ACL::getInstance()->getUser());
        ?>
	<?php 
        $record = $contest_user->getLastRecordWithProblem($problem);
        ?>
	<tr>
		<td><?php 
        echo $problem->alias;
        ?>
</td>
		<td><a href="<?php 
        echo $problem_url;
        ?>
"><?php 
        echo $problem->getTitle();
        ?>
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);
 }