afterValidate() public method

The default implementation raises an afterValidate event. You may override this method to do postprocessing after validation. Make sure the parent implementation is invoked so that the event can be raised.
public afterValidate ( )
Example #1
0
 /**
  * @inheritdoc
  */
 public function afterValidate()
 {
     if (!$this->dashboardPanel->validate()) {
         $this->addError(null);
     }
     parent::afterValidate();
 }
    /**
     * trigger Event Assigned on Events::CREATE_Company
     * Events Defined In auction/components/Events
     */
    public function afterValidate(){
        $this->trigger(Events::REGISTRATION);
        $message = Auction::loggerMessageFormat('Company is Successfully Validated',$this->attributes);

        Auction::info($message);
        return parent::afterValidate();
    }
Example #3
0
 public function afterValidate()
 {
     parent::afterValidate();
     $this->url = str_replace(' ', '%20', $this->url);
     if ($this->_hasParams()) {
         $this->_combineParams();
     }
 }
Example #4
0
 public function afterValidate()
 {
     if (!$this->hasErrors) {
         foreach ($this->getAttributes() as $attr => $file) {
             if ($file && !$file->hasError) {
                 $this->{$attr} = '@' . $file->tempName;
             } else {
                 unset($this->{$attr});
             }
         }
     }
     return parent::afterValidate();
 }
Example #5
0
 public function afterValidate()
 {
     $dateObj = \yii::$app->DateComponent;
     if ($this->all_day_option_id == Types::$boolean['true']['id']) {
         $this->jsObject['allDay'] = true;
     } else {
         $this->jsObject['allDay'] = false;
     }
     $this->jsObject['start'] = $dateObj->timeStampToIsoDateTime($this->start_timestamp);
     $this->jsObject['end'] = $dateObj->timeStampToIsoDateTime($this->end_timestamp);
     $this->jsObject['className'] = sprintf('calendar-%s', $this->calendar_id);
     $this->jsObject['title'] = $this->title;
     $this->jsObject['description'] = $this->description;
     $this->jsObject['project_id'] = $this->project_id;
     $this->jsObject['calendar_id'] = $this->calendar_id;
     $this->jsObject['project_collection_title'] = '';
     $this->jsObject['editable'] = true;
     return parent::afterValidate();
 }
Example #6
0
 /**
  * Nach dem Validieren wandeln wir die Ip Adressen in einen String um
  * 
  * @author KAS <*****@*****.**> 28.07.2015
  */
 public function afterValidate()
 {
     if ($this->allowFrom !== "") {
         $res = preg_split("/\\./", $this->allowFrom);
         $this->allowFrom = sprintf("%03d", $res[0]) . "." . sprintf("%03d", $res[1]) . "." . sprintf("%03d", $res[2]) . "." . sprintf("%03d", $res[3]);
     } else {
         $this->allowFrom = NULL;
     }
     //----------------------------------------------------------------------
     $res = NULL;
     // ---------------------------------------------------------------------
     if ($this->allowTo !== "") {
         $res = preg_split("/\\./", $this->allowTo);
         $this->allowTo = sprintf("%03d", $res[0]) . "." . sprintf("%03d", $res[1]) . "." . sprintf("%03d", $res[2]) . "." . sprintf("%03d", $res[3]);
     } else {
         $this->allowTo = NULL;
     }
     //----------------------------------------------------------------------
     parent::afterValidate();
 }
Example #7
0
 /**
  * Validation
  */
 public function afterValidate()
 {
     $user = null;
     // Loop over enabled authclients
     foreach (Yii::$app->authClientCollection->getClients() as $authClient) {
         if ($authClient instanceof BaseFormAuth) {
             $authClient->login = $this;
             if ($authClient->auth()) {
                 $this->authClient = $authClient;
                 // Delete password after successful auth
                 $this->password = "";
                 return;
             }
         }
     }
     if ($user === null) {
         $this->addError('password', 'User or Password incorrect.');
     }
     // Delete current password value
     $this->password = "";
     parent::afterValidate();
 }
