public static function getRankingsAtEvent($eventId, $update = false) { if ($update) { require_once './eagle/utils/Downloader.php'; Downloader::getRankingsAtEvent($eventId); } $filename = './data/' . $eventId . '/rankings.json'; return self::readFile($filename); }
if (!count($teams)) { Downloader::getTeamsAtEvent($args['event']); header('Refresh:0'); } $matches = FileReader::getMatchesAtEvent($args['event']); if (!count($matches)) { Downloader::getMatchesAtEvent($args['event']); header('Refresh:0'); } $types = array('f' => 'Finals', 'sf' => 'Semifinals', 'qf' => 'Quarter Final', 'qm' => 'Qualifier'); foreach ($matches as $match) { $match->match_type = $types[$match->comp_level]; } $rankings = FileReader::getRankingsAtEvent($args['event']); if (!count($rankings)) { Downloader::getRankingsAtEvent($args['event']); header('Refresh:0'); } $dlstats = FileReader::getStatsAtEvent($args['event']); if (!$dlstats && !count($dlstats)) { Downloader::getStatsAtEvent($args['event']); header('Refresh:0'); } $stats = array(); for ($i = 0; $i < count((array) $dlstats->oprs); $i++) { $tempTeam = array_keys((array) $dlstats->oprs)[$i]; $opr = $dlstats->oprs->{$tempTeam}; $dpr = $dlstats->dprs->{$tempTeam}; $ccwm = $dlstats->ccwms->{$tempTeam}; $stats[$tempTeam] = array('number' => $tempTeam, 'opr' => $opr, 'dpr' => $dpr, 'ccwm' => $ccwm); }