Example #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]);
 }
Example #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()]);
 }