function OnPageLoad()
    {
        echo new XhtmlElement('h1', Html::Encode('Delete ground: ' . $this->data_object->GetName()));
        if ($this->deleted) {
            ?>
<p>
	The ground has been deleted.
</p>
<p>
	<a href="/yesnosorry/groundlist.php">View all grounds</a>
</p>
<?php 
        } else {
            if ($this->has_permission) {
                ?>
<p>
	Deleting a ground cannot be undone. The ground will be removed from existing matches.
</p>
<p>
	Are you sure you want to delete this ground?
</p>
<form action="<?php 
                echo Html::Encode($this->data_object->GetDeleteGroundUrl());
                ?>
" method="post" class="deleteButtons">
	<div>
		<input type="submit" value="Delete ground" name="delete" />
		<input type="submit" value="Cancel" name="cancel" />
	</div>
</form>
<?php 
                $this->AddSeparator();
                require_once 'stoolball/user-edit-panel.class.php';
                $panel = new UserEditPanel($this->GetSettings(), 'this ground');
                $panel->AddLink('view this ground', $this->data_object->GetNavigateUrl());
                $panel->AddLink('edit this ground', $this->data_object->GetEditGroundUrl());
                echo $panel;
            } else {
                ?>
<p>
	Sorry, you're not allowed to delete this ground.
</p>
<p>
	<a href="<?php 
                echo Html::Encode($this->data_object->GetNavigateUrl());
                ?>
">Go back to the ground</a>
</p>
<?php 
            }
        }
    }
    function OnPageLoad()
    {
        $title = "Statistics at " . $this->ground->GetNameAndTown();
        if ($this->season) {
            $title .= " in the {$this->season} season";
        }
        echo "<h1>" . htmlentities($title, ENT_QUOTES, "UTF-8", false) . "</h1>";
        # See what stats we've got available
        require_once "_summary-data-found.php";
        require_once 'xhtml/navigation/tabs.class.php';
        $tabs = array('Summary' => $this->ground->GetNavigateUrl(), 'Statistics' => '');
        echo new Tabs($tabs);
        ?>
        <div class="box tab-box">
            <div class="dataFilter"></div>
            <div class="box-content">
        <?php 
        if (!$has_player_stats) {
            $yet = $this->season ? "in the {$this->season} season yet" : "yet";
            echo "<p>There aren't any statistics for " . htmlentities($this->ground->GetName() . ' ' . $yet, ENT_QUOTES, "UTF-8", false) . '.</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>';
        } else {
            require_once "_summary-controls.php";
            # Link to other seasons
            if (count($this->seasons_with_statistics) > 1) {
                echo new XhtmlElement('h2', 'More statistics for ' . htmlentities($this->ground->GetName(), ENT_QUOTES, "UTF-8", false));
                echo '<ul class="season-list">';
                if ($this->season) {
                    echo "<li><a href=\"" . htmlentities($this->ground->GetStatsNavigateUrl(), ENT_QUOTES, "UTF-8", false) . "\">All seasons</a></li>";
                }
                foreach ($this->seasons_with_statistics as $season) {
                    $season_url = $season->GetStartYear();
                    if ($season->GetStartYear() != $season->GetEndYear()) {
                        $season_url .= "-" . substr($season->GetEndYear(), 2, 2);
                    }
                    # Link to season if it's not the current season. Important to use !== because
                    # we're comparing numeric strings and with != 2009-10 is equal to 2009
                    if (!isset($_GET['params']) or (string) $season_url !== (string) $_GET["params"]) {
                        echo "<li><a href=\"" . htmlentities($this->ground->GetStatsNavigateUrl() . "/" . $season_url, ENT_QUOTES, "UTF-8", false) . "\">" . htmlentities($season->GetYears(), ENT_QUOTES, "UTF-8", false) . " season</a></li>";
                    }
                }
                echo "</ul>";
            }
        }
        ?>
        </div>
        </div>
        <?php 
    }