function OnPageInit()
 {
     # new data managers
     $this->match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection());
     # new edit control
     $this->editor = new TournamentEditControl($this->GetSettings());
     $this->editor->SetCssClass('panel');
     $this->RegisterControlForValidation($this->editor);
     # check permissions
     $this->b_user_is_match_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES);
     # run template method
     parent::OnPageInit();
 }
 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;
 }