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


PHP CForm::validate方法代码示例

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


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

示例1: actionTac_vu_khach

 public function actionTac_vu_khach()
 {
     $dangtin = new LoginForm();
     $khachhang = new Khachhang();
     $form = new CForm('application.views.admin.tac_vu_khach.form_tac_vu_khach', $khachhang);
     $khachhang->setScenario('dang_tin_khach');
     if ($form->submitted('dangtinkhach') && $form->validate()) {
         $id = $khachhang->idkhach;
         $arry = explode("_", $id);
         $username = $arry[0];
         if (isset($arry[1])) {
             $id = $arry[1];
             if ($user = Khachhang::model()->TTkhach($id, $username)) {
                 $dangtin->username = $user['ten_dang_nhap'];
                 $dangtin->password = $user['password'];
                 $dangtin->_identity = new UserIdentity($dangtin->username, $dangtin->password);
                 $dangtin->_identity->authenticate();
                 $dangtin->login();
                 $this->redirect(Yii::app()->request->baseUrl . '/dang-tin');
             } else {
                 $this->__message = "Nhập sai id khách hàng!";
             }
         } else {
             $this->__message = "Nhập sai cú pháp!";
         }
     }
     $this->render('tac_vu_khach', array('form' => $form, 'message' => $this->__message));
 }
开发者ID:BanNT,项目名称:xechieuve,代码行数:28,代码来源:Tac_vu_khachController.php

示例2: actionUser

 /**
  * Displays the authorization assignments for an user.
  */
 public function actionUser()
 {
     // Create the user model and attach the required behavior
     $userClass = $this->module->userClass;
     $model = CActiveRecord::model($userClass)->findByPk($_GET['id']);
     $model->attachBehavior('rights', new RightsUserBehavior());
     $assignedItems = $this->_authorizer->getAuthItems(null, $model->getId(), null, true);
     $assignments = array_keys($assignedItems);
     // Make sure we have items to be selected
     $selectOptions = Rights::getAuthItemSelectOptions(null, $assignments);
     if ($selectOptions !== array()) {
         // Create a from to add a child for the authorization item
         $form = new CForm(array('elements' => array('itemname' => array('label' => false, 'type' => 'dropdownlist', 'items' => $selectOptions)), 'buttons' => array('submit' => array('type' => 'submit', 'label' => Rights::t('core', 'Assign')))), new AssignmentForm());
         // Form is submitted and data is valid, redirect the user
         if ($form->submitted() === true && $form->validate() === true) {
             // Update and redirect
             $this->_authorizer->authManager->assign($form->model->itemname, $model->getId());
             $item = $this->_authorizer->authManager->getAuthItem($form->model->itemname);
             $item = $this->_authorizer->attachAuthItemBehavior($item);
             Yii::app()->user->setFlash($this->module->flashSuccessKey, Rights::t('core', 'Permission :name assigned.', array(':name' => $item->getNameText())));
             $this->redirect(array('assignment/user', 'id' => $model->getId()));
         }
     } else {
         $form = null;
     }
     // Create a data provider for listing the assignments
     $dataProvider = new AuthItemDataProvider('assignments', array('userId' => $model->getId()));
     // Render the view
     $this->render('user', array('model' => $model, 'dataProvider' => $dataProvider, 'form' => $form));
 }
开发者ID:rusli-nasir,项目名称:smsempresayii,代码行数:33,代码来源:AssignmentController.php

示例3: actionRegisterconstruct

 public function actionRegisterconstruct()
 {
     $model = new RegisterTestForm();
     $form = new CForm("application.views.formconstruct.registerbuilder", $model);
     if ($form->submitted('register') && $form->validate()) {
         print "Зарегистрирован удачно";
     }
     $this->render("registerconstruct", array('form' => $form));
 }
开发者ID:nikaldem,项目名称:blogYii,代码行数:9,代码来源:FormController.php

示例4: actionOrder

 /**
  * Displays the order page
  */
 public function actionOrder()
 {
     $model = new OrderForm();
     $form = new CForm('application.views.site.orderForm', $model);
     if ($form->submitted('order') && $form->validate()) {
         $this->redirect(array('site/index'));
     } else {
         $this->render('order', array('form' => $form));
     }
 }
