function OnLoadPageData() { # Require an API key to include personal contact details to avoid spam bots picking them up $api_keys = $this->GetSettings()->GetApiKeys(); $valid_key = false; if (isset($_GET['key']) and in_array($_GET['key'], $api_keys)) { $valid_key = true; } $data = array(); $data[] = array("Match id", "Title", "Start time", "Latitude", "Longitude", "Website", "Description"); require_once 'stoolball/match-manager.class.php'; require_once "search/match-search-adapter.class.php"; $match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection()); $match_manager->FilterByDateStart(gmdate("U")); $match_manager->ReadByMatchId(); while ($match_manager->MoveNext()) { $match = $match_manager->GetItem(); $adapter = new MatchSearchAdapter($match); /* @var $match Match */ # Add this match to the data array $data[] = array($match->GetId(), $match->GetTitle(), $match->GetStartTime(), $match->GetGround() instanceof Ground ? $match->GetGround()->GetAddress()->GetLatitude() : "", $match->GetGround() instanceof Ground ? $match->GetGround()->GetAddress()->GetLongitude() : "", "https://" . $this->GetSettings()->GetDomain() . $match->GetNavigateUrl(), $adapter->GetSearchDescription()); } unset($match_manager); require_once "data/csv.class.php"; CSV::PublishData($data); # Test code only. Comment out CSV publish line above to enable display as a table. require_once "xhtml/tables/xhtml-table.class.php"; $table = new XhtmlTable(); $table->BindArray($data, false, false); echo $table; }