當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CHtml::errorSummary方法代碼示例

本文整理匯總了PHP中CHtml::errorSummary方法的典型用法代碼示例。如果您正苦於以下問題:PHP CHtml::errorSummary方法的具體用法?PHP CHtml::errorSummary怎麽用?PHP CHtml::errorSummary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CHtml的用法示例。


在下文中一共展示了CHtml::errorSummary方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionUpdate

 public function actionUpdate($id)
 {
     $model = $this->loadModel($id, 'PeKasKeluar');
     if (isset($_POST) && !empty($_POST)) {
         foreach ($_POST as $k => $v) {
             $_POST['PeKasKeluar'][$k] = $v;
         }
         $_POST['PeKasKeluar']['entry_time'] = Yii::app()->dateFormatter->format('yyyy-MM-dd', time());
         $_POST['PeKasKeluar']['users_id'] = Yii::app()->user->getId();
         $_POST['PeKasKeluar']['doc_ref'] = '';
         $model->attributes = $_POST['PeKasKeluar'];
         if ($model->save()) {
             $status = true;
         } else {
             $msg = " " . CHtml::errorSummary($model);
             $status = false;
         }
         if (Yii::app()->request->isAjaxRequest) {
             echo CJSON::encode(array('success' => $status, 'msg' => $msg, 'id' => $model->kas_keluar_id));
             Yii::app()->end();
         } else {
             $this->redirect(array('view', 'id' => $model->kas_keluar_id));
         }
     }
     $this->render('update', array('model' => $model));
 }
開發者ID:saifulihsan,項目名稱:gkkd-jogja,代碼行數:26,代碼來源:PeKasKeluarController.php

示例2: actionUnban

 public function actionUnban($id)
 {
     $ban_model = $this->loadModel($id);
     if (!Webadmins::checkAccess('bans_unban', $ban_model->admin_nick)) {
         throw new CHttpException(403, "У Вас недостаточно прав");
     }
     $history_model = new History();
     $history_model->unsetAttributes();
     $history_model->player_ip = $ban_model->player_ip;
     $history_model->player_id = $ban_model->player_id;
     $history_model->player_nick = $ban_model->player_nick;
     $history_model->admin_ip = $ban_model->admin_ip;
     $history_model->admin_id = $ban_model->admin_id;
     $history_model->admin_nick = $ban_model->admin_nick;
     $history_model->ban_type = $ban_model->ban_type;
     $history_model->ban_reason = $ban_model->ban_reason;
     $history_model->ban_created = $ban_model->ban_created;
     $history_model->ban_length = $ban_model->ban_length;
     $history_model->server_ip = $ban_model->server_ip;
     $history_model->server_name = $ban_model->server_name;
     $history_model->unban_created = time();
     $history_model->unban_reason = 'Разбанен с сайта';
     $history_model->unban_admin_nick = Yii::app()->user->name;
     if ($history_model->save()) {
         if ($ban_model->delete()) {
             Yii::app()->end('Игрок разбанен');
         }
     }
     Yii::app()->end(CHtml::errorSummary($ban_model));
 }
開發者ID:DmitriyS,項目名稱:CS-Bans,代碼行數:30,代碼來源:BansController.php

示例3: actionCreate

 /**
  *
  */
 public function actionCreate()
 {
     $model = new Order(Order::SCENARIO_USER);
     if (Yii::app()->getRequest()->getIsPostRequest() && Yii::app()->getRequest()->getPost('Order')) {
         $order = Yii::app()->getRequest()->getPost('Order');
         $products = Yii::app()->getRequest()->getPost('OrderProduct');
         $coupons = isset($order['couponCodes']) ? $order['couponCodes'] : [];
         if ($model->store($order, $products, Yii::app()->getUser()->getId(), (int) Yii::app()->getModule('order')->defaultStatus)) {
             if (!empty($coupons)) {
                 $model->applyCoupons($coupons);
             }
             Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('OrderModule.order', 'The order created'));
             if (Yii::app()->hasModule('cart')) {
                 Yii::app()->getModule('cart')->clearCart();
             }
             //отправить уведомления
             Yii::app()->orderNotifyService->sendOrderCreatedAdminNotify($model);
             Yii::app()->orderNotifyService->sendOrderCreatedUserNotify($model);
             if (Yii::app()->getModule('order')->showOrder) {
                 $this->redirect(['/order/order/view', 'url' => $model->url]);
             }
             $this->redirect(['/store/product/index']);
         } else {
             Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, CHtml::errorSummary($model));
         }
     }
     $this->redirect(Yii::app()->getUser()->getReturnUrl($_SERVER['HTTP_REFERER']));
 }