开发者ID:AlexanderKupriyanov,项目名称:test-yii,代码行数:13,代码来源:SiteController.php

示例5: actionResult

 public function actionResult()
 {
     $model = new SearchForm();
     $form = new CForm('application.views.search.form', $model);
     if ($form->submitted('search') && $form->validate()) {
         $result = $model->searchResult();
         //$this->redirect(array('search/index'));
         $this->render('index', array('form' => $form, 'result' => $result));
     } else {
         $this->render('index', array('form' => $form));
     }
 }
开发者ID:romero1989,项目名称:phpnetmap,代码行数:12,代码来源:SearchController.php

示例6: actionIndex

 /**
  * Action: Index
  *
  * @access public
  * @return void
  */
 public function actionIndex()
 {
     // Only go ahead with the logout if the end-user is logged in, if the end-user is a guest then we can skip
     // the entire logout procedure, and skip to the redirect back home!
     if (!Yii::app()->user->isGuest) {
         // Has the "authUser" persistent state been set, which contains the user's true authenticated ID, and is
         // it different to the user's current ID?
         if (is_int(Yii::app()->user->getState('authUser')) && Yii::app()->user->getState('authUser') != Yii::app()->user->getState('id') && is_object($authUser = User::model()->findByPk(Yii::app()->user->getState('authUser')))) {
             $model = new \application\model\form\Logout();
             $form = new CForm('application.forms.logout', $model);
             if ($form->submitted() && $form->validate()) {
                 // Has the user opted to switch back to their original account?
                 if ($model->switch) {
                     // Create a new user identity instance, but since we aren't going to use any credentials to
                     // authenticate the user, we can just pass in empty strings.
                     $identity = new UserIdentity('', '');
                     // Attempt to load the identitiy of the user defined by the ID in the "authUser" persistent
                     // state.
                     if ($identity->load(Yii::app()->user->getState('authUser')) && Yii::app()->user->login($identity)) {
                         // The original user account was successfully logged in, redirect to the homepage.
                         $this->redirect(Yii::app()->homeUrl);
                     } else {
                         throw new CException(Yii::t('application', 'An error occured whilst attempting to load your original user account. You have been logged out for security reasons.'));
                     }
                 } else {
                     // Log out the current user. Pass bool(false) as an argument to prevent the entire session
                     // from being destroyed, and instead only delete the persistent states that were created
                     // specifically for the user logged in. An example of why this is the behaviour we want is
                     // storing the language selection in a session - if the website visitor selects French as
                     // the language to view the website in (regardless of whether this functionality is actually
                     // implemented), we don't want that session variable destroyed causing the entire website to
                     // switch back to the default language of English just because the user wanted to log out.
                     // Personally I believe that this should be the default behaviour, but it's not.
                     Yii::app()->user->logout(false);
                     $this->redirect(Yii::app()->homeUrl);
                 }
             }
             // Render the logout page, so that the end-user may be presented with a choice instead of
             // automatically logged out (as if the default).
             $this->render('index', array('form' => $form, 'displayName' => $authUser->displayName));
             // End the application here to prevent any redirection.
             Yii::app()->end();
         } else {
             // Log out the current user. Please refer to the lengthy explaination earlier in this method for why
             // we pass bool(false).
             Yii::app()->user->logout(false);
         }
     }
     // We don't want the user to stay on the logout page. Redirect them back to the homepage.
     $this->redirect(Yii::app()->homeUrl);
 }
开发者ID:mynameiszanders,项目名称:yiiskeleton,代码行数:57,代码来源:LogoutController.php

