// ------ GET CURRENT EVENT ID ------ \\ require_once __DIR__ . DIRECTORY_SEPARATOR . 'common.php'; $evtId = getEventId(); if (!$evtId) { exit('Pas de tournoi en cours'); } $evtId = getEventId(); $lastMatch = getLastMatch(); // ------ FETCH ALL AVAILABLES TEAMS ------ \\ $teams = getTeams($evtId); // ------ PARSE URL PARAMETERS TO KNOW WHAT WE SHOW ------ \\ $team = null; if (array_key_exists('team', $_GET)) { $teamAbbr = $_GET['team']; $team = findTeam($teams, $teamAbbr); $matchs = getMatchs($team['id']); usort($matchs, function ($match1, $match2) { return $match1['num'] > $match2['num'] ? 1 : -1; }); $matchs_done = array_filter($matchs, function ($match) { return (bool) $match['score']; }); $matchs_inprogress = array_filter($matchs, function ($match) { return (bool) $match['begin'] && !$match['end']; }); usort($matchs_inprogress, function ($match1, $match2) { return $match1['begin']['time'] < $match2['begin']['time'] ? 1 : -1; // DESC }); $matchs_scheduled = array_filter($matchs, function ($match) { return !$match['begin'];
$primeiraLiga = getPrimeiraLiga($football); //4 $serieA = getSerieA($football); //5 $bundesliga = getBundesliga($football); //6 $ligueOne = getLigueOne($football); //7 $championsLeague = getChampionsLeague($football); getMatchs($premierLeague, 1); getMatchs($laLiga, 2); getMatchs($primeiraLiga, 3); getMatchs($serieA, 4); getMatchs($bundesliga, 5); getMatchs($ligueOne, 6); getMatchs($championsLeague, 7); function getFootball($xml) { foreach ($xml->sport as $sport_) { if ($sport_->attributes()->name == 'Football') { return $sport_; } } } function getPremierLeague($football) { foreach ($football->event as $event_) { if ($event_->attributes()->name == 'Eng. Premier League') { return $event_; } }