Пример #1
0
 public function validate($attributes = null, $clearErrors = true)
 {
     $valid = parent::validate($attributes, $clearErrors);
     if (!$valid && $this->throwExceptions) {
         throw new $exceptionClass(400, CJSON::encode($this->getErrors()));
     }
     return $valid;
 }
Пример #2
0
 public function validate()
 {
     if (!$this->result->getStatus()) {
         $this->addErrors(array('social_response_error' => $this->result->getResult()));
         return false;
     }
     return parent::validate();
 }
Пример #3
0
 public function validate()
 {
     $year = Yii::app()->dateFormatter->format("yyyy", $ths->date);
     if (!($year >= 1900 && $year <= 2050)) {
         $this->addError('date', 'Данный год не поддерживается системой');
     }
     return parent::validate();
 }
Пример #4
0
 public function validate($attributes = NULL, $clearErrors = true)
 {
     $valid = parent::validate();
     if ($this->hasErrors()) {
         return false;
     }
     return true;
 }
Пример #5
0
 public function validatewithId($form, $attributes = null, $clearErrors = true)
 {
     parent::validate($attributes, $clearErrors);
     foreach ($form->questions_group as $group) {
         if ($group->id == $this->id) {
             $this->addError('id', Yii::t('common', 'loginExist'));
         }
     }
     return !$this->hasErrors();
 }
Пример #6
0
 public function create()
 {
     if (false !== parent::validate()) {
         $this->name = trim($this->name);
         if (null === Yii::app()->authManager->getAuthItem($this->name)) {
             Yii::app()->authManager->createAccessLevel($this->name, $this->description);
             return true;
         } else {
             $this->addError('name', 'Group "' . $this->name . '" already exists');
             return false;
         }
     }
     return false;
 }
Пример #7
0
 /**
  * @param array $attributes
  * @param bool  $clearErrors
  *
  * @throws DreamFactory\Platform\Exceptions\ForbiddenException
  * @return bool
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     if ($this->_skipped) {
         $this->_emailAddress = null;
         return true;
     }
     /** @var User $_user */
     if (null === ($_user = User::model()->findByPk(Session::getCurrentUserId()))) {
         throw new ForbiddenException();
     }
     if (empty($this->_emailAddress)) {
         $this->_emailAddress = $_user->email;
     }
     return parent::validate($attributes, $clearErrors);
 }
Пример #8
0
 public function validate($attributes = NULL, $clearErrors = true)
 {
     $valid = parent::validate();
     if (empty($this->email)) {
         $this->addError('email', 'Email не может быть пустым.');
         return false;
     }
     if (!User::model()->find('email LIKE "' . $this->email . '"')) {
         $this->addError('email', 'Пользователь с таким email не найден.');
         return false;
     }
     if ($this->hasErrors()) {
         return false;
     }
     return true;
 }
Пример #9
0
 /**
  * Validates a ProfileFieldType
  *
  * This is only necessary when its linked to a profileField and the profiletype
  * has the current type of profilefieldtype
  *
  * @return boolean
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     // Bound to a profile field?
     if ($this->profileField != null) {
         // Current Profile Field matches the selected profile field
         if ($this->profileField->field_type_class == get_class($this)) {
             return parent::validate($attributes, $clearErrors);
         }
     }
     return true;
 }