開發者ID:alextravin,項目名稱:yupe,代碼行數:31,代碼來源:OrderController.php

示例4: actionIndex

 public function actionIndex()
 {
     // Residents::model()->deleteAll();
     foreach (range(0, 5) as $key => $value) {
         $fakerObj = Faker\Factory::create();
         $model = new Residents('createNewRecord');
         $model->salutation = $fakerObj->title;
         $model->firstname = $fakerObj->firstName;
         $model->lastname = $fakerObj->lastName;
         $model->middle_name = $fakerObj->firstName;
         $model->blood_type = "O";
         $model->house_number = $fakerObj->buildingNumber;
         $model->street_name = $fakerObj->streetName;
         $model->barangay_name = $fakerObj->streetName;
         $model->mobile_phone_number = "0906" . rand(1111111, 9999999);
         $model->town = "Solano";
         $model->province = "Nueva Vizcaya";
         $model->country = "Philippines";
         $model->birthdayYear = date("Y");
         $model->birthdayMonth = date("m");
         $model->birthdayDate = date("d");
         $model->residentSinceYear = date("Y");
         $model->residentSinceMonth = date("m");
         $model->residentSinceDate = date("d");
         $model->employment_type = "Full-time";
         if ($model->save()) {
             echo "New record created \r\n";
         } else {
             echo CHtml::errorSummary($model);
             die;
         }
     }
 }
開發者ID:kevindaus,項目名稱:SuperSimpleBarangayInformationSystem,代碼行數:33,代碼來源:SeedResidentsCommand.php

示例5: actionCreate

 public function actionCreate()
 {
     //$data = (array)json_decode( file_get_contents('php://input') );
     //echo (var_dump($data));
     $model = new Post();
     $model->setAttributes($this->getJsonInput());
     //$model->setAttributes($data);
     if (!$model->validate()) {
         $this->sendResponse(400, CHtml::errorSummary($model));
     } else {
         if (!$model->save(false)) {
             throw new CException('Cannot create a record');
         }
     }
     $model->refresh();
     echo CJSON::encode($model);
     /*
     		if(isset($_GET['id']))
                 $id=$_GET['id'];
     		$posts = Post::model()->findAllByAttributes(array("author"=>1));
     		foreach($posts as $p) {
     			$author = User::model()->findByPk($p['author']);
     			$p['author'] = $author['name'];
     		}
     		echo CJSON::encode($posts);*/
 }
開發者ID:Eisenheim94,項目名稱:blog,代碼行數:26,代碼來源:ApiController.php

示例6: run

 public function run($id, $attribute, $que)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->controller->loadModel($id);
         $range = Yii::app()->cache->get($que);
         if (empty($range)) {
             throw new CHttpException(400, 'Invalid queuetoggle identificator!!! Check JtoggleColumn settings queueid.');
         }
         $range = explode(',', $range);
         if (!isset($_POST['val'])) {
             $curr = array_search($model->{$attribute}, $range);
             $next = isset($range[$curr + 1]) ? $range[$curr + 1] : $range[0];
             $model->{$attribute} = $next;
         } else {
             $val = $_POST['val'];
             if (!in_array($_POST['val'], $range)) {
                 throw new CHttpException(400, 'Invalid post data');
             }
             $model->{$attribute} = $val;
             if (!$model->validate()) {
                 throw new CHttpException(400, CHtml::errorSummary($model));
             }
         }
         $model->save(false);
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
開發者ID:sharmarakesh,項目名稱:EduSec2.0.0,代碼行數:33,代碼來源:QtoggleAction.php

