/**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, 'integer');
     if ($this->maxValue) {
         $rules[] = array($this->profileField->internal_name, 'integer', 'max' => $this->maxValue);
     }
     if ($this->minValue) {
         $rules[] = array($this->profileField->internal_name, 'integer', 'min' => $this->minValue);
     }
     return parent::getFieldRules($rules);
 }
Exemplo n.º 2
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     if ($this->validator == self::VALIDATOR_EMAIL) {
         $rules[] = array($this->profileField->internal_name, 'email');
     } elseif ($this->validator == self::VALIDATOR_URL) {
         $rules[] = array($this->profileField->internal_name, 'url');
     }
     if ($this->maxLength == "" || $this->maxLength > 255) {
         $rules[] = array($this->profileField->internal_name, 'string', 'max' => 255);
     } else {
         $rules[] = array($this->profileField->internal_name, 'string', 'max' => $this->maxLength);
     }
     if ($this->minLength != "") {
         $rules[] = array($this->profileField->internal_name, 'string', 'min' => $this->minLength);
     }
     if ($this->regexp != "") {
         $errorMsg = $this->regexpErrorMessage;
         if ($errorMsg == "") {
             $errorMsg = "Invalid!";
         }
         $rules[] = array($this->profileField->internal_name, 'match', 'pattern' => $this->regexp, 'message' => $errorMsg);
     }
     return parent::getFieldRules($rules);
 }
Exemplo n.º 3
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, DbDateValidator::className(), 'format' => Yii::$app->params['formatter']['defaultDateFormat']);
     return parent::getFieldRules($rules);
 }
Exemplo n.º 4
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, 'safe');
     return parent::getFieldRules($rules);
 }
Exemplo n.º 5
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, 'date', 'timestampAttribute' => $this->profileField->internal_name);
     return parent::getFieldRules($rules);
 }
Exemplo n.º 6
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, 'in', 'range' => array_keys($this->getSelectItems()));
     return parent::getFieldRules($rules);
 }
 /**
  * @inheritdoc
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = [$this->profileField->internal_name, DbDateValidator::className(), 'format' => Yii::$app->formatter->dateInputFormat, 'convertToFormat' => 'Y-m-d'];
     return parent::getFieldRules($rules);
 }
Exemplo n.º 8
0
 /**
  * Returns the Field Rules, to validate users input
  *
  * @param type $rules
  * @return type
  */
 public function getFieldRules($rules = array())
 {
     $rules[] = array($this->profileField->internal_name, DbDateValidator::className(), 'format' => self::DATEPICKER_FORMAT);
     return parent::getFieldRules($rules);
 }