function OnPageLoad() { echo "<h1>Stoolball matches</h1>"; # Filter controls $filter_box = new XhtmlForm(); $filter_box->SetCssClass('dataFilter'); $filter_box->AddAttribute('method', 'get'); $filter_box->AddControl(new XhtmlElement('p', 'Show me: ', "follow-on large")); $filter_inner = new XhtmlElement('div'); $filter_box->AddControl($filter_inner); $gender = new XhtmlSelect('player', 'Player type'); $gender->SetHideLabel(true); $gender->AddControl(new XhtmlOption("mixed and ladies", '')); $gender->AddControl(new XhtmlOption('mixed', 1)); $gender->AddControl(new XhtmlOption("ladies", 2)); if (isset($_GET['player'])) { $gender->SelectOption($_GET['player']); } $filter_inner->AddControl($gender); $type = new XhtmlSelect('type', 'Match type'); $type->SetHideLabel(true); $type->AddControl(new XhtmlOption('all matches', '')); $type->AddControl(new XhtmlOption('league matches', MatchType::LEAGUE)); $type->AddControl(new XhtmlOption('cup matches', MatchType::CUP)); $type->AddControl(new XhtmlOption('friendlies', MatchType::FRIENDLY)); $type->AddControl(new XhtmlOption('tournaments', MatchType::TOURNAMENT)); $type->AddControl(new XhtmlOption('practices', MatchType::PRACTICE)); if (isset($_GET['type'])) { $type->SelectOption($_GET['type']); } $filter_inner->AddControl($type); $filter_inner->AddControl(' in '); $month = new XhtmlSelect('month', 'Month'); $month->SetHideLabel(true); $month->AddControl(new XhtmlOption('next few matches', '')); foreach ($this->a_months as $i_month => $i_matches) { $opt = new XhtmlOption(Date::MonthAndYear($i_month), $i_month); if (isset($_GET['month']) and $_GET['month'] == $i_month) { $opt->AddAttribute('selected', 'selected'); } $month->AddControl($opt); unset($opt); } $filter_inner->AddControl($month); $update = new XhtmlElement('input'); $update->AddAttribute('type', 'submit'); $update->AddAttribute('value', 'Update'); $filter_inner->AddControl($update); # Content container $container = new XhtmlElement('div', $filter_box, "box"); $content = new XhtmlElement("div", null, "box-content"); $container->AddControl($content); # Display the matches if (count($this->a_matches)) { $list = new MatchListControl($this->a_matches); $content->AddControl($list); } else { $content->AddControl(new XhtmlElement('p', 'Sorry, there are no matches to show you.')); $content->AddControl(new XhtmlElement('p', 'If you know of a match which should be listed, please <a href="/play/manage/website/">add the match to the website</a>.')); } echo $container; }