/**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     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 'http/short-url-validator.class.php';
     # validate data
     $this->a_validators[] = new LengthValidator('directions', 'Please make the directions shorter', 0, 10000);
     $this->a_validators[] = new LengthValidator('parking', 'Please make the parking information shorter', 0, 10000);
     $this->a_validators[] = new LengthValidator('facilities', 'Please make the facilities description shorter', 0, 10000);
     $this->a_validators = array_merge($this->a_validators, $this->o_address_edit->GetValidators());
     $this->a_validators[] = new ShortUrlValidator($this->GetNamingPrefix() . 'ShortUrl', 'That short URL is already in use', ValidatorMode::SingleField(), $this->GetDataObject());
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/email-validator.class.php';
     require_once 'data/validation/spam-validator.class.php';
     require_once 'data/validation/length-validator.class.php';
     require_once 'data/validation/compare-validator.class.php';
     require_once 'data/validation/regex-validator.class.php';
     $this->a_validators[] = new RequiredFieldValidator(array('known_as'), 'Please enter your name');
     $this->a_validators[] = new LengthValidator('known_as', 'Your name must not be longer than 210 characters', 0, 210);
     $this->a_validators[] = new RegExValidator("known_as", "Sorry that username is not available", "^[A-Za-z0-9]+[a-z][0-9]*[A-Z]{2,3}!?\$", ValidatorMode::SingleField(), false);
     $this->a_validators[] = new RegExValidator("known_as", "Sorry that username is not available", "^trx[0-9]+r\$", ValidatorMode::SingleField(), false);
     $this->a_validators[] = new RegExValidator("known_as", "Sorry that username is not available", "\n", ValidatorMode::SingleField(), false);
     $this->a_validators[] = new EmailValidator('email', 'Please type your real email address');
     $this->a_validators[] = new RequiredFieldValidator(array('email'), 'Please enter your email address');
     $this->a_validators[] = new LengthValidator('password1', 'Choose a password at least 10 characters long', 10, null);
     $this->a_validators[] = new RequiredFieldValidator(array('password1'), 'Please choose a password');
     $this->a_validators[] = new CompareValidator(array('password1', 'password2'), 'Please confirm your password');
     $this->a_validators[] = new SpamValidator('dummy', 'Please ignore the final field');
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     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/regex-validator.class.php';
     require_once 'http/short-url-validator.class.php';
     $this->a_validators[] = new RequiredFieldValidator('name', 'Please add the name of the club');
     $this->a_validators[] = new PlainTextValidator('name', 'Please use only letters, numbers and simple punctuation in the club name');
     $this->a_validators[] = new LengthValidator('name', 'Please make the club name shorter', 0, 250);
     $this->a_validators[] = new RegexValidator('facebook', 'Please enter a valid Facebook URL', '^(|https?:\\/\\/(m.|www.|)facebook.com\\/.+)');
     $this->a_validators[] = new ShortUrlValidator($this->GetNamingPrefix() . 'ShortUrl', 'That short URL is already in use', ValidatorMode::SingleField(), $this->GetDataObject());
 }
 /**
  * @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';
     require_once 'data/validation/required-field-validator.class.php';
     $match = $this->GetDataObject();
     /* @var $match Match */
     $s_home_team = (is_object($match) and is_object($match->GetHomeTeam())) ? $match->GetHomeTeam()->GetName() : 'home team';
     $s_away_team = (is_object($match) and is_object($match->GetAwayTeam())) ? $match->GetAwayTeam()->GetName() : 'away team';
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'Result', 'The result identifier must be a number'));
     $this->AddValidator(new LengthValidator($this->GetNamingPrefix() . 'Player', "The player of the match must be 100 characters or fewer.", 0, 100));
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'PlayerTeam', "The player of the match's team must be identified by a number"));
     $this->AddValidator(new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Player', $this->GetNamingPrefix() . 'PlayerTeam'), "Please enter both the name and team of the player of the match.", ValidatorMode::AllOrNothing()));
     $this->AddValidator(new LengthValidator($this->GetNamingPrefix() . 'PlayerHome', "The {$s_home_team} player of the match must be 100 characters or fewer.", 0, 100));
     $this->AddValidator(new LengthValidator($this->GetNamingPrefix() . 'PlayerAway', "The {$s_away_team} player of the match must be 100 characters or fewer.", 0, 100));
 }
 /**
  * @return bool
  * @desc Check whether the field(s) are valid
  */
 function IsValid()
 {
     // Cache validation so that multiple calls to IsValid don't process again
     if (isset($this->b_valid)) {
         return $this->b_valid;
     }
     if (is_array($this->a_keys) and is_array($this->a_data)) {
         if ($this->i_mode == ValidatorMode::SingleField()) {
             if (!isset($this->a_data[$this->a_keys[0]])) {
                 $this->b_valid = $this->b_valid_if_not_found;
             } else {
                 $this->b_valid = $this->Test($this->a_data[$this->a_keys[0]], $this->a_keys);
             }
         } elseif ($this->i_mode == ValidatorMode::AnyField()) {
             $b_valid = false;
             foreach ($this->a_keys as $s_key) {
                 $b_valid = $b_valid || (isset($this->a_data[$s_key]) and $this->Test($this->a_data[$s_key], $this->a_keys));
             }
             $this->b_valid = $b_valid;
         } elseif ($this->i_mode == ValidatorMode::AllFields()) {
             $b_valid = true;
             foreach ($this->a_keys as $s_key) {
                 $b_valid = ($b_valid and (isset($this->a_data[$s_key]) and $this->Test($this->a_data[$s_key], $this->a_keys)));
             }
             $this->b_valid = $b_valid;
         } elseif ($this->i_mode == ValidatorMode::AllOrNothing()) {
             $b_valid = true;
             $b_expected = (isset($this->a_data[$this->a_keys[0]]) and $this->Test($this->a_data[$this->a_keys[0]], $this->a_keys));
             $i_fields = count($this->a_keys);
             if ($i_fields > 1) {
                 for ($i = 1; $i < $i_fields; $i++) {
                     if ((isset($this->a_data[$this->a_keys[$i]]) and $this->Test($this->a_data[$this->a_keys[$i]], $this->a_keys)) != $b_expected) {
                         $b_valid = false;
                     }
                 }
             }
             $this->b_valid = $b_valid;
         } elseif ($this->i_mode == ValidatorMode::MultiField()) {
             $this->b_valid = $this->Test($this->a_data, $this->a_keys);
         }
     } else {
         $this->b_valid = false;
     }
     return $this->b_valid;
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 public function CreateValidators()
 {
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/numeric-validator.class.php';
     require_once 'data/validation/length-validator.class.php';
     $this->a_validators = array();
     $this->AddValidator(new RequiredFieldValidator($this->GetNamingPrefix() . 'Title', 'Please enter the tournament name', ValidatorMode::SingleField()));
     $this->AddValidator(new LengthValidator($this->GetNamingPrefix() . 'Title', 'Your tournament name should not be more than 200 characters long', 0, 200));
     $player_type_required = new RequiredFieldValidator($this->GetNamingPrefix() . 'PlayerType', 'Please specify who can play in the tournament');
     $player_type_required->SetValidIfNotFound(false);
     $this->AddValidator($player_type_required);
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'Qualify', 'A number should represent who can play'));
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'PlayerType', 'A number should represent the type of team'));
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'Players', "The number of players per team should be in digits, for example '8' not 'eight'"));
     $this->AddValidator(new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Start_day', $this->GetNamingPrefix() . 'Start_month', $this->GetNamingPrefix() . 'Start_year'), 'Please select a date for the match', ValidatorMode::AllFields()));
     $this->AddValidator(new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Start_hour', $this->GetNamingPrefix() . 'Start_minute', $this->GetNamingPrefix() . 'Start_ampm'), 'If you know the match time select the hour, minute and am or pm. If not, leave all three blank.', ValidatorMode::AllOrNothing()));
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'Ground', 'The ground should be a number'));
     $this->AddValidator(new LengthValidator($this->GetNamingPrefix() . 'Notes', 'Your match notes should not be more than 5000 characters long', 0, 5000));
 }
 /**
  * Creates a new TeamNameValidator
  * @param string[] $a_keys
  * @param string $message
  * @return void
  */
 public function __construct($a_keys, $message)
 {
     parent::DataValidator($a_keys, $message, ValidatorMode::MultiField());
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     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';
     require_once 'data/validation/numeric-validator.class.php';
     require_once 'data/validation/url-validator.class.php';
     require_once 'http/short-url-validator.class.php';
     $this->AddValidator(new RequiredFieldValidator('name', 'Please add the name of the competition'));
     $this->AddValidator(new PlainTextValidator('name', 'Please use only letters, numbers and simple punctuation in the competition name'));
     $this->AddValidator(new LengthValidator('name', 'Please make the competition name shorter', 0, 100));
     $this->AddValidator(new RequiredFieldValidator('playerType', 'Please specify the type of player allowed in the competiton'));
     $this->AddValidator(new NumericValidator('playerType', 'The player type identifier should be a number'));
     $this->AddValidator(new RequiredFieldValidator('players', 'Please specify the maximum number of players per team'));
     $this->AddValidator(new NumericValidator('players', "The number of players per team should use only digits, for example '11' not 'eleven'"));
     $this->AddValidator(new RequiredFieldValidator('overs', 'Please specify the number of overs played'));
     $this->AddValidator(new NumericValidator('overs', "The number of overs played should use only digits, for example '10' not 'ten'"));
     $this->AddValidator(new NumericValidator($this->GetNamingPrefix() . 'category', 'The category identifier should be a number'));
     $this->AddValidator(new LengthValidator('intro', 'Please make the introduction shorter', 0, 10000));
     $this->AddValidator(new LengthValidator('contact', 'Please make the contact details shorter', 0, 10000));
     $this->AddValidator(new EmailValidator('notification', 'Please enter a valid notification email address'));
     $this->AddValidator(new LengthValidator('website', 'Please make the website URL shorter', 0, 250));
     $this->AddValidator(new UrlValidator('website', 'Please enter a valid web address, eg http://www.mystoolballsite.com/'));
     $this->AddValidator(new ShortUrlValidator($this->GetNamingPrefix() . 'ShortUrl', 'That short URL is already in use', ValidatorMode::SingleField(), $this->GetDataObject()));
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     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/numeric-validator.class.php';
     # validate data
     $this->a_validators[] = new PlainTextValidator('paon', 'Please use only letters, numbers and simple punctuation in the building name or number');
     $this->a_validators[] = new LengthValidator('paon', 'Please make the building name or number shorter', 0, 250);
     $this->a_validators[] = new PlainTextValidator('streetDescriptor', 'Please use only letters, numbers and simple punctuation in the street name');
     $this->a_validators[] = new LengthValidator('streetDescriptor', 'Please make the street name shorter', 0, 250);
     $this->a_validators[] = new PlainTextValidator('locality', 'Please use only letters, numbers and simple punctuation in the village or part of town');
     $this->a_validators[] = new LengthValidator('locality', 'Please make the village or part of town shorter', 0, 250);
     $this->a_validators[] = new RequiredFieldValidator('town', 'Please add the town');
     $this->a_validators[] = new LengthValidator('town', 'Please make the town shorter', 0, 100);
     $this->a_validators[] = new PlainTextValidator('town', 'Please use only letters, numbers and simple punctuation in the town');
     $this->a_validators[] = new PlainTextValidator('county', 'Please use only letters, numbers and simple punctuation in the county');
     $this->a_validators[] = new LengthValidator('county', 'Please make the county shorter', 0, 100);
     $this->a_validators[] = new LengthValidator('postcode', 'Postcodes cannot be more than eight characters', 0, 8);
     # TODO: Add postcode validator
     $this->a_validators[] = new LengthValidator(array('lat', 'long'), 'Latitude and longitude must be 20 digits or fewer', 0, 20, ValidatorMode::AllFields());
     $this->a_validators[] = new NumericValidator(array('lat', 'long'), 'Latitude and longitude must be a number', ValidatorMode::AllFields());
     $this->a_validators[] = new LengthValidator(array('geoprecision'), 'Geo precision must be one character', 0, 1);
     $this->a_validators[] = new NumericValidator(array('geoprecision'), 'Geo precision must be a number');
     /*        public static final int MIN_LATITUDE  =  -90 * 1000000;
             public static final int MAX_LATITUDE  =   90 * 1000000;
             public static final int MIN_LONGITUDE = -180 * 1000000;
             public static final int MAX_LONGITUDE =  180 * 1000000;*/
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 function CreateValidators()
 {
     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->AddValidator(new RequiredFieldValidator('name', 'Please add the name of the school'));
     $this->AddValidator(new LengthValidator('name', 'Please make the school name shorter', 0, 100));
     $this->AddValidator(new LengthValidator('street', 'Please make the road name shorter', 0, 250));
     $this->AddValidator(new LengthValidator('locality', 'Please make the part of town shorter', 0, 250));
     $this->AddValidator(new RequiredFieldValidator('town', 'Please add the town or village'));
     $this->AddValidator(new LengthValidator('town', 'Please make the town or village shorter', 0, 100));
     $this->AddValidator(new LengthValidator('county', 'Please make the county shorter', 0, 100));
     $this->AddValidator(new LengthValidator('postcode', 'Postcodes cannot be more than eight characters', 0, 8));
     $this->AddValidator(new LengthValidator(array('latitude', 'longitude'), 'Latitude and longitude must be 20 digits or fewer', 0, 20, ValidatorMode::AllFields()));
     $this->AddValidator(new NumericValidator(array('latitude', 'longitude'), 'Latitude and longitude must be a number', ValidatorMode::AllFields()));
     $this->AddValidator(new LengthValidator(array('geoprecision'), 'Geo precision must be one character', 0, 1));
     $this->AddValidator(new NumericValidator(array('geoprecision'), 'Geo precision must be a number'));
 }
 /**
  * @return CompareValidator
  * @param array $a_keys
  * @param string $s_message
  * @desc Test whether given fields are the same
  */
 function CompareValidator($a_keys, $s_message)
 {
     parent::DataValidator($a_keys, $s_message, ValidatorMode::MultiField());
 }
 /**
  * @return RequiresOtherFieldsValidator
  * @param array Validated field followed by other required fields $a_keys
  * @param string $s_message
  * @param array(array()) Acceptable values in required fields $requires_values
  * @desc If the first given field has data, require the subsequent fields
  */
 public function __construct($a_keys, $s_message, $requires_values = null)
 {
     parent::DataValidator($a_keys, $s_message, ValidatorMode::MultiField());
     $this->requires_values = is_array($requires_values) ? $requires_values : array();
 }
 /**
  * @return void
  * @desc Create DataValidator objects to validate the edit control
  */
 public function CreateValidators()
 {
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/numeric-validator.class.php';
     require_once 'data/validation/length-validator.class.php';
     $this->a_validators = array();
     $this->a_validators[] = new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Start_day', $this->GetNamingPrefix() . 'Start_month', $this->GetNamingPrefix() . 'Start_year'), 'Please select a date for the match', ValidatorMode::AllFields());
     $this->a_validators[] = new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Start_hour', $this->GetNamingPrefix() . 'Start_minute', $this->GetNamingPrefix() . 'Start_ampm'), 'If you know the match time select the hour, minute and am or pm. If not, leave all three blank.', ValidatorMode::AllOrNothing());
     if (!$this->b_user_is_admin) {
         $this->a_validators[] = new RequiredFieldValidator($this->GetNamingPrefix() . 'Home', 'Please select a home team');
     }
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Home', 'The home team should be a number');
     if (!$this->b_user_is_admin) {
         $this->a_validators[] = new RequiredFieldValidator($this->GetNamingPrefix() . 'Away', 'Please select an away team');
     }
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Away', 'The away team should be a number');
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Ground', 'The ground should be a number');
     $this->a_validators[] = new LengthValidator($this->GetNamingPrefix() . 'Notes', 'Your match notes should not be more than 5000 characters long', 0, 5000);
 }
 /**
  * Create validators to check a single points adjustment
  *
  * @param string $s_item_suffix
  */
 protected function CreateValidatorsForItem($s_item_suffix = '')
 {
     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/numeric-validator.class.php';
     require_once 'data/validation/numeric-range-validator.class.php';
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Points' . $s_item_suffix, 'The points adjustment must be a number. For example, \'2\', not \'two\'');
     $this->a_validators[] = new NumericRangeValidator($this->GetNamingPrefix() . 'Points' . $s_item_suffix, 'The points awarded or deducted must be one or more', 1, null);
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Awarded' . $s_item_suffix, 'The points adjustment must be awarded or deducted');
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'PointsTeam' . $s_item_suffix, 'The team identifier for the points adjustment should be a number');
     $this->a_validators[] = new PlainTextValidator($this->GetNamingPrefix() . 'Reason' . $s_item_suffix, 'Please use only letters, numbers and simple punctuation in the reason for the points adjustment');
     $this->a_validators[] = new LengthValidator($this->GetNamingPrefix() . 'Reason' . $s_item_suffix, 'The reason for the points adjustment should be 200 characters or fewer', 0, 200);
     $this->a_validators[] = new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Points' . $s_item_suffix, $this->GetNamingPrefix() . 'PointsTeam' . $s_item_suffix, $this->GetNamingPrefix() . 'Reason' . $s_item_suffix), 'Please complete all fields to add a points adjustment', ValidatorMode::AllOrNothing());
 }
 /**
  * @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()
 {
     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';
     require_once 'data/validation/url-validator.class.php';
     require_once 'http/short-url-validator.class.php';
     require_once "stoolball/team-name-validator.class.php";
     $this->AddValidator(new NumericValidator('club', 'The club identifier should be a number'));
     $this->AddValidator(new RequiredFieldValidator('name', 'Please add the name of the team'));
     $this->AddValidator(new LengthValidator('name', 'Please make the team name shorter', 0, 100));
     if ($this->is_admin) {
         $this->AddValidator(new TeamNameValidator(array("item", "name", "playerType"), "There is already a team with a very similar name. Please change the name."));
     }
     $this->AddValidator(new RequiredFieldValidator('playerType', 'Please specify the type of player allowed in the competiton'));
     $this->AddValidator(new NumericValidator('playerType', 'The player type identifier should be a number'));
     $this->AddValidator(new LengthValidator('intro', 'Please make the introduction shorter', 0, 10000));
     $this->AddValidator(new LengthValidator('times', 'Please make the playing times shorter', 0, 5000));
     $this->AddValidator(new RequiredFieldValidator('ground', "Please select the team's home ground"));
     $this->AddValidator(new NumericValidator('ground', 'The ground identifier should be a number'));
     $this->AddValidator(new UrlValidator('websiteUrl', 'Please enter a valid web address, eg http://www.mystoolballsite.com/'));
     $this->AddValidator(new LengthValidator('contact', 'Please make the contact details shorter', 0, 10000));
     $this->AddValidator(new LengthValidator('private', 'Please make the Stoolball England contact details shorter', 0, 10000));
     $this->AddValidator(new ShortUrlValidator($this->GetNamingPrefix() . 'ShortUrl', 'That short URL is already in use', ValidatorMode::SingleField(), $this->GetDataObject()));
 }
 /**
  * Create validators to check a single team registration
  *
  * @param string $s_item_suffix
  */
 protected function CreateValidatorsForItem($s_item_suffix = '')
 {
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/numeric-validator.class.php';
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'Team' . $s_item_suffix, 'The team identifier should be a number');
     $this->a_validators[] = new RequiredFieldValidator(array($this->GetNamingPrefix() . 'Team' . $s_item_suffix), 'Please select a team to add', ValidatorMode::AllOrNothing());
 }
 /**
  * Create validators to check a single match
  *
  * @param string $s_item_suffix
  */
 protected function CreateValidatorsForItem($s_item_suffix = '')
 {
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/numeric-validator.class.php';
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'MatchId' . $s_item_suffix, 'The match identifier should be a number');
     $this->a_validators[] = new NumericValidator($this->GetNamingPrefix() . 'MatchOrder' . $s_item_suffix, 'The match order should be a number');
     $this->a_validators[] = new RequiredFieldValidator(array($this->GetNamingPrefix() . 'HomeTeamId' . $s_item_suffix, $this->GetNamingPrefix() . 'AwayTeamId' . $s_item_suffix), 'Please select two teams to add a match', ValidatorMode::AllOrNothing());
 }