当前位置: 首页>>代码示例>>PHP>>正文


PHP CFormModel::beforeValidate方法代码示例

本文整理汇总了PHP中CFormModel::beforeValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::beforeValidate方法的具体用法?PHP CFormModel::beforeValidate怎么用?PHP CFormModel::beforeValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFormModel的用法示例。


在下文中一共展示了CFormModel::beforeValidate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $cams = array_map('trim', explode(',', $this->hcams));
         $c = count($cams);
         foreach ($cams as $cam) {
             $this->camBuff[] = Cams::model()->findByPK(Cams::model()->getRealId($cam));
         }
         $this->camBuff = array_filter($this->camBuff);
         if (empty($this->camBuff) || count($this->camBuff) != $c) {
             $this->addError('cams', $c > 1 ? Yii::t('errors', 'One of cam is wrong') : Yii::t('errors', 'There is no such cam'));
             return false;
         }
         if (!is_array($this->emails)) {
             $emails = array_map('trim', explode(',', $this->emails));
         } else {
             $emails = array_map('trim', $this->emails);
         }
         $c = count($emails);
         $this->emailBuff = Users::model()->findAllByAttributes(array('email' => $emails));
         if (empty($this->emailBuff) || count($this->emailBuff) != $c) {
             $this->addError('emails', $c > 1 ? Yii::t('errors', 'One of user is wrong') : Yii::t('errors', 'There is no such user'));
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:28,代码来源:ShareForm.php

示例2: beforeValidate

 public function beforeValidate()
 {
     $this->db = Yii::app()->db;
     // Категория
     $category_id = $this->db->createCommand('
         SELECT id
         FROM yupe_store_category
         WHERE id_1c = ' . $this->category_id)->queryRow();
     if (empty($category_id)) {
         // категории нет в базе
         $this->category_id = '449';
     } else {
         // категория присутствует в базе, возвращаем ее идентификатор
         $this->category_id = $category_id['id'];
     }
     // Товар
     $product = $this->db->createCommand()->select('id, alias')->from('{{store_product}}')->where('id_1c=:id', [':id' => $this->id_1c])->queryRow();
     if (empty($product)) {
         // товар в базе не существует
         # code...
     } else {
         // товар существует
         $this->id = $product['id'];
         $this->alias = $product['alias'];
     }
     // Даты
     $this->create_time = date('Y-m-d h:m:s', time());
     $this->update_time = date('Y-m-d h:m:s', time());
     return parent::beforeValidate();
 }
开发者ID:QSODevelopers,项目名称:yupe-storeswap,代码行数:30,代码来源:DProduct.php

示例3: beforeValidate

 protected function beforeValidate()
 {
     $this->message = strip_tags($this->message);
     $this->name = strip_tags($this->name);
     $this->telephone = strip_tags($this->telephone);
     return parent::beforeValidate();
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:7,代码来源:PublicCareerForm.php

示例4: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         return true;
     }
     return false;
 }
开发者ID:jayrulez,项目名称:kcconline,代码行数:7,代码来源:AddCategoryForm.php

示例5: beforeValidate

 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->username = strtolower($this->username);
         return true;
     }
     return false;
 }
开发者ID:jayrulez,项目名称:yiisns,代码行数:8,代码来源:LoginForm.php

示例6: beforeValidate

 public function beforeValidate()
 {
     if (empty($this->gender)) {
         $this->gender = self::GENDER_FEMALE;
     }
     $this->notime = !(isset($this->hour) && isset($this->minute) && $this->hour >= 0 && $this->hour <= 23 && $this->minute >= 0 && $this->minute <= 59);
     return parent::beforeValidate();
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:8,代码来源:RegistrationForm.php

示例7: beforeValidate

 /**
  * Метод выполняется перед валидацией
  *
  * @return bool
  */
 public function beforeValidate()
 {
     $module = Yii::app()->getModule('user');
     if ($module->generateNickName) {
         $this->nick_name = 'user' . time();
     }
     return parent::beforeValidate();
 }
开发者ID:alextravin,项目名称:yupe,代码行数:13,代码来源:RegistrationForm.php

示例8: beforeValidate

 protected function beforeValidate()
 {
     $this->show = (int) $this->show;
     foreach (array("show_user", "to", "tt") as $k) {
         $this->{$k} = trim($this->{$k});
     }
     $this->to_esc = preg_quote($this->to);
     $this->tt_esc = preg_quote($this->tt);
     return parent::beforeValidate();
 }
开发者ID:norayr,项目名称:notabenoid,代码行数:10,代码来源:TrFilter.php

示例9: beforeValidate

 /**
 * Change our filename to match our own naming convention
 * @return bool
 */
 public function beforeValidate()
 {
     //(optional) Generate a random name for our file to work on preventing
     // malicious users from determining / deleting other users' files
     if ($this->secureFileNames) {
         $this->filename = sha1(Yii::app()->user->id . microtime() . $this->name);
         $this->filename .= "." . $this->file->getExtensionName();
     }
     return parent::beforeValidate();
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:14,代码来源:XUploadForm.php

示例10: beforeValidate

 /**
  * @return bool
  */
 public function beforeValidate()
 {
     /** @var AccountModule $account */
     $account = Yii::app()->getModule('account');
     if ($account->reCaptcha) {
         Yii::import('account.components.AccountReCaptchaValidator');
         $validator = new AccountReCaptchaValidator();
         $validator->attributes = array('captcha');
         $validator->validate($this);
         if ($this->hasErrors('captcha')) {
             return false;
         }
     }
     return parent::beforeValidate();
 }
开发者ID:cornernote,项目名称:yii-account-module,代码行数:18,代码来源:AccountLostPassword.php

示例11: beforeValidate

 public function beforeValidate()
 {
     parent::beforeValidate();
     return true;
 }
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:5,代码来源:GibddRuForm.php

示例12: beforeValidate

 public function beforeValidate()
 {
     parent::beforeValidate();
     $this->todayCount = $this->todaySended;
     if (Yii::app()->user->email) {
         $this->email = Yii::app()->user->email;
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:9,代码来源:DorogiMosForm.php

示例13: beforeValidate

 public function beforeValidate()
 {
     $this->validateSubForm();
     return parent::beforeValidate();
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:5,代码来源:Form.php

示例14: beforeValidate

 protected function beforeValidate()
 {
     $this->value = trim($this->value);
     $exists = false;
     foreach ($this->getVisibleSearchParameters() as $searchParam) {
         if ($searchParam->parameter->getIdParameter() == $this->parameter) {
             $exists = true;
             break;
         }
     }
     if (!$exists) {
         return false;
     }
     if ($objParameter = $this->getSearchObjectParamter()) {
         if ($objParameter->getType() == DataType::TIMESTAMP && !$this->parseTimestamp()) {
             return false;
         }
     }
     return parent::beforeValidate();
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:20,代码来源:ParameterSearchForm.php

示例15: beforeValidate

 /**
  * Loads the user model
  * @return boolean whether validation should continue
  */
 protected function beforeValidate()
 {
     $this->_user = User::model()->findCurrent();
     return parent::beforeValidate();
 }
开发者ID:pweisenburger,项目名称:xbmc-video-server,代码行数:9,代码来源:ChangePasswordForm.php


注:本文中的CFormModel::beforeValidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。