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


PHP Config::model方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 't.order';
     $criteria->with = array('config');
     $model = ConfigGroup::model()->opened()->findAll($criteria);
     // Save
     if (isset($_POST['Config'])) {
         if (isset($_POST['Config'][request()->csrfTokenName])) {
             unset($_POST['Config'][request()->csrfTokenName]);
         }
         foreach ($_POST['Config'] as $k => $v) {
             db()->createCommand()->update('{{config}}', array('value' => $v, 'updated_at' => date('Y-m-d H:i:s')), 'param = :param', array(':param' => $k));
         }
         if (request()->isAjaxRequest) {
             echo 'ok';
             app()->end();
         }
     }
     if (isset($_POST['Reset'])) {
         $configModel = Config::model()->find('param = :param', array(':param' => $_POST['Reset']['field']));
         if ($configModel !== NULL) {
             $configModel->setAttribute('value', $configModel->default);
             $configModel->save(FALSE);
             echo $configModel->default;
         } else {
             echo 'fail';
         }
         app()->end();
     }
     $this->render('//settings/index', array('model' => $model));
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:32,代码来源:ConfigController.php

示例2: loadModel

	private function loadModel($id)
	{
		$model=Config::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
开发者ID:noikiy,项目名称:letstravel,代码行数:7,代码来源:ConfigController.php

示例3: actionUbah

 /**
  * Updates a particular model.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUbah($id)
 {
     $this->penjualanId = $id;
     $model = $this->loadModel($id);
     // Penjualan tidak bisa diubah kecuali statusnya draft
     if ($model->status != Penjualan::STATUS_DRAFT) {
         $this->redirect(array('index'));
     }
     $this->namaProfil = $model->profil->nama;
     $this->profil = Profil::model()->findByPk($model->profil_id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $penjualanDetail = new PenjualanDetail('search');
     $penjualanDetail->unsetAttributes();
     $penjualanDetail->setAttribute('penjualan_id', '=' . $id);
     $barang = new Barang('search');
     $barang->unsetAttributes();
     if (isset($_GET['cariBarang'])) {
         $barang->setAttribute('nama', $_GET['namaBarang']);
         $criteria = new CDbCriteria();
         $criteria->order = 'nama ASC';
         $barang->setDbCriteria($criteria);
     }
     $configCariBarang = Config::model()->find("nama='pos.caribarangmode'");
     $this->render('ubah', array('model' => $model, 'penjualanDetail' => $penjualanDetail, 'barang' => $barang, 'tipeCari' => $configCariBarang->nilai));
 }
开发者ID:AbuMuhammad,项目名称:ap3,代码行数:30,代码来源:PosController.php

示例4: init

 public function init()
 {
     /*
     if($error=Yii::app()->errorHandler->error)
     {
     	$this->render('//site/error', array('error' => $error));exit();
     }
     */
     // put config into params
     $Configs = Config::model()->findAll(array('index' => 'key'));
     if (!isset($Configs['host']) || $_SERVER['HTTP_HOST'] !== $Configs['host']['value']) {
         // put the latest host into the database.
         if (!isset($Configs['host'])) {
             $Configs['host'] = new Config();
             $Configs['host']->key = 'host';
         }
         $Configs['host']->value = $_SERVER['HTTP_HOST'];
         $Configs['host']->save();
         if (!isset($Configs['https'])) {
             $Configs['https'] = new Config();
             $Configs['https']->key = 'https';
         }
         $Configs['https']->value = (int) isset($_SERVER['HTTPS']);
         $Configs['https']->save();
     }
     foreach ($Configs as $setting) {
         Yii::app()->params[$setting['key']] = $setting['value'];
     }
     //check for encyption key passphrase being set
     EncryptFile::checkPassphrase();
 }
开发者ID:newga,项目名称:newga,代码行数:31,代码来源:Controller.php

示例5: beforeRender

 protected function beforeRender($view)
 {
     parent::beforeRender($view);
     $titles = $this->pageTitles;
     $titles[] = Config::model()->get('title');
     $this->setPageTitle(implode(' - ', $titles));
     return true;
 }
开发者ID:zt123,项目名称:Base-System,代码行数:8,代码来源:Controller.php