示例7: actionUpdate

 /**
  * @param $id
  * @throws CHttpException
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $formElements = ['title' => 'Update ' . $model->sectionName . ' description', 'elements' => ['<label>Section Name</label><span>' . $model->sectionName . '</span>', 'description' => ['type' => 'textarea']], 'buttons' => ['save' => ['type' => 'submit', 'label' => 'Save']]];
     $form = new CForm($formElements, $model);
     if ($form->submitted('save') && $form->validate()) {
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'Surveillance section description updated successfully');
             $this->redirect(['index']);
         }
         Yii::app()->user->setFlash('error', 'Surveillance section description not updated successfully,' . ' please contact your administrator');
     }
     $this->render('update', ['model' => $model, 'form' => $form]);
 }
开发者ID:schrapps,项目名称:risksur,代码行数:20,代码来源:AdminsurveillancesectionsController.php

示例8: run

 public function run()
 {
     if (!Yii::app()->user->isGuest) {
         $this->redirect('index.php');
     }
     $form = new CForm('application.views.user.registerForm');
     $form['user']->model = new User('register');
     $form['profile']->model = new UserProfile();
     if ($form->submitted('register') && $form->validate()) {
         $user = $form['user']->model;
         $profile = $form['profile']->model;
         if ($user->save(false)) {
             $profile->id = $user->id;
             $profile->save(false);
             $this->redirect(array('site/index'));
         }
     } else {
         $this->render('register', array('form' => $form));
     }
 }
开发者ID:robebeye,项目名称:MusicDream,代码行数:20,代码来源:RegisterAction.php

示例9: actionDang_tin

 /**
  * Đăng tin rao vặt
  */
 public function actionDang_tin($currentPage = 1)
 {
     if (Yii::app()->user->name == 'Guest' || !isset(Yii::app()->user->userId)) {
         $this->redirect(Yii::app()->homeUrl . 'dang-nhap');
     }
     $form = new CForm('application.views.user.rao_vat._form');
     $form['tinkhachhang']->model = new Tinkhachhang();
     $form['tinraovat']->model = $tinraovat = new Tinraovat();
     $noticeMessage = '';
     if ($form->submitted('dangtin') && $form->validate()) {
         $tinkhachhang = $form['tinkhachhang']->model;
         $tinraovat = $form['tinraovat']->model;
         //Nếu không đủ tiền để đăng tin sẽ không đăng
         if ($tinkhachhang->trutien(Tinraovat::CODE_RV)) {
             $tinkhachhang->ma_loai_tin = Tinraovat::CODE_RV;
             if ($tinkhachhang->save(false)) {
                 $image = CUploadedFile::getInstance($tinraovat, 'anh');
                 if ($image) {
                     $newName = md5(microtime(true) . 'xechieuve') . $image->name;
                     $tinraovat->anh = $newName;
                     $image->saveAs(Tinraovat::IMAGE_DIR_RV . $newName);
                 }
                 $tinraovat->ma_tin = $tinkhachhang->ma_tin;
                 $tinraovat->save(false);
                 $this->__message = "Tin bạn đăng đã được hiển thị tại trang rao vặt";
             }
         } else {
             $this->__message = "Tài khoản của bạn không đủ để đăng tin";
         }
     }
     $tinraovat = new Tinraovat();
     $paginatorRV = new Paginate($currentPage, new Tinkhachhang(), self::LIMITED_REDCORD_RV, ' ma_loai_tin = ' . Tinraovat::CODE_RV);
     $listTinRV = $tinraovat->listTinRV($paginatorRV);
     //render view
     $data = array('form' => $form, 'listTinRV' => $listTinRV, 'paginatorRV' => $paginatorRV, 'urlPaginatorRV' => 'rao_vat/pagedtrv?page=', 'ajaxElementId' => '#tableRV', 'message' => $this->__message);
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial('dang_tin', $data);
     } else {
         $this->render('dang_tin', $data);
     }
 }
开发者ID:BanNT,项目名称:xechieuve,代码行数:44,代码来源:Rao_vatController.php

