Exemplo n.º 1
0
 static function get($id, $type = 'ended_tournament')
 {
     foreach (Tournament::$cache as $tournament) {
         if ($tournament->id == $id) {
             return $tournament;
         }
     }
     global $db;
     $tournaments = $db->select("SELECT *, `type` AS 'format' FROM `tournament` WHERE `id` = '{$id}'");
     if (count($tournaments) > 0) {
         if (count($tournaments) > 1) {
             // bug
             echo count($tournaments) . " tournaments found : {$id}\n";
         }
         $t = new Tournament($tournaments[0]);
         if ($t->status > 5) {
             $t->import('ended_tournament');
         } else {
             $t->import('running_tournament');
         }
         return $t;
     }
     return null;
 }