Example #8
0
 /**
  * (non-PHPdoc)
  * @see \yii\base\Model::afterValidate()
  */
 public function afterValidate()
 {
     parent::afterValidate();
     $this->password = call_user_func($this->hashCallable, $this->password);
 }
Example #9
0
 public function afterValidate()
 {
     if (!$this->hasErrors()) {
         $this->ipv4 = $this->ip;
         $this->ipv4port = $this->port;
         $ip = null;
         //尝试直接获取ip, 优先采用直接获得的ip
         if (isset($_SERVER['x-forwarded-for'])) {
             $ip = $_SERVER['x-forwarded-for'];
         } elseif (isset($_SERVER['x-forwarded-for'])) {
             $ip = $_SERVER['x-real-ip'];
         } else {
             $ip = Yii::$app->request->userIP;
         }
         if (!empty($ip)) {
             if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                 $this->ipv4 = $ip;
             } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                 $this->ipv6 = $ip;
             }
         }
         //保证如果为空就设置为null
         if (empty($this->ipv4) || empty($this->ipv4port)) {
             $this->ipv4 = null;
             $this->ipv4port = null;
         }
         if (empty($this->ipv6) || empty($this->ipv6port)) {
             $this->ipv6 = null;
             $this->ipv6port = null;
         }
         if (empty($this->ipv4) && empty($this->ipv6)) {
             $this->addError('ip', "no ip address");
         }
         $this->base64_peer_id = base64_encode($this->peer_id);
     }
     parent::afterValidate();
     // TODO: Change the autogenerated stub
 }
 /**
  * Init variables
  * @throws \yii\web\HttpException
  * @throws \yii\web\NotFoundHttpException
  */
 public function afterValidate()
 {
     parent::afterValidate();
     $this->_pathRootObject = $this->basePath . DIRECTORY_SEPARATOR . $this->folder;
     $this->_urlRootObject = $this->baseUrl . DIRECTORY_SEPARATOR . $this->folder;
     if (!is_dir($this->_pathRootObject)) {
         HttpError::the404();
     }
     $this->_pathObject = $this->_pathRootObject . DIRECTORY_SEPARATOR . $this->id;
     $this->_urlObject = $this->_urlRootObject . DIRECTORY_SEPARATOR . $this->id;
     if (!is_dir($this->_pathObject) && !FileHelper::createDirectory($this->_pathObject)) {
         HttpError::the500('Can not create directory: ' . $this->_pathObject);
     }
     $this->_pathObjectFile = $this->_pathObject . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->name;
     $this->_urlObjectFile = $this->_urlObject . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->name;
     $this->_pathObjectFileOrigin = $this->_pathObject . DIRECTORY_SEPARATOR . $this->name;
     $this->_pathObjectPlaceholder = $this->_pathRootObject . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->placeholder;
     $this->_urlObjectPlaceholder = $this->_urlRootObject . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->placeholder;
     $this->_pathObjectPlaceholderOrigin = $this->_pathRootObject . DIRECTORY_SEPARATOR . $this->placeholder;
     $this->_pathRootPlaceholder = $this->basePath . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->placeholder;
     $this->_urlRootPlaceholder = $this->baseUrl . DIRECTORY_SEPARATOR . $this->width . 'x' . $this->height . '_' . $this->placeholder;
     $this->_pathRootPlaceholderOrigin = $this->basePath . DIRECTORY_SEPARATOR . $this->placeholder;
 }
 public function afterValidate()
 {
     parent::afterValidate();
     $this->setDsn();
 }
Example #12
0
 public function afterValidate()
 {
     parent::afterValidate();
 }
Example #13
0
 /**
  * @inheritdoc
  */
 public function afterValidate()
 {
     parent::afterValidate();
     $this->validateOffers();
 }
Example #14
0
 public function afterValidate()
 {
     parent::afterValidate();
     // TODO: Change the autogenerated stub
     $this->signForm();
 }
Example #15
-1
 public function afterValidate()
 {
     parent::afterValidate();
     $fn = DynBlockHelper::configFile($this->blockId);
     if (file_exists($fn)) {
         $this->addError('blockId', 'Такой идентификатор уже используется');
     }
 }