public function OnLoadPageData() { require_once 'stoolball/competition-manager.class.php'; $manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); if ($this->season_id) { $manager->ReadById(null, array($this->season_id)); } else { $manager->ReadById(array($this->competition_id)); } $this->competition = $manager->GetFirst(); $this->season = $this->competition->GetWorkingSeason(); unset($manager); # If the competition was requested, redirect to the current season if ($this->competition_id) { http_response_code(303); header("Location: " . $this->season->GetMapUrl()); return; } $this->has_map = count($this->season->GetTeams()); # Get other seasons require_once 'stoolball/season-manager.class.php'; $a_comp_ids = array($this->competition->GetId()); $o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_manager->ReadByCompetitionId($a_comp_ids); $a_other_seasons = $o_season_manager->GetItems(); $this->competition->SetSeasons(array()); foreach ($a_other_seasons as $season) { if ($season->GetId() == $this->season->GetId()) { $this->competition->AddSeason($this->season, true); } else { $this->competition->AddSeason($season, false); } } }