示例10: actionSelectComponents

 /**
  * actionSelectComponents
  */
 public function actionSelectComponents()
 {
     $this->setPageTitle('Select components');
     // check if the context supports component selection
     $rsEvaluationType = EvaluationDetails::model()->with('options')->find('evalElementsId=:element AND evalId=:evaId', [':element' => 5, ':evaId' => $this->evaContextId]);
     if (!isset($rsEvaluationType)) {
         Yii::app()->user->setFlash('notice', 'PLease update the evaluation context');
         $this->redirect('listEvaContext');
     }
     //print_r($rsEvaluationType); die;
     if (isset($rsEvaluationType->options) && $rsEvaluationType->options->label == 'System') {
         Yii::app()->user->setFlash('notice', 'You are planning to evaluate at system level hence no selection' . ' of components is required');
         $this->redirect('selectEvaAttributes');
     }
     $model = new DesignForm();
     $elements = ContextController::getDefaultElements();
     $rules = [];
     $componentsCriteria = new CDbCriteria();
     $componentsCriteria->select = 'componentId, componentName';
     $componentsCriteria->condition = 'frameworkId=:framework';
     $componentsCriteria->params = [':framework' => $this->frameworkId];
     $elements['title'] = '<h3>Select Components</h3>';
     $elements['elements'] = ['<p> Please select the components you would like to include in your evaluation from the components' . ' included in this system using the table below.  If the components you want to include are not listed' . ' in this table please go back and enter the information about your components into the ' . CHtml::link('add components', ['design/addMultipleComponents']) . ' screen. </p>', '<table id="componentsDisplay" width="100%" border="0" cellspacing="0" cellpadding="0">', '<thead><tr></tr><th></th><th>Component Name</th><th>Target Species</th><th>Data collection point</th>' . '<th>Study type</th></tr></thead>', '<tbody></tbody>', '</table>'];
     $rules[] = ['components', 'required'];
     $evaModel = EvaluationHeader::model()->find('evalId=:evalId', [':evalId' => $this->evaContextId]);
     $model->setPropertyName('components');
     $elements['buttons'] = ['save' => ['label' => 'Save', 'type' => 'submit'], 'next' => ['label' => 'Next', 'type' => 'submit']];
     $componentsConditions = EvaQuestionGroups::model()->find('section=:section', [':section' => 'evaComponents'])->questions;
     $availableComponents = json_decode($componentsConditions, true);
     $requiredComponents = 1;
     if (isset(array_flip($availableComponents[2])[$this->evaQuestionId])) {
         $requiredComponents = 2;
     }
     //var_dump($availableComponents, $this->evaQuestionId); die;
     // Get number of components
     $componentNo = EvaluationDetails::model()->find('evalId=:evaId AND evalElementsId=:evaElement', [':evaId' => $this->evaContextId, ':evaElement' => 6])->value;
     $rules[] = ['components', 'type', 'type' => 'array'];
     $rules[] = ['components', 'ext.validators.ComponentNumber', 'requiredComponents' => $requiredComponents, 'declaredComponents' => $componentNo];
     //var_dump($requiredComponents, $componentNo); die;
     $model->setRules($rules);
     $tableData = DesignController::getComponentData()['componentListArray'];
     $componentsList = json_encode($tableData);
     //print_r($model); die;
     $form = new CForm($elements, $model);
     //print_r($_POST); die;
     if ($form->submitted('save') || $form->submitted('next')) {
         if ($form->validate()) {
             $evaModel->components = json_encode($form->model->components);
             //				print_r($evaModel->components); die;
             if ($evaModel->save()) {
                 Yii::app()->user->setFlash('success', 'Components successfully saved');
                 if (isset($_POST['next'])) {
                     $this->redirect('selectEvaAttributes');
                 }
             } else {
                 Yii::app()->user->setFlash('error', 'An error occurred while save the components,' . ' please try again or contact your administrator if this problem persists');
             }
         }
     }
     $selectedComponents = is_null($evaModel->components) ? [] : json_decode($evaModel->components);
     //Get evaluation summary
     $evaDetails = $this->getEvaDetails();
     $this->docName = 'selectComponents';
     if (isset($_POST['pageId'])) {
         SystemController::savePage('selectComponents');
     }
     $page = SystemController::getPageContent($this->docName);
     if (!isset($page['content']->docData)) {
         Yii::app()->user->setFlash('notice', 'This page is missing some information, please contact your administrator');
     }
     $this->render('selectComponents', compact('form', 'componentsList', 'selectedComponents', 'page', 'evaDetails'));
     return;
 }
开发者ID:schrapps,项目名称:risksur,代码行数:76,代码来源:EvaluationController.php

示例11: _actionStep3

 /**
  *
  * @return void
  */
 protected function _actionStep3()
 {
     // create form
     $form = new CForm('application.views.setup.forms.register', new User());
     if (isset($_POST['User'])) {
         $form->loadData();
     }
     // form is submitted
     if (isset($_POST['User'])) {
         // attach eventhandler for padding password, generating encryption key and salting password
         $form->model->onBeforeValidate[] = array($form->model, 'padPassword');
         $form->model->onBeforeValidate[] = array($form->model, 'generateEncryptionKey');
         $form->model->onBeforeValidate[] = array($form->model, 'saltPassword');
         // validate form
         if ($form->validate()) {
             // save user
             $form->model->isAdmin = true;
             $form->model->save(false);
             // set step in session and redirect
             Yii::app()->user->setState('step', 4);
             $this->redirect(array('setup/', 'step' => 4));
         }
     }
     $this->render('step3', array('form' => $form));
 }
