function OnPageLoad() { echo '<div class="ground vcard" typeof="schema:Place" about="' . $this->ground->GetLinkedDataUri() . '">'; $o_fn = new XhtmlElement('h1', htmlentities($this->ground->GetNameAndTown(), ENT_QUOTES, "UTF-8", false)); $o_fn->SetCssClass('fn'); $o_fn->AddAttribute("property", "schema:name"); echo $o_fn; require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => '', 'Statistics' => $this->ground->GetStatsNavigateUrl()); echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php $address = new XhtmlElement("div"); $address->AddAttribute("rel", "schema:address"); $address->AddAttribute("resource", $this->ground->GetLinkedDataUri() . "#PostalAddress"); $postal = new PostalAddressControl($this->ground->GetAddress()); $postal->AddAttribute("about", $this->ground->GetLinkedDataUri() . "#PostalAddress"); $address->AddControl($postal); echo $address; # Show teams based at this ground if ($this->ground->Teams()->GetCount()) { require_once "stoolball/team-list-control.class.php"; echo "<h2>Teams based at this ground</h2>" . new TeamListControl($this->ground->Teams()->GetItems()); } if (!is_null($this->ground->GetAddress()->GetLatitude()) and !is_null($this->ground->GetAddress()->GetLongitude())) { $o_geo = new XhtmlElement('div'); $o_geo->SetXhtmlId('geoGround'); $o_geo->AddAttribute("rel", "schema:geo"); $o_geo->AddAttribute("resource", $this->ground->GetLinkedDataUri() . "#geo"); $o_latlong = new XhtmlElement('p'); $o_latlong->SetCssClass('geo'); # geo microformat $o_latlong->AddAttribute("about", $this->ground->GetLinkedDataUri() . "#geo"); $o_latlong->AddAttribute("typeof", "schema:GeoCoordinates"); $o_latlong->AddControl('Latitude '); $o_lat = new XhtmlElement('span', (string) $this->ground->GetAddress()->GetLatitude()); $o_lat->SetCssClass('latitude'); # geo microformat $o_lat->AddAttribute("property", "schema:latitude"); $o_latlong->AddControl($o_lat); $o_latlong->AddControl('; longitude '); $o_long = new XhtmlElement('span', (string) $this->ground->GetAddress()->GetLongitude()); $o_long->SetCssClass('longitude'); # geo microformat $o_long->AddAttribute("property", "schema:longitude"); $o_latlong->AddControl($o_long); $o_geo->AddControl($o_latlong); $s_place = ''; $s_class = ''; switch ($this->ground->GetAddress()->GetGeoPrecision()) { case GeoPrecision::Exact(): $s_place = $this->ground->GetNameAndTown(); $s_class = 'exact'; break; case GeoPrecision::Postcode(): $s_place = $this->ground->GetAddress()->GetPostcode(); $s_class = 'postcode'; break; case GeoPrecision::StreetDescriptor(): $s_place = $this->ground->GetAddress()->GetStreetDescriptor() . ', ' . $this->ground->GetAddress()->GetTown(); $s_class = 'street'; break; case GeoPrecision::Town(): $s_place = $this->ground->GetAddress()->GetTown(); $s_class = 'town'; break; } $o_map_link = new XhtmlAnchor('Map of <span class="' . $s_class . '">' . htmlentities($s_place, ENT_QUOTES, "UTF-8", false) . '</span> on Google Maps', 'http://maps.google.co.uk/?z=16&q=' . urlencode($this->ground->GetNameAndTown()) . '@' . $this->ground->GetAddress()->GetLatitude() . ',' . $this->ground->GetAddress()->GetLongitude() . '&ll=' . $this->ground->GetAddress()->GetLatitude() . ',' . $this->ground->GetAddress()->GetLongitude()); $o_map = new XhtmlElement('div', $o_map_link); $o_geo->AddControl($o_map); echo $o_geo; } if ($this->ground->GetDirections()) { echo new XhtmlElement('h2', 'Directions'); $s_directions = htmlentities($this->ground->GetDirections(), ENT_QUOTES, "UTF-8", false); $s_directions = XhtmlMarkup::ApplyCharacterEntities($s_directions); $s_directions = XhtmlMarkup::ApplyParagraphs($s_directions); $s_directions = XhtmlMarkup::ApplySimpleTags($s_directions); echo $s_directions; } if ($this->ground->GetParking()) { echo new XhtmlElement('h2', 'Parking'); $s_parking = htmlentities($this->ground->GetParking(), ENT_QUOTES, "UTF-8", false); $s_parking = XhtmlMarkup::ApplyCharacterEntities($s_parking); $s_parking = XhtmlMarkup::ApplyParagraphs($s_parking); $s_parking = XhtmlMarkup::ApplySimpleTags($s_parking); $s_parking = XhtmlMarkup::ApplyLinks($s_parking); echo $s_parking; } if ($this->ground->GetFacilities()) { echo new XhtmlElement('h2', 'Facilities'); $s_facilities = htmlentities($this->ground->GetFacilities(), ENT_QUOTES, "UTF-8", false); $s_facilities = XhtmlMarkup::ApplyCharacterEntities($s_facilities); $s_facilities = XhtmlMarkup::ApplyParagraphs($s_facilities); $s_facilities = XhtmlMarkup::ApplySimpleTags($s_facilities); $s_facilities = XhtmlMarkup::ApplyLinks($s_facilities); echo $s_facilities; } $o_meta = new XhtmlElement('p'); $o_meta->SetCssClass('metadata'); $o_meta->AddControl('Status: '); $o_uid = new XhtmlElement('span', $this->ground->GetLinkedDataUri()); $o_uid->SetCssClass('uid'); $o_meta->AddControl($o_uid); $o_meta->AddControl(' last updated at '); $o_rev = new XhtmlElement('abbr', Date::BritishDateAndTime($this->ground->GetDateUpdated())); $o_rev->SetTitle(Date::Microformat($this->ground->GetDateUpdated())); $o_rev->SetCssClass('rev'); $o_meta->AddControl($o_rev); $o_meta->AddControl(', sort as '); $o_url = new XhtmlAnchor(htmlentities($this->ground->GetAddress()->GenerateSortName(), ENT_QUOTES, "UTF-8", false), $this->ground->GetNavigateUrl()); $o_url->SetCssClass('url sort-string'); $o_meta->AddControl($o_url); echo $o_meta; echo "</div>"; ?> </div> </div> <?php $this->AddSeparator(); $o_user = new UserEditPanel($this->GetSettings(), 'this ground'); $o_user->AddCssClass("with-tabs"); if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_GROUNDS)) { $o_user->AddLink("edit this ground", $this->ground->GetEditGroundUrl()); $o_user->AddLink("delete this ground", $this->ground->GetDeleteGroundUrl()); } echo $o_user; # Show top players if ($this->has_player_stats) { require_once 'stoolball/statistics-highlight-table.class.php'; echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, "All seasons"); } }
function OnPageLoad() { $is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT; $class = $is_tournament ? "match" : "match vevent"; ?> <div class="$class" typeof="schema:SportsEvent" about="<?php echo Html::Encode($this->match->GetLinkedDataUri()); ?> "> <?php require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => ''); if ($is_tournament) { $tabs['Tournament statistics'] = $this->match->GetNavigateUrl() . '/statistics'; # Make sure the reader knows this is a tournament, and the player type $says_tournament = strpos(strtolower($this->match->GetTitle()), 'tournament') !== false; $player_type = PlayerType::Text($this->match->GetPlayerType()); $says_player_type = strpos(strtolower($this->match->GetTitle()), strtolower(rtrim($player_type, '\''))) !== false; $page_title = $this->match->GetTitle() . ", " . Date::BritishDate($this->match->GetStartTime(), false); if (!$says_tournament and !$says_player_type) { $page_title .= ' (' . $player_type . ' stoolball tournament)'; } else { if (!$says_tournament) { $page_title .= ' stoolball tournament'; } else { if (!$says_player_type) { $page_title .= ' (' . $player_type . ')'; } } } $heading = new XhtmlElement('h1', $page_title); $heading->AddAttribute("property", "schema:name"); echo $heading; } else { if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $tabs['Match statistics'] = $this->match->GetNavigateUrl() . '/statistics'; $tabs['Tournament statistics'] = $this->match->GetTournament()->GetNavigateUrl() . '/statistics'; $page_title = $this->match->GetTitle() . " in the " . $this->match->GetTournament()->GetTitle(); } else { $tabs['Statistics'] = $this->match->GetNavigateUrl() . '/statistics'; $page_title = $this->match->GetTitle(); } $o_title = new XhtmlElement('h1', Html::Encode($page_title)); $o_title->AddAttribute("property", "schema:name"); # hCalendar $o_title->SetCssClass('summary'); $o_title_meta = new XhtmlElement('span', ' (stoolball)'); $o_title_meta->SetCssClass('metadata'); $o_title->AddControl($o_title_meta); if ($this->match->GetMatchType() !== MatchType::TOURNAMENT_MATCH) { $o_title->AddControl(", " . Date::BritishDate($this->match->GetStartTime(), false)); } echo $o_title; } echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if ($is_tournament) { require_once 'stoolball/tournaments/tournament-control.class.php'; echo new TournamentControl($this->GetSettings(), $this->match); } else { require_once 'stoolball/matches/match-control.class.php'; echo new MatchControl($this->GetSettings(), $this->match); } $this->DisplayComments(); $this->ShowSocial(); ?> </div> </div> </div> <?php $this->AddSeparator(); # add/edit/delete options $user_is_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES); $user_is_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId(); $panel = new UserEditPanel($this->GetSettings(), 'this match'); $panel->AddCssClass("with-tabs"); if ($user_is_admin or $user_is_owner) { $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink('edit this ' . $link_text, $this->match->GetEditNavigateUrl()); } else { if ($this->match->GetMatchType() != MatchType::PRACTICE and !$is_tournament) { $panel->AddLink('update result', $this->match->GetEditNavigateUrl()); } } if ($is_tournament) { $panel->AddCssClass("with-tabs"); if ($user_is_admin or $user_is_owner) { $panel->AddLink('add or remove teams', $this->match->EditTournamentTeamsUrl()); } $panel->AddLink('add or remove matches', $this->match->GetEditTournamentMatchesUrl()); if (count($this->match->GetMatchesInTournament())) { $panel->AddLink('update results', $this->match->GetNavigateUrl() . "/matches/results"); } } if ($user_is_admin or $user_is_owner) { if ($is_tournament) { $panel->AddLink('edit where to list this tournament', $this->match->EditTournamentCompetitionsUrl()); } $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink('delete this ' . $link_text, $this->match->GetDeleteNavigateUrl()); } if ($this->match->GetMatchType() != MatchType::TOURNAMENT_MATCH and $this->match->GetStartTime() > time()) { $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink("add {$link_text} to your calendar", $this->match->GetCalendarNavigateUrl()); } echo $panel; if ($this->has_player_stats) { $tournament = $is_tournament ? $this->match : $this->match->GetTournament(); require_once 'stoolball/statistics-highlight-table.class.php'; echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, "tournament"); echo '<p class="playerSummaryMore"><a href="' . $tournament->GetNavigateUrl() . '/statistics">Tournament statistics</a></p>'; } }
function OnPageLoad() { require_once 'xhtml/navigation/tabs.class.php'; require_once 'stoolball/match-list-control.class.php'; require_once 'stoolball/season-list-control.class.php'; /* @var $season Season */ $season = $this->competition->GetWorkingSeason(); echo new XhtmlElement('h1', Html::Encode($this->season->GetCompetitionName())); $tabs = array('Summary' => ''); if ($season->MatchTypes()->Contains(MatchType::LEAGUE)) { $tabs['Table'] = $season->GetTableUrl(); } if (count($season->GetTeams())) { $tabs['Map'] = $season->GetMapUrl(); } $tabs['Statistics'] = $season->GetStatisticsUrl(); echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php # Add intro if ($this->competition->GetIntro()) { $intro = htmlentities($this->competition->GetIntro(), ENT_QUOTES, "UTF-8", false); $intro = XhtmlMarkup::ApplyParagraphs($intro); $intro = XhtmlMarkup::ApplyLists($intro); $intro = XhtmlMarkup::ApplySimpleXhtmlTags($intro, false); $intro = XhtmlMarkup::ApplyLinks($intro); echo $intro; } # Add season intro if ($season->GetIntro()) { $intro = htmlentities($season->GetIntro(), ENT_QUOTES, "UTF-8", false); $intro = XhtmlMarkup::ApplyCharacterEntities($intro); $intro = XhtmlMarkup::ApplyParagraphs($intro); $intro = XhtmlMarkup::ApplyLinks($intro); $intro = XhtmlMarkup::ApplyLists($intro); $intro = XhtmlMarkup::ApplySimpleTags($intro); $intro = XhtmlMarkup::ApplyTables($intro); echo $intro; } # Add not active, if relevant if (!$this->competition->GetIsActive()) { echo new XhtmlElement('p', new XhtmlElement('strong', 'This competition isn\'t played any more.')); } # Add matches $a_matches = $season->GetMatches(); $i_matches = count($a_matches); if ($i_matches > 0) { echo new XhtmlElement('h2', 'Matches in ' . htmlentities($season->GetName(), ENT_QUOTES, "UTF-8", false) . ' season'); $o_matches = new MatchListControl($a_matches); if ($season->MatchTypes()->Contains(MatchType::LEAGUE)) { $o_matches->SetMatchTypesToLabel(array(MatchType::FRIENDLY, MatchType::CUP, MatchType::PRACTICE)); } else { if ($season->MatchTypes()->Contains(MatchType::CUP)) { $o_matches->SetMatchTypesToLabel(array(MatchType::FRIENDLY, MatchType::PRACTICE)); } else { $o_matches->SetMatchTypesToLabel(array(MatchType::PRACTICE)); } } echo $o_matches; } # Add teams $a_teams = $season->GetTeams(); if (count($a_teams) > 0) { require_once 'stoolball/team-list-control.class.php'; echo new XhtmlElement('h2', 'Teams playing in ' . htmlentities($season->GetName(), ENT_QUOTES, "UTF-8", false) . ' season'); echo new TeamListControl($a_teams); } # Add results if ($season->GetResults()) { $s_results = htmlentities($season->GetResults(), ENT_QUOTES, "UTF-8", false); $s_results = XhtmlMarkup::ApplyCharacterEntities($s_results); $s_results = XhtmlMarkup::ApplyParagraphs($s_results); $s_results = XhtmlMarkup::ApplyLinks($s_results); $s_results = XhtmlMarkup::ApplyLists($s_results); $s_results = XhtmlMarkup::ApplySimpleTags($s_results); $s_results = XhtmlMarkup::ApplyTables($s_results); echo $s_results; } # Add contact details $s_contact = $this->competition->GetContact(); $s_website = $this->competition->GetWebsiteUrl(); if ($s_contact or $s_website) { echo new XhtmlElement('h2', 'Contact details'); } if ($s_contact) { $s_contact = htmlentities($s_contact, ENT_QUOTES, "UTF-8", false); $s_contact = XhtmlMarkup::ApplyCharacterEntities($s_contact); require_once 'email/email-address-protector.class.php'; $protector = new EmailAddressProtector($this->GetSettings()); $s_contact = $protector->ApplyEmailProtection($s_contact, AuthenticationManager::GetUser()->IsSignedIn()); $s_contact = XhtmlMarkup::ApplyParagraphs($s_contact); $s_contact = XhtmlMarkup::ApplyLists($s_contact); $s_contact = XhtmlMarkup::ApplySimpleXhtmlTags($s_contact, false); $s_contact = XhtmlMarkup::ApplyLinks($s_contact); echo $s_contact; } if ($s_website) { echo new XhtmlAnchor("Visit the " . htmlentities($this->competition->GetName(), ENT_QUOTES, "UTF-8", false) . ' website', $s_website); } # Check for other seasons. Check is >2 becuase current season is there twice - added above if (count($this->competition->GetSeasons()) > 2) { require_once "stoolball/season-list-control.class.php"; echo new XhtmlElement('h2', 'Other seasons in the ' . htmlentities($this->competition->GetName(), ENT_QUOTES, "UTF-8", false), "screen"); $season_list = new SeasonListControl($this->competition->GetSeasons()); $season_list->SetExcludedSeasons(array($this->season)); $season_list->AddCssClass("screen"); echo $season_list; } ?> </div> </div> <?php $this->ShowSocial(); $this->AddSeparator(); # Panel for updates $you_can = new UserEditPanel($this->GetSettings(), 'this season'); $you_can->AddCssClass("with-tabs"); if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_COMPETITIONS)) { $you_can->AddLink('edit this competition', $this->competition->GetEditCompetitionUrl()); $you_can->AddLink('delete this competition', $this->competition->GetDeleteCompetitionUrl()); $you_can->AddLink('edit this season', $this->season->GetEditSeasonUrl()); # Only offer delete option if there's more than one season. Don't want to delete last season because # that leaves an empty competition which won't display. Instead, must delete whole competition with its one remaining season. if (count($this->competition->GetSeasons()) > 1) { $you_can->AddLink('delete this season', $this->season->GetDeleteSeasonUrl()); } } foreach ($this->season->MatchTypes() as $i_type) { if ($i_type != MatchType::PRACTICE and $i_type != MatchType::TOURNAMENT_MATCH) { $you_can->AddLink('add a ' . MatchType::Text($i_type), $this->season->GetNewMatchNavigateUrl($i_type)); } } if (count($this->season->GetMatches())) { # Make sure there's at least one match which is not a tournament or a practice foreach ($this->season->GetMatches() as $o_match) { /* @var $o_match Match */ if ($o_match->GetMatchType() == MatchType::PRACTICE or $o_match->GetMatchType() == MatchType::TOURNAMENT or $o_match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { continue; } else { $you_can->AddLink('update results', $this->season->GetResultsNavigateUrl()); break; } } $you_can->AddLink('add matches to your calendar', $this->season->GetCalendarNavigateUrl()); } echo $you_can; if ($this->has_player_stats) { require_once 'stoolball/statistics-highlight-table.class.php'; echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, $this->season->GetName() . " season"); } }
public function OnPageLoad() { echo '<article typeof="schema:SportsTeam" about="' . htmlentities($this->team->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false) . '">'; echo '<h1>Players for <span property="schema:name">' . htmlentities($this->team->GetName(), ENT_QUOTES, "UTF-8", false) . "</span></h1>"; require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => $this->team->GetNavigateUrl()); $tabs['Players'] = ''; $tabs['Statistics'] = $this->team->GetStatsNavigateUrl(); echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if (count($this->players) > 4) { $threshold = (int) gmdate("Y") - 1; $list_open = false; echo '<div class="player-list">'; foreach ($this->players as $player) { /* @var $player Player */ if ($player->GetPlayerRole() == Player::PLAYER and (gmdate("Y", $player->GetLastPlayedDate()) >= $threshold or $player->GetLastPlayedDate() == 0)) { if (!$list_open) { echo '<h2>Current and recent players</h2><ol rel="schema:members">'; $list_open = true; } echo '<li typeof="schema:Person" about="' . htmlentities($player->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false) . '"><a property="schema:name" rel="schema:url" href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a></li>"; } } if ($list_open) { echo "</ol>"; } $list_open = false; foreach ($this->players as $player) { /* @var $player Player */ if ($player->GetPlayerRole() == Player::PLAYER and gmdate("Y", $player->GetLastPlayedDate()) < $threshold and $player->GetLastPlayedDate() != 0) { if (!$list_open) { echo '<h2>Former players</h2><ol rel="schema:members">'; $list_open = true; } echo '<li typeof="schema:Person" about="' . htmlentities($player->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false) . '"><a property="schema:name" rel="schema:url" href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a></li>"; } } if ($list_open) { echo "</ol>"; } $list_open = false; foreach ($this->players as $player) { /* @var $player Player */ if ($player->GetPlayerRole() != Player::PLAYER) { if (!$list_open) { echo "<h2>Extras</h2><ul>"; $list_open = true; } echo '<li><a href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a></li>"; } } if ($list_open) { echo "</ul>"; } echo "</div>"; } else { ?> <p>There aren't any player statistics for this team yet.</p> <p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results – why you should add yours</a>.</p> <?php } ?> </div> </div> </article> <?php $this->AddSeparator(); if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $this->team->GetLinkedDataUri())) { # Create a panel with actions $panel = new UserEditPanel($this->GetSettings()); $panel->AddCssClass("with-tabs"); #$panel->AddLink("add a player", $this->team->GetPlayerAddNavigateUrl()); echo $panel; $this->BuySomething(); } else { echo '<div class="with-tabs">'; $this->BuySomething(); echo '</div>'; } }