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


PHP SettingsForm::setAttributes方法代碼示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $settings = Yii::app()->settings;
     // 多個客戶端同時操作時,每個客戶端的緩存不一致,導致數據不一致,
     // 故刪除cache, 統一從數據庫取數據
     $settings->deleteCache();
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         //$settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', 'Site settings were updated.');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:25,代碼來源:SettingsController.php

示例2: actionIndex

 public function actionIndex()
 {
     if (!Yii::app()->user->checkAccess('store.update')) {
         $this->redirect(array('site/ErrorException', 'err_no' => 403));
     }
     $settings = Yii::app()->settings;
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         $settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', '<strong>Well done!</strong> Site settings were updated..');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
開發者ID:soklux,項目名稱:bakou-pos,代碼行數:25,代碼來源:SettingsController.php

示例3: actionIndex

 public function actionIndex()
 {
     $settings = Yii::app()->settings;
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         $settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             if ($category === 'logo') {
                 continue;
             }
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', 'Site settings were updated.');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         if ($category === 'logo') {
             continue;
         }
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
開發者ID:lhfcainiao,項目名稱:basic,代碼行數:28,代碼來源:SettingsController.php


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