开发者ID:humantech,项目名称:ppma,代码行数:29,代码来源:SetupController.php

示例12: actionUpdateEvaMethod

 /**
  * @param $id
  * @return void
  */
 public function actionUpdateEvaMethod($id)
 {
     Yii::log("actionUpdateEvaMethod called", "trace", self::LOG_CAT);
     $config = self::getEvaMethodsFormConfig();
     $buttonParam = array('name' => 'update', 'label' => 'Update');
     $config['buttons'] = ContextController::getButtons($buttonParam, 'admin/listEvaMethods');
     $model = EvaMethods::model()->findByPk($id);
     if (is_null($model)) {
         Yii::app()->user->setFlash('notice', 'That economic evaluation method does not exist.');
         $this->redirect(array('admin/listEvaMethods'));
         return;
     }
     unset($config['buttons']['cancel']);
     $form = new CForm($config, $model);
     if ($form->submitted('update') && $form->validate()) {
         $model = $form->model;
         if ($model->save(false)) {
             Yii::app()->user->setFlash('success', 'Economic evaluation method updated successfully');
             $this->redirect(array('admin/listEvaMethods'));
         }
         Yii::app()->user->setFlash('error', 'An error occurred while updating, please try again or contact ' . 'your administrator if the problem persists');
     }
     $this->render('evaMethods/update', array('form' => $form));
 }
开发者ID:schrapps,项目名称:risksur,代码行数:28,代码来源:AdminController.php

示例13: actionUpdate

 /**
  * Updates an authorization item.
  */
 public function actionUpdate()
 {
     // Get the authorization item
     $model = $this->loadModel();
     // Create the authorization item form
     $form = new CForm('rights.views.authItem.authItemForm', new AuthItemForm('update'));
     // Form is submitted and data is valid
     if ($form->submitted() === true && $form->validate() === true) {
         // Update the item and load it
         $this->_authorizer->updateAuthItem($_GET['name'], $form->model->name, $form->model->description, $form->model->bizRule, $form->model->data);
         $item = $this->_authorizer->authManager->getAuthItem($form->model->name);
         $item = $this->_authorizer->attachAuthItemBehavior($item);
         // Set a flash message for updating the item
         Yii::app()->user->setFlash($this->module->flashSuccessKey, Rights::t('core', ':name updated.', array(':name' => $item->getNameText())));
         // Redirect to the correct destination
         $this->redirect(array(isset($_GET['redirect']) === true ? urldecode($_GET['redirect']) : 'authItem/permissions'));
     }
     // Create a form to add children to the authorization item
     $type = Rights::getValidChildTypes($model->type);
     $exclude = array($this->module->superuserName);
     $selectOptions = Rights::getParentAuthItemSelectOptions($model, $type, $exclude);
     if ($selectOptions !== array()) {
         // Create the child form
         $childForm = new CForm(array('elements' => array('name' => array('label' => false, 'type' => 'dropdownlist', 'items' => $selectOptions)), 'buttons' => array('submit' => array('type' => 'submit', 'label' => Rights::t('core', 'Add')))), new AuthChildForm());
         // Child form is submitted and data is valid
         if ($childForm->submitted() === true && $childForm->validate() === true) {
             // Add the child and load it
             $this->_authorizer->authManager->addItemChild($_GET['name'], $childForm->model->name);
             $child = $this->_authorizer->authManager->getAuthItem($childForm->model->name);
             $child = $this->_authorizer->attachAuthItemBehavior($child);
             // Set a flash message for adding the child
             Yii::app()->user->setFlash($this->module->flashSuccessKey, Rights::t('core', 'Child :name added.', array(':name' => $child->getNameText())));
             // Reidrect to the same page
             $this->redirect(array('authItem/update', 'name' => $_GET['name']));
         }
     } else {
         $childForm = null;
     }
     // Set the values for the form fields
     $form->model->name = $model->name;
     $form->model->description = $model->description;
     $form->model->type = $model->type;
     $form->model->bizRule = $model->bizRule !== 'NULL' ? $model->bizRule : '';
     $form->model->data = $model->data !== null ? serialize($model->data) : '';
     $parentDataProvider = new AuthItemParentDataProvider($model);
     $childDataProvider = new AuthItemChildDataProvider($model);
     // Render the view
     $this->render('update', array('model' => $model, 'parentDataProvider' => $parentDataProvider, 'childDataProvider' => $childDataProvider, 'form' => $form, 'childForm' => $childForm));
 }
