本文整理汇总了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));
}
示例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;
}
示例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));
}
示例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();
}
示例5: beforeRender
protected function beforeRender($view)
{
parent::beforeRender($view);
$titles = $this->pageTitles;
$titles[] = Config::model()->get('title');
$this->setPageTitle(implode(' - ', $titles));
return true;
}
示例6: _config
/**
* 实时获取系统配置
* @return [type] [description]
*/
private function _config()
{
$model = Config::model()->findAll();
foreach ($model as $key => $row) {
$config[$row['variable']] = $row['value'];
}
return $config;
}
示例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;
}
示例8: getConfigData
public function getConfigData()
{
$contactData = new ConfigForm();
foreach ($contactData->attributes as $k => $v) {
$contacts[$k] = Config::model()->findByPk($k)->config_value;
}
return $contacts;
}
示例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;
}
示例10: getConfigData
public function getConfigData()
{
$contactData = Config::model()->findAll();
foreach ($contactData as $k => $v) {
$contacts[$v->config_name] = $v->config_value;
}
return $contacts;
}
示例11: get_settings
/**
*
* @return <type>
*/
public function get_settings()
{
$rows = Config::model()->findAll();
// create ассоц массив с именем опции как ключ
foreach ($rows as $row) {
$res[$row['key']] = $row;
}
return $res;
}
示例12: getConfig
public function getConfig($param = null)
{
$config = Config::model()->getConfigData();
if ($param) {
return $config[$param];
} else {
return $config;
}
}
示例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;
}
}
示例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');
}
示例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));
}