/** * @return void * @desc Create DataValidator objects to validate the edit control */ function CreateValidators() { # Validate fewer options for a new season than when editing, beacause a new season gets settings copied from last year to save time $b_is_new_season = !(bool) $this->GetDataObject()->GetId(); if (!$this->IsInternalPostback()) { require_once 'data/validation/required-field-validator.class.php'; require_once 'data/validation/length-validator.class.php'; require_once 'data/validation/numeric-validator.class.php'; $this->a_validators[] = new NumericValidator('competition', 'The competition identifier should be a number'); $this->a_validators[] = new RequiredFieldValidator('start', 'Please add the year the season starts', ValidatorMode::AllFields()); $this->a_validators[] = new NumericValidator('start', 'The start year must be a number'); $this->a_validators[] = new LengthValidator('start', 'The start year should be in YYYY format', 4, 4); $this->a_validators[] = new LengthValidator('intro', 'Please make the introduction shorter', 0, 10000); if (!$b_is_new_season) { $this->a_validators[] = new LengthValidator('results', 'Please make the results shorter', 0, 10000); foreach ($this->result_types as $o_result) { /* @var $o_result MatchResult */ $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Result' . $o_result->GetResultType() . 'Home', 'The home points for ' . MatchResult::Text($o_result->GetResultType()) . ' must be a number. For example, \'2\', not \'two\'.'); $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Result' . $o_result->GetResultType() . 'Away', 'The away points for ' . MatchResult::Text($o_result->GetResultType()) . ' must be a number. For example, \'2\', not \'two\'.'); } } } $a_aggregated_validators = array(); if (!$b_is_new_season) { $a_aggregated_validators = $this->adjustments_editor->GetValidators(); $a_aggregated_validators = array_merge($a_aggregated_validators, $this->match_types_editor->GetValidators()); $a_aggregated_validators = array_merge($a_aggregated_validators, $this->teams_editor->GetValidators()); } $this->a_validators = array_merge($this->a_validators, $a_aggregated_validators); }
/** * @return void * @desc Create DataValidator objects to validate the edit control */ function CreateValidators() { if (!$this->IsInternalPostback()) { require_once 'data/validation/required-field-validator.class.php'; require_once 'data/validation/plain-text-validator.class.php'; require_once 'data/validation/length-validator.class.php'; $this->a_validators[] = new RequiredFieldValidator('name', 'Please add a role name'); $this->a_validators[] = new PlainTextValidator('name', 'Please use only letters, numbers and simple punctuation in the role name'); $this->a_validators[] = new LengthValidator('name', 'Please make the role name shorter', 0, 100); } $a_aggregated_validators = array(); $a_aggregated_validators = $this->permissions_editor->GetValidators(); $this->a_validators = array_merge($this->a_validators, $a_aggregated_validators); }
/** * @return void * @desc Create DataValidator objects to validate the edit control */ function CreateValidators() { if (!$this->IsInternalPostback()) { require_once 'data/validation/required-field-validator.class.php'; require_once 'data/validation/plain-text-validator.class.php'; require_once 'data/validation/length-validator.class.php'; require_once 'data/validation/email-validator.class.php'; $this->a_validators[] = new RequiredFieldValidator('known_as', 'Please add the person\'s nickname'); $this->a_validators[] = new PlainTextValidator('known_as', 'Please use only letters, numbers and simple punctuation in the nickname'); $this->a_validators[] = new LengthValidator('known_as', 'Please make the nickname shorter', 0, 210); $this->a_validators[] = new PlainTextValidator('name_first', 'Please use only letters, numbers and simple punctuation in the first name'); $this->a_validators[] = new LengthValidator('name_first', 'Please make the first name shorter', 0, 100); $this->a_validators[] = new PlainTextValidator('name_last', 'Please use only letters, numbers and simple punctuation in the last name'); $this->a_validators[] = new LengthValidator('name_last', 'Please make the last name shorter', 0, 100); $this->a_validators[] = new EmailValidator('email', 'Please enter a valid email address'); $this->a_validators[] = new PlainTextValidator('email', 'Please use only letters, numbers and simple punctuation in the email address'); $this->a_validators[] = new LengthValidator('email', 'Please make the email address shorter', 0, 100); } $a_aggregated_validators = array(); $a_aggregated_validators = $this->roles_editor->GetValidators(); $this->a_validators = array_merge($this->a_validators, $a_aggregated_validators); }
/** * Creates an CategoryIdEditor * * @param SiteSettings $settings * @param DataEditControl $controlling_editor * @param string $s_id */ public function __construct(SiteSettings $settings, DataEditControl $controlling_editor, $s_id) { parent::__construct($settings, $controlling_editor, $s_id, 'Categories', array('Category'), 'Category', false, 'GetId', 'SetId', 'SetName'); $this->SetDisableSelected(true); }
/** * Creates a SeasonIdEditor * * @param SiteSettings $settings * @param DateEditControl $controlling_editor * @param string $s_id */ public function __construct(SiteSettings $settings, DataEditControl $controlling_editor, $s_id) { parent::__construct($settings, $controlling_editor, $s_id, 'Seasons', array('Season'), 'Season', true, 'GetId', 'SetId', 'SetName'); }