Esempio n. 1
0
 function encounter($roundId, $encId)
 {
     global $breadcrumbs, $template_dir, $smarty, $tournamentList, $notify, $lang;
     $tournament = $tournamentList->getTournament($this->tournamentId);
     $smarty->assign('tournament', $tournament);
     $enc = new EliminationEncounter($this->tournamentId, $roundId, $encId);
     foreach ($this->participants as $participant) {
         if ($participant->getId() == $enc->getPlayer1id()) {
             $player1 = $participant;
         }
         if ($participant->getId() == $enc->getPlayer2id()) {
             $player2 = $participant;
         }
     }
     if (!isset($player1) || !isset($player2)) {
         $notify->add($lang->get('encounter'), $lang->get('ntfy_submit_err_player'));
     } else {
         $breadcrumbs->addElement($player1->getName() . " vs. " . $player2->getName(), makeURL('tournament', array('tournamentid' => $_GET['tournamentid'], 'encid' => $_GET['encid'], 'roundid' => $_GET['roundid'], 'mode' => 'view')));
         $smarty->assign('path', $template_dir . "/eliminationencounter_detail.tpl");
         $smarty->assign('player1', array('name' => $player1->getName(), 'url' => $player1->getUrl()));
         $smarty->assign('player2', array('name' => $player2->getName(), 'url' => $player2->getUrl()));
         $enc_arr['points1'] = $enc->getPoints1();
         $enc_arr['points2'] = $enc->getPoints2();
         $enc_arr['finished'] = $enc->isFinished();
         $enc_arr['winner'] = $enc->getPoints1() > $enc->getPoints2() ? 1 : 2;
         $enc_arr['map'] = $this->getMap($_GET['roundid'] + 1);
         if ($enc->getStart() != 0) {
             $enc_arr['start'] = $enc->getStart() > time() ? timeLeft($enc->getStart()) : formatTime($enc->getStart());
             $tEnd = $enc->getStart() + $enc->getDuration();
             $enc_arr['end'] = $enc->getStart() < time() && $tEnd > time() ? timeLeft($tEnd) : formatTime($tEnd);
             $enc_arr['duration'] = $enc->getDuration();
         }
         $smarty->assign('enc', $enc_arr);
         $smarty->assign('user_can_submit', $this->checkSubmitRights($enc, $player1, $player2));
     }
     $smarty->assign('path', $template_dir . "/eliminationencounter_detail.tpl");
     $smarty->assign('_GET', $_GET);
 }