开发者ID:rusli-nasir,项目名称:smsempresayii,代码行数:52,代码来源:AuthItemController.php

示例14: actionChinh_sua_thong_tin

 public function actionChinh_sua_thong_tin()
 {
     $this->_checkLogin();
     $form = new CForm('application.views.user.khach_hang._formChinhsuathongtin');
     $khachHang = $form->model = Khachhang::model()->findByPk(Yii::app()->user->userId);
     $pass = $khachHang->password;
     $khachHang->password = "";
     $khachHang->setScenario('update');
     $array = array(Yii::app()->user->name, Yii::app()->user->userId);
     $id = implode("_", $array);
     $khachHang->id = $id;
     $anh = $khachHang->anh_dai_dien;
     if ($form->submitted('chinhsua') && $form->validate()) {
         $image = CUploadedFile::getInstance($khachHang, 'anh_dai_dien');
         if ($image) {
             //Nếu tồn tại ảnh trong CSDL thì sẽ xóa ảnh cũ trong thư mục ảnh
             if ($anh) {
                 unlink(Yii::app()->basePath . '/../' . Khachhang::AVARTAR_DIR . $anh);
             }
             $newName = md5(microtime(true) . 'xechieuve') . $image->name;
             $khachHang->anh_dai_dien = $newName;
             $image->saveAs(Khachhang::AVARTAR_DIR . $newName);
         } else {
             $khachHang->anh_dai_dien = $anh;
         }
         if (md5($khachHang->password) == $pass) {
             $khachHang->password = md5($khachHang->password);
             $khachHang->save(FALSE);
             $this->__message = "Sửa thông tin thành công!";
         } else {
             $this->__message = "Thất bại,bạn nhập sai mật khẩu bạn cần nhập chính xác mật khẩu hiện tại của bạn!";
         }
     }
     $form2 = new CForm('application.views.user.khach_hang._formcapnhatpass');
     $khachHang2 = $form2->model = Khachhang::model()->findByPk(Yii::app()->user->userId);
     $khachHang2->setScenario('updatepass');
     if ($form2->submitted('doimatkhau') && $form2->validate()) {
         Khachhang::updatepassword(md5($khachHang2["newPassword"]));
         $this->__message = "Sửa thông tin thành công!";
     }
     $this->render('chinh_sua_thong_tin', array('form' => $form, 'anh' => $anh, 'form2' => $form2, 'message' => $this->__message));
 }
开发者ID:BanNT,项目名称:xechieuve,代码行数:42,代码来源:Khach_hangController.php

示例15: actionUpload

 public function actionUpload()
 {
     $model = new BackupUpload();
     $form = new CForm('application.models.uploadForm', $model);
     if ($form->submitted('submit') && $form->validate()) {
         $form->model->backup = CUploadedFile::getInstance($form->model, 'backup');
         $fc = file_get_contents($form->model->backup->tempName);
         $xml = new SimpleXMLElement($fc, LIBXML_NOCDATA);
         foreach ($xml->record as $record) {
             foreach ((array) $record->attributes() as $val) {
                 if (AbuserTrigger::model()->findByAttributes($val) === null) {
                     $tr = new AbuserTrigger();
                     $tr->attributes = $val;
                     if ($tr->validate()) {
                         $tr->save();
                     }
                 }
             }
         }
         Yii::app()->user->setFlash('success', 'File Uploaded');
         $this->redirect(array('upload'));
     }
     $this->render('upload', array('form' => $form));
 }
开发者ID:richardsonlima,项目名称:echofish,代码行数:24,代码来源:TriggerController.php


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