Exemple #1
0
 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());
     }
 }