本文整理汇总了PHP中Setting::getValueByCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getValueByCode方法的具体用法?PHP Setting::getValueByCode怎么用?PHP Setting::getValueByCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::getValueByCode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSuccess
public function actionSuccess()
{
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 4);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '反馈中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->layout = 'main';
$this->render('success', array('banner' => $banner));
}
示例2: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->order = 't.sort_order ASC';
$servers = Server::model()->localized()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 3);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '服务中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->layout = 'main';
$this->render('index', array('servers' => $servers, 'banner' => $banner));
}
示例3: actionView
public function actionView()
{
$previd = 0;
// 上一个品牌
$nextid = 0;
// 下一个品牌
$brand = null;
$prevname = '';
$nextname = '';
$products = null;
if (isset($_GET['id'])) {
$id = Yii::app()->request->getQuery('id');
// 浏览数量加1
$brandModel = Brand::model()->findByPk($id);
$brandModel->view_count += 1;
$brandModel->update();
$brand = Brand::model()->localized()->findByPk($id);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->compare('t.brand_id', $id);
$products = Product::model()->localized()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->order = 'sort_order ASC';
$brands = Brand::model()->localized()->findAll($criteria);
foreach ($brands as $key => $value) {
if ($value->brand_id == $id && $key != 0) {
$previd = isset($brands[$key - 1]) ? $brands[$key - 1]['brand_id'] : 0;
$nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
$prevname = isset($brands[$key - 1]) ? $brands[$key - 1]['title'] : '';
$nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
} else {
if ($value->brand_id == $id && $key == 0) {
$nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
$nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
}
}
}
}
if (empty($brand)) {
throw new CHttpException(404);
}
// 广告图
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 2);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '品牌中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->render('view', array('brand' => $brand, 'banner' => $banner, 'previd' => $previd, 'nextid' => $nextid, 'prevname' => $prevname, 'nextname' => $nextname, 'products' => $products));
}
示例4: appOnBeginRequest
public static function appOnBeginRequest()
{
if (Setting::getValueByCode('system_maintaining')) {
header('Location: ' . Yii::app()->baseUrl . '/systemMaintaining.html');
exit;
}
/*
if (Yii::app()->language == 'en_us') {
header('Location: ' . Yii::app()->baseUrl . '/comingsoon.html');
exit;
}
if (Yii::app()->baseUrl . '/' == $_SERVER['REQUEST_URI']) {
Yii::app()->language = 'en_us';
// Yii::app()->language = 'zh_tw';
// Yii::app()->getRequest()->getPreferredLanguage();
}
*/
}
示例5: actionSearch
public function actionSearch()
{
$keyword = $_GET['keyword'] ? trim($_GET['keyword']) : "";
$num = 0;
$products = null;
$brands = null;
// 品牌搜索
$criteria = new CDbCriteria();
$criteria->addSearchCondition('t.title', $keyword, true, 'OR');
$criteria->addSearchCondition('t.sub_content', $keyword, true, 'OR');
$criteria->addSearchCondition('t.content', $keyword, true, 'OR');
if ($_GET['lang'] === 'en') {
$criteria->addSearchCondition('localized.title', $keyword, true, 'OR');
$criteria->addSearchCondition('localized.sub_content', $keyword, true, 'OR');
$criteria->addSearchCondition('localized.content', $keyword, true, 'OR');
}
$brands = Brand::model()->localized()->findAll($criteria);
// 产品搜索
$criteria = new CDbCriteria();
$criteria->select = 't.series_id';
$criteria->addSearchCondition('t.title', $keyword, true, 'OR');
$criteria->addSearchCondition('t.norms', $keyword, true, 'OR');
$criteria->addSearchCondition('t.series_model', $keyword, true, 'OR');
$criteria->addSearchCondition('t.content', $keyword, true, 'OR');
if ($_GET['lang'] === 'en') {
$criteria->select = 'localized.owner_id as series_id';
$criteria->addSearchCondition('localized.title', $keyword, true, 'OR');
$criteria->addSearchCondition('localized.norms', $keyword, true, 'OR');
$criteria->addSearchCondition('localized.series_model', $keyword, true, 'OR');
$criteria->addSearchCondition('localized.content', $keyword, true, 'OR');
}
$serieids = ProductSeries::model()->localized()->findAll($criteria);
$ids = array();
foreach ($serieids as $key => $value) {
$ids[] = $value->series_id;
}
$criteria = new CDbCriteria();
if (!empty($ids)) {
$criteria->addInCondition('t.series_id', $ids);
}
$criteria->addSearchCondition('t.name', $keyword, true, 'OR');
if ($_GET['lang'] === 'en') {
$criteria->addSearchCondition('localized.name', $keyword, true, 'OR');
}
$products = Product::model()->localized()->findAll($criteria);
$num = count($products) + count($brands);
$this->pageTitle = Yii::t('common', '首页') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->render('search', array('keyword' => $keyword, 'brands' => $brands, 'products' => $products, 'num' => $num));
}
示例6:
echo Setting::getValueByCode('address', true);
?>
</address>
<address>
<!-- Name -->
<h6><?php
echo Yii::t('common', '联系邮箱');
?>
</h6>
<!-- Email -->
<a href="mailto:<?php
echo Setting::getValueByCode('email', true);
?>
"><?php
echo Setting::getValueByCode('email', true);
?>
</a>
</address>
</div>
</div>
</div>
</div>
</div>
<!-- Content ends -->
</div>
</div>
示例7: actionGoogleAnalytics
public function actionGoogleAnalytics()
{
if (Yii::app()->user->checkAccess('viewGoogleAnalytics') == false) {
throw new CHttpException(403);
}
require_once 'gapi.class.php';
header('Content-type: application/json');
try {
$account = Setting::getValueByCode('google_analytics_account');
$password = Setting::getValueByCode('google_analytics_password');
$reportId = Setting::getValueByCode('google_analytics_report_id');
if (empty($account) || empty($password) || empty($password)) {
throw new Exception('Google 分析帐号信息未设置');
}
$ga = new gapi($account, $password);
$ga->requestReportData($reportId, array('date'), array('pageviews', 'visits'), array('date', '-pageviews', '-visits'));
$pageviews = array();
$visits = array();
foreach ($ga->getResults() as $result) {
array_push($pageviews, array(date('Y-n-j', strtotime($result->getDate())), $result->getPageviews()));
array_push($visits, array(date('Y-n-j', strtotime($result->getDate())), $result->getVisits()));
}
echo CJSON::encode(array('result' => true, 'data' => array($pageviews, $visits)));
} catch (Exception $e) {
echo CJSON::encode(array('result' => false, 'message' => $e->getMessage()));
}
Yii::app()->end();
}
示例8:
</div>
<!-- 右侧菜单栏 ends -->
<?php
echo $content;
?>
<div class="clearfix"></div>
<!-- Foot starts -->
<div class="foot">
<?php
echo Setting::getValueByCode('copyright', true);
?>
<!-- Copyright 2015 © - <?php
echo Yii::t('common', '技术支持');
?>
<a href="http://www.kinghinds.icoc.cc/" title="天下楚云" target="_blank">天下楚云</a> -->
</div>
<!-- Foot ends -->
</div>
<div class="clearfix"></div>
<!-- Main content ends -->
<!-- JS -->
示例9: actionView
public function actionView()
{
$previd = 0;
// 上一个品牌
$nextid = 0;
// 下一个品牌
$serie = null;
$prevname = '';
$nextname = '';
$products = null;
if (isset($_GET['seriesid'])) {
$id = Yii::app()->request->getQuery('seriesid');
$serie = ProductSeries::model()->localized()->findByPk($id);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->compare('t.series_id', $id);
$products = Product::model()->localized()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$series = ProductSeries::model()->localized()->findAll($criteria);
foreach ($series as $key => $value) {
if ($value->series_id == $id && $key != 0) {
$previd = isset($series[$key - 1]) ? $series[$key - 1]['series_id'] : 0;
$nextid = isset($series[$key + 1]) ? $series[$key + 1]['series_id'] : 0;
$prevname = isset($series[$key - 1]) ? $series[$key - 1]['title'] : '';
$nextname = isset($series[$key + 1]) ? $series[$key + 1]['title'] : '';
} else {
if ($value->series_id == $id && $key == 0) {
$nextid = isset($series[$key + 1]) ? $series[$key + 1]['series_id'] : 0;
$nextname = isset($series[$key + 1]) ? $series[$key + 1]['title'] : '';
}
}
}
}
if (empty($serie)) {
throw new CHttpException(404);
}
// 广告图
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 1);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '产品中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->render('view', array('serie' => $serie, 'banner' => $banner, 'previd' => $previd, 'nextid' => $nextid, 'prevname' => $prevname, 'nextname' => $nextname, 'products' => $products));
}