Exemple #1
0
 public function main()
 {
     if (!isset($_GET['pod_id']) || !A()->isAdmin()) {
         return R('/');
     }
     $podId = $_GET['pod_id'];
     $pod = new Pod($podId);
     if (!$pod->awaitingPairings()) {
         return R('/pod/', ['pod_id' => $podId]);
     }
     $pod->pair();
     return R('/pod/', ['pod_id' => $podId]);
 }
Exemple #2
0
 public function main()
 {
     foreach (['match_id', 'wins', 'opponent_wins'] as $key) {
         if (!isset($_GET[$key])) {
             return R('/');
         }
     }
     $match = new Match($_GET['match_id']);
     if (!$match->awaitingResult()) {
         return R('/pod/', ['pod_id' => $match->podId()]);
     }
     if (!$match->isPlaying(S()->id()) && !A()->isAdmin()) {
         return R('/pod/', ['pod_id' => $match->podId()]);
     }
     $match->report($_GET['wins'], $_GET['opponent_wins']);
     $pod = new Pod($match->podId());
     if ($pod->awaitingPairings() && count($pod->rounds) <= 2) {
         $pod->pair();
     }
     return R('/pod/', ['pod_id' => $match->podId()]);
 }
Exemple #3
0
 public function main()
 {
     if (!isset($_GET['pod_id'])) {
         return R('/');
     }
     $podId = $_GET['pod_id'];
     $pod = new Pod($podId);
     $args = (array) $pod;
     if (A()->isAdmin() && $pod->awaitingPairings()) {
         $args['pairUrl'] = U('/pair/', false, ['pod_id' => $podId]);
     }
     $results = new Results();
     foreach ($args['rounds'] as &$round) {
         foreach ($round['matches'] as &$match) {
             $needsReport = $match['wins'] === null;
             $canReport = A()->isAdmin() || $match['playerId'] === S()->id() || $match['opponentId'] === S()->id();
             if ($needsReport && $canReport) {
                 $match['potentialResults'] = $results->potentialResults($match['matchId']);
             }
         }
     }
     $args['standings'] = (new Standings($podId))->getStandings();
     return T()->pod($args);
 }