コード例 #1
0
ファイル: ReportController.php プロジェクト: daerduoCarey/oj
 public function show($id)
 {
     $this->cache_control('private', Variable::getInteger('status-refresh', 30));
     try {
         $this->report = new Report($id);
         if (!$this->report->isReadable()) {
             throw new fAuthorizationException('You are not allowed to view this report.');
         }
         global $cache;
         $this->board = $cache->get($this->report->getBoardCacheKey());
         if ($this->board === NULL) {
             $p = $this->report->getProblems();
             $un = $this->report->getUsernames();
             $up = $this->report->getUserPairs();
             $un[] = '';
             $up[] = array('id' => '', 'name' => '平均');
             $st = $this->report->getStartDatetime();
             $et = $this->report->getEndDatetime();
             $this->board = new BoardTable(ReportGenerator::headers($p), $up, ReportGenerator::scores($p, $un, $st, $et));
             $cache->set($this->report->getBoardCacheKey(), $this->board, 10);
         }
         if ($this->report->isHomework()) {
             $this->nav_class = 'homework';
         } else {
             $this->nav_class = 'reports';
         }
         $this->render('report/show');
     } catch (fExpectedException $e) {
         fMessaging::create('warning', $e->getMessage());
         fURL::redirect(Util::getReferer());
     } catch (fUnexpectedException $e) {
         fMessaging::create('error', $e->getMessage());
         fURL::redirect(Util::getReferer());
     }
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: daerduoCarey/oj
 /**
  * Authors Ranklist
  */
 public function ranklist()
 {
     $this->page = fRequest::get('page', 'integer', 1);
     if ($this->page <= 0) {
         $this->page = 1;
     }
     $this->user_stats = fRecordSet::build('UserStat', array(), array('solved' => 'desc', 'tried' => 'asc', 'submissions' => 'asc'), Variable::getInteger('users-per-page', 50), $this->page);
     $this->page_url = SITE_BASE . '/ranklist?page=';
     $this->page_records = $this->user_stats;
     $this->nav_class = 'ranklist';
     $this->render('user/ranklist');
 }
コード例 #3
0
ファイル: Problem.php プロジェクト: daerduoCarey/oj
 public static function find($view_any, $page, $title, $author)
 {
     $conditions = array();
     if (!$view_any) {
         $conditions['secret_before<='] = Util::currentTime();
     }
     if (strlen($title)) {
         $conditions['title~'] = $title;
     }
     if (strlen($author)) {
         $conditions['author~'] = $author;
     }
     $limit = Variable::getInteger('problems-per-page', 10);
     return fRecordSet::build('Problem', $conditions, array('id' => 'asc'), $limit, $page);
 }
コード例 #4
0
ファイル: Record.php プロジェクト: daerduoCarey/oj
 public static function find($top, $owner, $problem_id, $language, $verdict, $page = 1)
 {
     $conditions = array();
     if (!empty($top)) {
         $conditions['id<='] = $top;
     }
     if (strlen($owner)) {
         $conditions['owner='] = $owner;
     }
     if (strlen($problem_id)) {
         $conditions['problem_id='] = $problem_id;
     }
     if (!empty($language)) {
         $conditions['code_language='] = $language - 1;
     }
     if (!empty($verdict)) {
         $conditions['verdict='] = $verdict;
     }
     $limit = Variable::getInteger('records-per-page', 50);
     return fRecordSet::build('Record', $conditions, array('id' => 'desc'), $limit, $page);
 }
コード例 #5
0
ファイル: index.php プロジェクト: daerduoCarey/oj
        }
        ?>
          </td>
        <?php 
    }
    ?>
        <td><?php 
    echo $r->getTimeCost();
    ?>
</td>
        <td><?php 
    echo $r->getMemoryCost();
    ?>
</td>
        <td><?php 
    echo fHTML::encode($r->getLanguageName());
    ?>
</td>
        <td><?php 
    echo $r->getSubmitDatetime();
    ?>
</td>
      </tr>
    <?php 
}
?>
  </tbody>
</table>
<?php 
$meta_refresh = Variable::getInteger('status-refresh', 30);
include __DIR__ . '/../layout/footer.php';