Beispiel #1
0
 function InitIface()
 {
     $WT_contest_id = $_SESSION['WT_contest_id'];
     $manage = $this->IsContestJudge();
     $started = WT_contest_running($WT_contest_id);
     $finished = WT_contest_finished($WT_contest_id);
     $c = $this->GetProblemsCountAtContest($WT_contest_id);
     if (WT_contest_running() || WT_contest_finished() || $this->IsContestJudge()) {
         $this->gateway->AppendMainMenuItem('Монитор', '.?page=monitor', 'monitor');
     }
     if ($started || $finished || $manage) {
         if ($c > 0) {
             $this->gateway->AppendMainMenuItem('Список задач', '.?page=problems', 'problems');
         }
     }
     if (($started || $finished || $manage) && $this->GetUserSolutionsCount($WT_contest_id, user_id())) {
         $this->gateway->AppendMainMenuItem('Статус', '.?page=status', 'status');
     }
     if ($started || $manage) {
         if ($c > 0) {
             $this->gateway->AppendMainMenuItem('Послать решение', '.?page=submit', 'submit');
         }
     }
     if ($this->GetAllowed('SOLUTIONS.MANAGE') && $this->GetAllSolutionsCount($WT_contest_id)) {
         $this->gateway->AppendMainMenuItem('Решения участников', '.?page=solutions', 'solutions');
     }
     if ($this->GetAllowed('PROBLEMS.MANAGE')) {
         $this->gateway->AppendMainMenuItem('Управление задачами', '.?page=prbmanager', 'prbmanager');
     }
     if ($this->GetAllowed('MONITOR.MEGAMONITOR')) {
         $this->gateway->AppendMainMenuItem('Мегамонитор', '.?page=megamonitor', 'megamonitor');
     }
 }
Beispiel #2
0
 function Test_CanObtain($contest_id = -1, $user_id = -1)
 {
     if ($contest_id < 0) {
         $contest_id = $_SESSION['WT_contest_id'];
     }
     if ($user_id < 0) {
         $user_id = user_id();
     }
     if ($this->GetAllowed('CONTEST.MANAGE')) {
         return true;
     }
     if ($this->IsContestJudge($user_id)) {
         return true;
     }
     if (!WT_contest_running($contest_id)) {
         return false;
     }
     return true;
 }