function OnPageLoad()
    {
        if (!$this->tournament instanceof Match or !$this->b_is_tournament) {
            http_response_code(404);
            require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
            return;
        }
        echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
        # check permission
        if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
            ?>
<p>Sorry, you can't edit a tournament unless you added it.</p>
<p><a href="<?php 
            echo Html::Encode($this->tournament->GetNavigateUrl());
            ?>
">Go back
to tournament</a></p>
			<?php 
            return;
        }
        # OK to edit the match
        $o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings());
        $this->editor->SetDataObject($o_match);
        echo $this->editor;
        parent::OnPageLoad();
    }
    function OnPageLoad()
    {
        if (!$this->tournament instanceof Match or !$this->b_is_tournament) {
            http_response_code(404);
            require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
            return;
        }
        echo new XhtmlElement('h1', htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false));
        # check permission
        if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
            ?>
<p>Sorry, you can't edit a tournament unless you added it.</p>
<p><a href="<?php 
            echo htmlentities($this->tournament->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false);
            ?>
">Go back
to tournament</a></p>
			<?php 
            return;
        }
        # OK to edit the match
        $o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings());
        $this->editor->SetDataObject($o_match);
        echo $this->editor;
        echo '<p class="facebook-tournaments">You can also list your tournament on the <a href="https://www.facebook.com/groups/1451559361817258/">Sussex Stoolball tournaments Facebook group</a>.</p>';
        parent::OnPageLoad();
    }
 function OnPageLoad()
 {
     echo '<h1>' . Html::Encode($this->GetPageTitle()) . '</h1>';
     if (!is_object($this->tournament)) {
         /* Create instruction panel */
         $o_panel = new XhtmlElement('div');
         $o_panel->SetCssClass('panel instructionPanel large');
         $o_title_inner1 = new XhtmlElement('div', 'Add your tournament quickly:');
         $o_title = new XhtmlElement('h2', $o_title_inner1);
         $o_panel->AddControl($o_title);
         $o_tab_tip = new XhtmlElement('ul');
         $o_tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> key on your keyboard to move through the form'));
         $o_tab_tip->AddControl(new XhtmlElement('li', 'Type the first letter or number to select from a dropdown list'));
         $o_tab_tip->AddControl(new XhtmlElement('li', 'If you\'re not sure of any details, leave them blank'));
         $o_panel->AddControl($o_tab_tip);
         echo $o_panel;
     }
     # Configure edit control
     $this->editor->SetCssClass('panel');
     # remember the page the user came from, in case they click cancel
     require_once 'xhtml/forms/textbox.class.php';
     $cancel_url = new TextBox('page', $this->destination_url_if_cancelled);
     $cancel_url->SetMode(TextBoxMode::Hidden());
     $this->editor->AddControl($cancel_url);
     # display the match to edit
     echo $this->editor;
 }