コード例 #1
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, '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);
 }
コード例 #2
0
ファイル: Text.php プロジェクト: alefernie/intranet
 /**
  * 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);
 }
コード例 #3
0
ファイル: DateTime.php プロジェクト: RobJTingay/humhub
 /**
  * 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);
 }
コード例 #4
0
ファイル: TextArea.php プロジェクト: SimonBaeumer/humhub
 /**
  * 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);
 }
コード例 #5
0
ファイル: DateTime.php プロジェクト: tonylow/skillslink
 /**
  * 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);
 }
コード例 #6
0
ファイル: Select.php プロジェクト: alefernie/intranet
 /**
  * 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);
 }
コード例 #7
0
 /**
  * @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);
 }
コード例 #8
0
ファイル: DateTime.php プロジェクト: ouyangwenfeng/humhub
 /**
  * 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);
 }