/**
  * check if field value is numeric and greater than the given value or expression
  * @example $rule = new NetefxValidatorRuleGREATER('FieldName', 'Insert a number greater than 10', null, 10); 
  * @example $rule = new NetefxValidatorRuleGREATER('FieldName', 'Insert a number greater than 10 and use "," as decimal seperator', null, array(10, ','));
  * @example $rule = new NetefxValidatorRuleGREATER('C', 'C > must be greater than "2 * FieldA + FieldB"', null, '2*@A~+@B~'); 
  * @todo the first couple of lines are the same for all greater and smaller validations, they should be moved to a seperated function
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param int|string|array $args number, expression or array (if array, the 2nd value in the array can set what character is used as decimal point)
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $args = null)
 {
     if ($errorMsg === null) {
         $errorMsg = sprintf(_t('NetefxValidatorRuleGREATER.ErrorMessage', '%s needs to be greater than %s'), $field, $this->args[0]);
     }
     parent::__construct($field, $errorMsg, $errorMsgType, $args);
 }
 /**
  * Check if field value is numeric and smaller or equal to the given value or expression
  * @example see NetefxValidator::validateGREATER() for examples
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param int|string|array $args number, expression or array (if array, the 2nd value in the array can set what character is used as decimal point)
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $args = null)
 {
     if ($errorMsg === null) {
         $errorMsg = sprintf(_t('NetefxValidatorRuleSMALLEREQUAL.ErrorMessage', '%s needs to be smaller or equal to %s'), $field, $this->args[0]);
     }
     parent::__construct($field, $errorMsg, $errorMsgType, $args);
 }
 /**
  * Empty Check on given field, returned true if the field is empty
  * @example $rule = new NetefxValidatorRuleEMPTY("SomeField", "this field should be empty");
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error')
 {
     if ($errorMsg === null) {
         $errorMsg = sprintf(_t('NetefxValidatorRuleEMPTY.ErrorMessage', '%s needs to be empty'), $field);
     }
     parent::__construct($field, $errorMsg, $errorMsgType, array());
 }
 /**
  * Check if the given field is filled out
  * @example $rule = new NetefxValidatorRuleREQUIRED("FirstName", "FirstName is required", null);
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error')
 {
     if ($errorMsg === null) {
         $errorMsg = sprintf(_t('NetefxValidatorRuleREQUIRED.ErrorMessage', '%s is required'), $field);
     }
     parent::__construct($field, $errorMsg, $errorMsgType, array());
 }
 /**
  * Check if all of the subrules are valid
  * @example $rule = new NetefxValidatorRuleAND('FieldName', 'This field must contain at least 3 characters and contain the word "Netefx"', null, array($rule1, $rule2));
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param NetefxValidatorRule|array $rules single rule or array of rules
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $rules = null)
 {
     parent::__construct($field, $errorMsg, $errorMsgType, $rules);
     if ($this->getErrorMessage() === null) {
         $messages = array();
         foreach ($this->getArgs() as $rule) {
             $messages[] = $rule->getErrorMessage();
         }
         if (count($messages)) {
             $this->setErrorMessage(implode(_t('NetefxValidatorRuleAND.and', ' and '), $messages));
         }
     }
 }
 /**
  * Check if given field exists on the form
  * @example $ruleEXISTS = new NetefxValidatorRuleEXISTS('email'); <br> $ruleREQUIRED = new NetefxValidatorRuleREQUIRED ('email'); <br> $rule = new NetefxValidatorRuleIMPLIES ("email", "This field is required", "error", array($ruleEXISTS, $ruleREQUIRED));
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error')
 {
     parent::__construct($field, $errorMsg, $errorMsgType, array());
 }
 /**
  * Check if the given expression matches
  * @example $rule = new NetefxValidatorRuleREGEXP('Name', 'This field is required', null, '/^.{2,}$/');
  * @uses preg_match()
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param string $expression
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $expression = null)
 {
     parent::__construct($field, $errorMsg, $errorMsgType, $expression);
 }
 /**
  * Check if field value is numeric and equal to the given value or expression
  * @example see NetefxValidator::validateGREATER() for examples
  * @see NetefxValidatorRule::validateTEXTIS() for text equals validation
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param int|string|array $args number, expression or array (if array, the 2nd value in the array can set what character is used as decimal point)
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $args = null)
 {
     parent::__construct($field, $errorMsg, $errorMsgType, $args);
 }
 /**
  * Check if 2 fields are equal
  * @example $rule = new NetefxValidatorRuleTEXTEQUALS('Password2', 'Password', 'Password und Password2 need to match');
  * @see NetefxValidatorRuleTEXTIS to check if the field is equal to a string
  * @param string $field name of the field
  * @param string $errorMsg the message to be displayed
  * @param string $errorMsgType the css class added to the field on validation error
  * @param string $otherField
  */
 public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $otherField = null)
 {
     parent::__construct($field, $errorMsg, $errorMsgType, $otherField);
 }