function OnPageLoad() { echo '<h1>' . htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false) . '</h1>'; if (is_object($this->match)) { echo "<p>Thank you. You have added the following match:</p>"; echo new MatchListControl(array($this->match)); echo "<p>Don't worry if you made a mistake, just <a href=\"" . htmlentities($this->match->GetEditNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">edit this match</a> or <a href="' . htmlentities($this->match->GetDeleteNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">delete this match</a>.</p>'; $this->edit->SetHeading('Add another {0}'); # Configure edit control $this->edit->SetCssClass('panel addAnotherPanel'); } else { /* Create instruction panel */ $o_panel = new XhtmlElement('div'); $o_panel->SetCssClass('panel instructionPanel large'); $o_title_inner1 = new XhtmlElement('div', 'Add your matches 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')); if ($this->i_match_type != MatchType::TOURNAMENT_MATCH) { $o_tab_tip->AddControl(new XhtmlElement('li', 'If you\'re not sure when the match starts, leave the time blank')); } $o_panel->AddControl($o_tab_tip); echo $o_panel; # Configure edit control $this->edit->SetCssClass('panel'); } # display the match to edit echo $this->edit; parent::OnPageLoad(); }
/** * @return void * @desc Create DataValidator objects to validate the edit control */ public function CreateValidators() { require_once 'data/validation/numeric-validator.class.php'; require_once 'data/validation/length-validator.class.php'; if ($this->b_user_is_match_admin) { require_once 'data/validation/required-field-validator.class.php'; $this->AddValidator(new LengthValidator('title', 'Please make the match title shorter', 0, 100)); $this->AddValidator(new RequiredFieldValidator(array('type'), 'Please select a match type')); $this->AddValidator(new NumericValidator('type', 'The match type identifier should be a number')); } $this->EnsureAggregatedEditors(); if ($this->b_user_is_match_owner or $this->b_user_is_match_admin) { $this->a_validators = array_merge($this->a_validators, $this->fixture_editor->GetValidators()); } if ($this->b_user_is_match_admin) { $this->AddValidator(new NumericValidator('season', 'The season identifier should be a number')); $this->a_validators = array_merge($this->a_validators, $this->season_editor->GetValidators()); } $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'Result', 'The result identifier should be a number')); require_once 'data/validation/mutually-exclusive-validator.class.php'; $not_cancelled = array(0, -1, -2, -3, -4, -5, -6, -7, -8, -9, 5); $this->AddValidator(new MutuallyExclusiveValidator(array($this->GetNamingPrefix() . 'BatFirst', $this->GetNamingPrefix() . 'Result'), "Select who batted first or why the match wasn't played, not both", array("", $not_cancelled))); }