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


PHP CActiveForm::validate方法代码示例

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


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

示例1: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (User::model()->findAll() == null) {
         $this->redirect(Yii::app()->createAbsoluteUrl('install/user'));
         Yii::app()->end();
     }
     $model = new FormLogin();
     $this->layout = '//layouts/clean';
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['FormLogin'])) {
         $model->attributes = $_POST['FormLogin'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     if (isset($_POST['login_id'])) {
         $model->id = $_POST['login_id'];
         $model->hash = $_POST['login_hash'];
         //$model->login_company = $_POST['login_company'];
         // validate user input and redirect to the previous page if valid
         if ($model->apiLogin()) {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:36,代码来源:SiteController.php

示例2: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             /*ELECCION DE LOCAL*/
             $session = Yii::app()->getSession();
             $tipo_user = $session['_tipo'];
             $local_user = $session['_local'];
             if ($tipo_user == 'EMPLEADO' and !$local_user) {
                 $this->redirect(array('user/elegir'));
             }
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     // display the login form
     $this->render('ingreso', array('model' => $model));
 }
开发者ID:rapbore,项目名称:rch2,代码行数:29,代码来源:SiteController.php

示例3: showGeneralForm

 protected function showGeneralForm()
 {
     $model = new SettingGeneralForm();
     settings()->deleteCache();
     //Set Value for the Settings
     $model->site_name = Yii::app()->settings->get('general', 'site_name');
     $model->site_title = Yii::app()->settings->get('general', 'site_title');
     $model->site_description = Yii::app()->settings->get('general', 'site_description');
     $model->slogan = Yii::app()->settings->get('general', 'slogan');
     $model->homepage = Yii::app()->settings->get('general', 'homepage');
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'settings-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['SettingGeneralForm'])) {
         $model->attributes = $_POST['SettingGeneralForm'];
         if ($model->validate()) {
             settings()->deleteCache();
             foreach ($model->attributes as $key => $value) {
                 Yii::app()->settings->set('general', $key, $value);
             }
             user()->setFlash('success', t('General Settings Updated Successfully!'));
         }
     }
     $this->render('cmswidgets.views.settings.settings_general_widget', array('model' => $model));
 }
开发者ID:nganhtuan63,项目名称:gxc-cms,代码行数:28,代码来源:SettingsWidget.php

示例4: performAjaxValidation

 /**
  * Performs the AJAX validation.
  * 
  * @param CModel the model to be validated
  *
  * @return void
  */
 protected function performAjaxValidation(News $model)
 {
     if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'news-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:porem,项目名称:yupe-ext,代码行数:14,代码来源:MetrikaBackendController.php

示例5: performAjaxValidation

 protected function performAjaxValidation($model)
 {
     if (isset($_POST['ajax'])) {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:fobihz,项目名称:cndiesel,代码行数:7,代码来源:DefaultController.php

示例6: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     $model = new LoginForm();
     $usuario = "";
     $contrasenia = "";
     $error = "";
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         //Almacenar datos para ver que esta enviando
         $usuario = $model->username;
         $contrasenia = $model->password;
         //$error=$model->login();
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     // display the login form
     $this->render('login', array('model' => $model, 'usuario' => $usuario, 'error' => $error));
 }
开发者ID:Edilber,项目名称:ManagerPathFinderSystem,代码行数:29,代码来源:SiteController.php

示例7: performAjaxValidation

 /**
  * Performs the AJAX validation.
  * @param CModel the model to be validated
  */
 public function performAjaxValidation($model)
 {
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'artist-area-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:robebeye,项目名称:MusicDream,代码行数:11,代码来源:ArtistAreaController.php

示例8: performAjaxValidation

 /**
  * Performs the AJAX validation.
  * @param CModel the model to be validated
  */
 protected function performAjaxValidation($model)
 {
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'finance-fee-particulars-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:11,代码来源:FinanceFeeParticularsController.php

示例9: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (!Helper::BrowserIsChrome()) {
         $this->renderPartial('download');
         Yii::app()->end();
     }
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             if (Yii::app()->user->checkAccess("playtocrmdash") && !Yii::app()->user->checkAccess("cgtz_adminstrator")) {
                 $this->redirect($this->createUrl("/crm/dashboard"));
             } else {
                 $this->redirect($this->createUrl("/site/index"));
             }
         }
     }
     // display the login form
     $this->renderPartial('login', array('model' => $model));
 }
开发者ID:kl0428,项目名称:admin,代码行数:30,代码来源:SiteController.php

示例10: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     $model = new LoginForm();
     // var_dump($_POST);
     // die;
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         // var_dump($_POST);
         // die;
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             // Yii::app()->user->returnUrl = Yii::app()->request->urlReferrer;
             // echo Yii::app()->request->urlReferrer;
             // die;
             // $this->redirect(Yii::app()->user->returnUrl);
             $record = Users::model()->findByAttributes(array('username' => $_POST['LoginForm']['username']));
             // echo "ssss";
             // var_dump($record);
             // die;
             Yii::app()->session['uid'] = $record['id'];
             Yii::app()->session['username'] = $record['username'];
             $this->redirect('/index.php?r=posts/index');
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
开发者ID:RuiWangGit,项目名称:Blog,代码行数:36,代码来源:SiteController.php

示例11: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     $this->layout = '//layouts/login';
     if (@Yii::app()->user->id) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $model = new LoginFormAdmin();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginFormAdmin'])) {
         $model->attributes = $_POST['LoginFormAdmin'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $audit = new AuditTrail();
             $audit->user_id = Yii::app()->user->id;
             $audit->login_time = new CDbExpression('NOW()');
             $audit->user_type = 1;
             $audit->save();
             Yii::app()->user->setFlash('success', 'Welcome in the <strong>' . CHtml::encode(Yii::app()->name) . ' Admin Panel</strong>. Don\'t forget to <strong>Logout</strong> when finish!');
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:32,代码来源:SiteController.php

示例12: performAjaxValidation

 public function performAjaxValidation(Package $model)
 {
     if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'package-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:7,代码来源:PackageBackendController.php

示例13: performAjaxValidation

 protected function performAjaxValidation($model, $id = 'comments-form')
 {
     if (isset($_POST['ajax']) && $_POST['ajax'] === $id) {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
 }
开发者ID:urichalex,项目名称:CS-Bans,代码行数:7,代码来源:CommentsController.php

示例14: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (!defined('CRYPT_BLOWFISH') || !CRYPT_BLOWFISH) {
         throw new CHttpException(500, "This application requires that PHP was compiled with Blowfish support for crypt().");
     }
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             switch (Yii::app()->user->model->papel) {
                 case 'T':
                     $this->redirect(array('aeroporto/admin'));
                     break;
                 case 'E':
                     $this->redirect(array('aviao/admin'));
                     break;
                 case 'P':
                     $this->redirect(array('voo/voosPiloto'));
                     break;
                 default:
                     $this->redirect(Yii::app()->user->returnUrl);
                     break;
             }
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
开发者ID:hccresende,项目名称:FlyManager,代码行数:38,代码来源:SiteController.php

示例15: actionSconfig

 public function actionSconfig()
 {
     if (Yii::app()->request->isPostRequest) {
         $_model = new Sconfig();
         $_model->attributes = $_POST['Sconfig'];
         $model = Sconfig::model()->find();
         if (strlen(CActiveForm::validate($_model)) == 2) {
             if (!$model) {
                 $model = new Sconfig();
                 $model->attributes = $_POST['Sconfig'];
                 $model->save();
             } else {
                 Sconfig::model()->updateAll($_POST['Sconfig']);
             }
             $str = 'Data saved suc On ' . date("Y-m-d H:i:s");
             Yii::app()->user->setFlash('success', $str);
             $sconfig = Sconfig::model()->find();
         } else {
             $sconfig = $_model;
             $str = 'Data saved fail! On ' . date("Y-m-d H:i:s");
             Yii::app()->user->setFlash('fail', $str);
         }
     } else {
         $sconfig = Sconfig::model()->find();
         if (!$sconfig) {
             $sconfig = new Sconfig();
         }
     }
     $this->render('_sconfig', array('sconfig' => $sconfig));
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:30,代码来源:SettingController.php


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