function OnLoadPageData() { /* @var Ground $ground */ # check parameter if (!isset($_GET['item']) or !is_numeric($_GET['item'])) { $this->Redirect(); } # get ground $ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection()); $ground_manager->ReadById(array($_GET['item'])); $this->ground = $ground_manager->GetFirst(); unset($ground_manager); # must have found a ground if (!$this->ground instanceof Ground) { $this->Redirect('/play/'); } # Get some stats on the best players require_once 'stoolball/statistics/statistics-manager.class.php'; $statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection()); $statistics_manager->FilterByGround(array($this->ground->GetId())); $this->seasons_with_statistics = $statistics_manager->ReadSeasonsWithPlayerStatistics(); $this->statistics["querystring"] = "?ground=" . $this->ground->GetId(); if ($this->season) { # use midpoint of season to get season dates for filter $start_year = substr($this->season, 0, 4); $end_year = strlen($this->season) == 7 ? $start_year + 1 : $start_year; if ($start_year == $end_year) { $season_dates = Season::SeasonDates(mktime(0, 0, 0, 7, 1, $start_year)); } else { $season_dates = Season::SeasonDates(mktime(0, 0, 0, 12, 31, $start_year)); } $statistics_manager->FilterAfterDate($season_dates[0]); $statistics_manager->FilterBeforeDate($season_dates[1]); $this->statistics["querystring"] .= "&from=" . $season_dates[0] . "&to=" . $season_dates[1]; } require_once "_summary-data-query.php"; unset($statistics_manager); }