function OnPageLoad()
    {
        echo new XhtmlElement('h1', Html::Encode('Delete club: ' . $this->data_object->GetName()));
        if ($this->deleted) {
            ?>
			<p>The club has been deleted.</p>
			<p><a href="/play/clubs/">View all clubs</a></p>
			<?php 
        } else {
            if ($this->has_permission) {
                ?>
				<p>Deleting a club cannot be undone.</p>
				<p>Are you sure you want to delete this club?</p>
				<form action="<?php 
                echo Html::Encode($this->data_object->GetDeleteClubUrl());
                ?>
" method="post" class="deleteButtons">
				<div>
				<input type="submit" value="Delete club" 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 club');
                $panel->AddLink('view this club', $this->data_object->GetNavigateUrl());
                $panel->AddLink('edit this club', $this->data_object->GetEditClubUrl());
                echo $panel;
            } else {
                ?>
				<p>Sorry, you're not allowed to delete this club.</p>
				<p><a href="<?php 
                echo Html::Encode($this->data_object->GetNavigateUrl());
                ?>
">Go back to the club</a></p>
				<?php 
            }
        }
    }
 function OnPrePageLoad()
 {
     # set page title
     $this->SetPageTitle(is_object($this->o_club) ? $this->o_club->GetName() . ': Edit stoolball club' : 'New stoolball club');
 }
    function OnPageLoad()
    {
        echo new XhtmlElement('h1', Html::Encode($this->club->GetName()));
        $a_teams = $this->club->GetItems();
        if (count($a_teams) > 0) {
            echo new TeamListControl($a_teams);
        }
        if ($this->club->GetClubmarkAccredited()) {
            ?>
            <p><img src="/images/logos/clubmark.png" alt="Clubmark accredited" width="150" height="29" /></p>
            <p>This is a <a href="http://www.sportenglandclubmatters.com/club-mark/">Clubmark accredited</a> stoolball club.</p>
            <?php 
        }
        $has_facebook_group_url = ($this->club->GetFacebookUrl() and strpos($this->club->GetFacebookUrl(), '/groups/') !== false);
        $has_facebook_page_url = ($this->club->GetFacebookUrl() and !$has_facebook_group_url);
        if ($has_facebook_page_url) {
            $this->ShowFacebookPage($this->club->GetFacebookUrl(), $this->club->GetName());
        }
        if ($has_facebook_group_url or $this->club->GetTwitterAccount() or $this->club->GetInstagramAccount()) {
            ?>
            <div class="social screen">
            <?php 
            if ($has_facebook_group_url) {
                ?>
                <a href="<?php 
                echo Html::Encode($this->club->GetFacebookUrl());
                ?>
" class="facebook-group"><img src="/images/play/find-us-on-facebook.png" alt="Find us on Facebook" width="137" height="22" /></a>
            <?php 
            }
            if ($this->club->GetTwitterAccount()) {
                ?>
                <a href="https://twitter.com/<?php 
                echo Html::Encode(substr($this->club->GetTwitterAccount(), 1));
                ?>
" class="twitter-follow-button">Follow <?php 
                echo Html::Encode($this->club->GetTwitterAccount());
                ?>
</a>
                <script src="https://platform.twitter.com/widgets.js"></script>
            <?php 
            }
            if ($this->club->GetInstagramAccount()) {
                ?>
                <a href="https://www.instagram.com/<?php 
                echo Html::Encode(trim($this->club->GetInstagramAccount(), '@'));
                ?>
/?ref=badge" class="instagram"><img src="//badges.instagram.com/static/images/ig-badge-view-24.png" alt="Instagram" /></a>
                <?php 
            }
            ?>
            </div>
            <?php 
        }
        $can_edit = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS);
        if ($can_edit or $has_facebook_page_url) {
            $this->AddSeparator();
        }
        if ($can_edit) {
            $club_or_school = $this->club->GetTypeOfClub() == Club::SCHOOL ? "school" : "club";
            require_once 'stoolball/user-edit-panel.class.php';
            $panel = new UserEditPanel($this->GetSettings(), "this {$club_or_school}");
            $panel->AddLink("edit this {$club_or_school}", $this->club->GetEditClubUrl());
            if ($this->club->GetTypeOfClub() == Club::SCHOOL) {
                $panel->AddLink("edit this school as a club", $this->club->GetEditClubUrl() . "/club");
            }
            $panel->AddLink("delete this {$club_or_school}", $this->club->GetDeleteClubUrl());
            echo $panel;
        }
        parent::OnPageLoad();
    }