当前位置: 首页>>代码示例>>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;未经允许,请勿转载。