示例7: actionUpdate

 public function actionUpdate($id)
 {
     $model = $this->loadModel($id, 'PeDonatur');
     if (isset($_POST) && !empty($_POST)) {
         foreach ($_POST as $k => $v) {
             $_POST['PeDonatur'][$k] = $v;
         }
         $msg = "Data gagal disimpan";
         $model->attributes = $_POST['PeDonatur'];
         if ($model->save()) {
             $status = true;
             $msg = "Data berhasil di simpan dengan id " . $model->id;
         } else {
             $msg .= " " . CHtml::errorSummary($model);
             $status = false;
         }
         if (Yii::app()->request->isAjaxRequest) {
             echo CJSON::encode(array('success' => $status, 'msg' => $msg));
             Yii::app()->end();
         } else {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }
開發者ID:saifulihsan,項目名稱:gkkd-jogja,代碼行數:25,代碼來源:PeDonaturController.php

示例8: actionLogin

 public function actionLogin()
 {
     $this->layout = CrugeUtil::config()->loginLayout;
     $model = Yii::app()->user->um->getNewCrugeLogon('login');
     // por ahora solo un metodo de autenticacion por vez es usado, aunque sea un array en config/main
     //
     $model->authMode = CrugeFactory::get()->getConfiguredAuthMethodName();
     Yii::app()->user->setFlash('loginflash', null);
     Yii::log(__CLASS__ . "\nactionLogin\n", "info");
     if (isset($_POST[CrugeUtil::config()->postNameMappings['CrugeLogon']])) {
         $model->attributes = $_POST[CrugeUtil::config()->postNameMappings['CrugeLogon']];
         if ($model->validate()) {
             if ($model->login(false) == true) {
                 Yii::log(__CLASS__ . "\nCrugeLogon->login() returns true\n", "info");
                 // a modo de conocimiento, Yii::app()->user->returnUrl es
                 // establecida automaticamente por CAccessControlFilter cuando
                 // preFilter llama a accessDenied quien a su vez llama a
                 // CWebUser::loginRequired que es donde finalmente se llama a setReturnUrl
                 $this->redirect(Yii::app()->user->returnUrl);
             } else {
                 Yii::app()->user->setFlash('loginflash', Yii::app()->user->getLastError());
             }
         } else {
             Yii::log(__CLASS__ . "\nCrugeUser->validate es false\n" . CHtml::errorSummary($model), "error");
         }
     }
     $this->render('login', array('model' => $model));
 }
開發者ID:dev-lav,項目名稱:htdocs,代碼行數:28,代碼來源:UiController.php

示例9: setUp

 protected function setUp()
 {
     $firstProduct = new Product();
     $firstProduct->name = "wooden chair 2x";
     $firstProduct->description = "a wooden chair made of wood";
     $firstProduct->quantity = 50;
     $firstProduct->price = 3000;
     $firstProduct->sku = uniqid();
     if (!$firstProduct->save()) {
         throw new Exception(CHtml::errorSummary($firstProduct));
     } else {
         $this->productModels[] = $firstProduct;
     }
     $secondProduct = new Product();
     $secondProduct->name = "wooden chair 3x";
     $secondProduct->description = "a wooden chair made of wood but with color";
     $secondProduct->quantity = 60;
     $secondProduct->price = 4000;
     $secondProduct->sku = uniqid();
     if (!$secondProduct->save()) {
         throw new Exception(CHtml::errorSummary($secondProduct));
     } else {
         $this->productModels[] = $secondProduct;
     }
     /*create  product model*/
     parent::setUp();
 }
開發者ID:kevindaus,項目名稱:Order-Billing-Inventory-System-Marcials-Furniture,代碼行數:27,代碼來源:InvoiceDataPersistorTest.php

示例10: actionIngresar

 public function actionIngresar()
 {
     if (Yii::app()->user->hasFlash('backto')) {
         $backto = Yii::app()->user->getFlash('backto');
         Yii::app()->user->setFlash('backto', null);
         Yii::app()->user->setFlash('backto', $backto);
     } else {
         $backto = 'usuario/perfil';
     }
     if (!Yii::app()->user->isGuest) {
         $this->redirect(bu($backto));
     }
     $model = Yii::app()->user->um->getNewCrugeLogon('login');
     $model->authMode = CrugeFactory::get()->getConfiguredAuthMethodName();
     Yii::app()->user->setFlash('loginflash', null);
     Yii::log(__CLASS__ . "\nactionLogin\n", "info");
     if (isset($_POST[CrugeUtil::config()->postNameMappings['CrugeLogon']])) {
         $model->attributes = $_POST[CrugeUtil::config()->postNameMappings['CrugeLogon']];
         if ($model->validate()) {
             if ($model->login(false) == true) {
                 Yii::log(__CLASS__ . "\nCrugeLogon->login() returns true\n", "info");
                 // a modo de conocimiento, Yii::app()->user->returnUrl es
                 // establecida automaticamente por CAccessControlFilter cuando
                 // preFilter llama a accessDenied quien a su vez llama a
                 // CWebUser::loginRequired que es donde finalmente se llama a setReturnUrl
                 $this->redirect(bu($backto));
             } else {
                 Yii::app()->user->setFlash('loginflash', Yii::app()->user->getLastError());
             }
         } else {
             Yii::log(__CLASS__ . "\nCrugeUser->validate es false\n" . CHtml::errorSummary($model), "error");
         }
     }
     $this->render('ingresar', array('model' => $model));
 }
開發者ID:Telemedellin,項目名稱:tm,代碼行數:35,代碼來源:UsuarioController.php

示例11: appendFromArray

 /**
  * Append an array of items
  * Used on install, import
  *
  * @param $items
  * @param $class
  * @return int
  */
 public function appendFromArray($items, $class, &$error = '')
 {
     $imported = 0;
     $error = '';
     if (!empty($items)) {
         foreach ($items as $item) {
             $model = new $class();
             $model->setAttributes($item, false);
             if ($model->hasAttribute('labels') && is_string($model->labels)) {
                 //maybe on import: labels assigned as string
                 $model->labels = array(Yii::app()->language => $model->labels);
             }
             if ($model->hasAttribute('titles') && is_string($model->titles)) {
                 //maybe on import: titles assigned as string
                 $model->titles = array(Yii::app()->language => $model->titles);
             }
             $saved = $model->save();
             if ($saved) {
                 $imported++;
             } else {
                 $error = $class . ' [RecNo ' . ($imported + 1) . '] ' . CHtml::errorSummary($model);
                 return $imported;
             }
         }
     }
     return $imported;
 }
開發者ID:prayagKhanal,項目名稱:menubuilder,代碼行數:35,代碼來源:EMBDataAdapter.php

示例12: actionCreateAjaxMenuitem

 public function actionCreateAjaxMenuitem()
 {
     // if insert
     if (isset($_POST['Menuitem'])) {
         $model = new Menuitem();
         $model->attributes = $_POST['Menuitem'];
         // if insert without ajax / javascript is disabled
         if (!Yii::app()->request->isAjaxRequest) {
             if ($model->save()) {
                 $message = "<strong>Well done!</strong> You successfully Add New Menu";
                 Yii::app()->user->setFlash('info', $message);
             } else {
                 $message = CHtml::errorSummary($model);
                 Yii::app()->user->setFlash('error', $message);
             }
             $this->redirect(array('admin', 'id' => $model->term_id));
         }
         // if insert with ajax / javascript is enable
         if ($model->save()) {
             exit(json_encode(array('result' => 'success', 'term_id' => $model->term_id, 'name' => $model->meta_key, 'msg' => 'Your menu has been successfully saved')));
         } else {
             exit(json_encode(array('result' => 'failed', 'msg' => CHtml::errorSummary($model))));
         }
     } else {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
 }
開發者ID:beckblurry,項目名稱:Yii1-Base-Core-V.Alpha.1,代碼行數:27,代碼來源:MenuitemController.php

示例13: actionAjaxPersona

 public function actionAjaxPersona()
 {
     $model = new Persona();
     if (Yii::app()->request->isAjaxRequest) {
         $post = trim(file_get_contents('php://input'));
         //por ejemplo traeria: "cedula=123&nombre=aasas&apellido=aaa"
         // como lo sabemos ? simple: Yii::log("POST=".$post,"info");
         // ahora los pasamos a un array con forma key=>value
         // para que model->attributes los acepte:
         $attributes = array();
         foreach (explode("&", $post) as $item) {
             $att = explode("=", $item);
             $attributes[$att[0]] = $att[1];
         }
         // listo hemos convertido el string post a un array indexado:
         // var_export($attributes,true) mostraria:
         //  array ( 'cedula' => '123', 'nombre' => 'aasas', 'apellido' => 'aaa', )
         $model->attributes = $attributes;
         if ($model->validate()) {
             // ok todo bien, haces algo aqui con el modelo...
             // como es un ejemplo no haremos nada mas que informar.
             return;
         } else {
             // si defined('YII_DEBUG') or define('YII_DEBUG',true);
             // es TRUE por defecto, ver /index.php
             // entonces la excepcion mostrara un codigo horrible,
             // pero si la ponemos en FALSE, entonces solo mostrara
             // el errorSummary, lo cual es deseable.
             throw new Exception(CHtml::errorSummary($model));
         }
     }
 }
開發者ID:cesarmontoya770828,項目名稱:ejemplos,代碼行數:32,代碼來源:DefaultController.php

示例14: saveModel

 public function saveModel()
 {
     if (!$this->save()) {
         yii::app()->user->setFlash('error', CHtml::errorSummary($this));
         return false;
     }
     return true;
 }
開發者ID:jasonhai,項目名稱:yii1.1-user-auth-module,代碼行數:8,代碼來源:ExtAccounts.php

示例15: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $leadsAndStatusDataProvider = new LeadsStatusDataProvider();
     // $leadsAndStatusDataProvider = new LeadsStatusUrlDataProvider();
     $chartDataObj = new ChartDataProvider($leadsAndStatusDataProvider->data);
     $chartDataProvider = $chartDataObj->getData();
     /* client data */
     $clientVb = Yii::app()->askteriskDb->createCommand("select * from client_panel")->queryAll();
     $clientj6 = Yii::app()->askteriskDb->createCommand("select * from clientj6_sec_today")->queryAll();
     $clientj6 = $clientj6[0];
     $_5CXFER = Yii::app()->askteriskDb->createCommand("select * from `5cxfer_today`")->queryRow();
     $criteria = new CDbCriteria();
     $criteria->order = "date_created DESC";
     $currentBalance = BalanceLog::model()->find($criteria);
     $updatedInitBalance = 300;
     foreach ($clientVb as $key => $value) {
         if ($currentBalance) {
             $updatedInitBalance = $currentBalance->current_balance;
         } else {
             $currentBalance->current_balance = 300;
             $currentBalance->save();
         }
         $tempContainer = $clientVb[$key];
         $tempContainer['raw_seconds'] = doubleval($value['seconds']) + doubleval($clientj6['seconds']);
         $tempContainer['id'] = uniqid();
         $tempContainer['total'] = doubleval($tempContainer['raw_seconds']) / 60 * doubleval($value['ppminc']);
         $tempContainer['balance'] = doubleval($updatedInitBalance);
         $tempContainer['balance'] -= doubleval($tempContainer['total']);
         $tempContainer['total'] = '£ ' . sprintf("%.2f", $tempContainer['total']);
         $tempContainer['balance'] = '£ ' . sprintf("%.2f", $tempContainer['balance']);
         $tempContainer['raw_seconds'] = doubleval($value['seconds']) + doubleval($clientj6['seconds']);
         $tempContainer['hours'] = intval($tempContainer['raw_seconds'] / (60 * 60));
         $tempContainer['minutes'] = intval($tempContainer['raw_seconds'] / 60);
         $tempContainer['seconds'] = intval($tempContainer['raw_seconds'] % 60);
         // $tempContainer['cxfer']  = $_5CXFER['generated'];
         $tempContainer['cxfer'] = BarryOptLog::getCountToday();
         $clientVb[$key] = $tempContainer;
     }
     /*compute the total*/
     /*file uploaded*/
     $fileUploadedObj = new ClientUploadedData();
     $fileUploadedArr = $fileUploadedObj->getListUploaded();
     /*export range form*/
     $exportModel = new ExportRangeForm();
     $exportModel->unsetAttributes();
     if (isset($_POST['ExportRangeForm'])) {
         $exportModel->attributes = $_POST['ExportRangeForm'];
         if ($exportModel->validate()) {
             $this->redirect(array("/export/range", "dateFrom" => $exportModel->date_from, "dateTo" => $exportModel->date_to));
         } else {
             Yii::app()->user->setFlash("error", CHtml::errorSummary($exportModel));
             $this->redirect(array('/site/index'));
         }
     }
     $this->render('index', compact('clientVb', 'fileUploadedArr', 'exportModel', 'leadsAndStatusDataProvider', 'chartDataProvider'));
 }
開發者ID:branJakJak,項目名稱:c1.aepiaiklayentportal,代碼行數:60,代碼來源:SiteController.php


注:本文中的CHtml::errorSummary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。