public function __construct(Ground $ground)
 {
     $this->ground = $ground;
     $this->searchable = new SearchItem("ground", "ground" . $ground->GetId(), $ground->GetNavigateUrl(false), $ground->GetNameAndTown());
     $this->searchable->Description($this->GetSearchDescription());
     $this->searchable->WeightOfType(800);
     $keywords = array($ground->GetAddress()->GetLocality(), $ground->GetAddress()->GetTown());
     $this->searchable->Keywords(implode(" ", $keywords));
     $content = array($ground->GetAddress()->GetStreetDescriptor(), $ground->GetAddress()->GetAdministrativeArea(), $ground->GetDirections(), $ground->GetParking(), $ground->GetFacilities());
     $this->searchable->FullText(implode(" ", $content));
     $this->searchable->RelatedLinksHtml('<ul>' . '<li><a href="' . $ground->GetStatsNavigateUrl() . '">Statistics</a></li>' . '</ul>');
 }
 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&amp;q=' . urlencode($this->ground->GetNameAndTown()) . '@' . $this->ground->GetAddress()->GetLatitude() . ',' . $this->ground->GetAddress()->GetLongitude() . '&amp;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");
     }
 }