示例6: _config

 /**
  * 实时获取系统配置
  * @return [type] [description]
  */
 private function _config()
 {
     $model = Config::model()->findAll();
     foreach ($model as $key => $row) {
         $config[$row['variable']] = $row['value'];
     }
     return $config;
 }
开发者ID:bigbol,项目名称:ziiwo,代码行数:12,代码来源:XAdminiBase.php

示例7: get

 public function get($param)
 {
     Yii::import('application.models.Config');
     $criteria = new CDbCriteria();
     $criteria->compare('name', $param, false);
     $model = Config::model()->find($criteria);
     return $model->value;
 }
开发者ID:Vexillum,项目名称:opencart,代码行数:8,代码来源:HelpKey.php

示例8: getConfigData

 public function getConfigData()
 {
     $contactData = new ConfigForm();
     foreach ($contactData->attributes as $k => $v) {
         $contacts[$k] = Config::model()->findByPk($k)->config_value;
     }
     return $contacts;
 }
开发者ID:parxtan,项目名称:gdeskidki,代码行数:8,代码来源:Config.php

示例9: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Config the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $Config = Config::model()->findByPk($id);
     if ($Config === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $Config;
 }
开发者ID:snapfrozen,项目名称:snapcms,代码行数:15,代码来源:ConfigController.php

示例10: getConfigData

 public function getConfigData()
 {
     $contactData = Config::model()->findAll();
     foreach ($contactData as $k => $v) {
         $contacts[$v->config_name] = $v->config_value;
     }
     return $contacts;
 }
开发者ID:parxtan,项目名称:gdeskidki,代码行数:8,代码来源:Config.php

示例11: get_settings

 /**
  *
  * @return <type>
  */
 public function get_settings()
 {
     $rows = Config::model()->findAll();
     // create ассоц массив с именем опции как ключ
     foreach ($rows as $row) {
         $res[$row['key']] = $row;
     }
     return $res;
 }
开发者ID:ASDAFF,项目名称:its-crm,代码行数:13,代码来源:Config.php

示例12: getConfig

 public function getConfig($param = null)
 {
     $config = Config::model()->getConfigData();
     if ($param) {
         return $config[$param];
     } else {
         return $config;
     }
 }
开发者ID:parxtan,项目名称:gdeskidki,代码行数:9,代码来源:Controller.php

示例13: _config

 /**
  * 实时获取系统配置
  * @return [type] [description]
  */
 public static function _config()
 {
     $model = Config::model()->findAll();
     if ($model) {
         foreach ($model as $key => $row) {
             $config[$row['variable']] = $row['value'];
         }
         return $config;
     }
 }
开发者ID:s-nice,项目名称:24int,代码行数:14,代码来源:AdminBase.php

示例14: actionIndex

 public function actionIndex()
 {
     //seo
     $title[] = Config::model()->get('title');
     $this->setPageTitle(implode('-', $title));
     $keywords = array('成都网站设计', '成都网站建设', '成都网站优化', '成都网站维护', '成都网站制作', '成都网站建设公司', '成都网站制作公司', '成都网站设计公司', '成都网络营销公司');
     $this->setPageState('keywords', implode(',', $keywords));
     $description[] = Config::model()->get('name') . '主要提供包括网站建设、域名注册、网站设计制作、网站优化托管、网络综合营销在内的一站式网络应用及解决方案,' . Config::model()->get('name') . '是一家四川地区知名的专业互联网运营商之一。';
     $this->setPageState('description', implode(',', $description));
     $this->render('index');
 }
开发者ID:zt123,项目名称:Base-System,代码行数:11,代码来源:SiteController.php

示例15: actionContent_about

 public function actionContent_about()
 {
     $model = Config::model()->findByPk(1);
     if (isset($_POST['Config'])) {
         $model->attributes = $_POST['Config'];
         if ($model->save()) {
             Yii::app()->user->setFlash('config', true);
             $this->redirect(array('content_about'));
         }
     }
     $this->render('content_about', array('model' => $model));
 }
开发者ID:postfx,项目名称:fermion,代码行数:12,代码来源:DefaultController.php


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