本文整理汇总了PHP中Utility::getCurrentTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::getCurrentTemplate方法的具体用法?PHP Utility::getCurrentTemplate怎么用?PHP Utility::getCurrentTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::getCurrentTemplate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialize admin page theme
*/
public function init()
{
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
$this->dialogFixed = true;
}
示例2: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id = null, $static = null)
{
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
Utility::applyCurrentTheme($this->module);
//$this->pageGuest = true;
if ($id == null) {
$criteria = new CDbCriteria();
$criteria->condition = 'publish = :publish';
$criteria->params = array(':publish' => 1);
$criteria->order = 'creation_date DESC';
$dataProvider = new CActiveDataProvider('OmmuPages', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
$this->pageTitle = '';
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('application.webs.page.front_index', array('dataProvider' => $dataProvider));
} else {
if ($static == null) {
$model = $this->loadModel($id);
$title = Phrase::trans($model->name, 2);
$description = Phrase::trans($model->desc, 2);
$image = $model->media != '' && $model->media_show == 1 ? Yii::app()->request->baseUrl . '/public/page/' . $model->media : '';
} else {
$server = Utility::getConnected(Yii::app()->params['server_options']['bpad']);
if ($server != 'neither-connected') {
if (in_array($server, Yii::app()->params['server_options']['localhost'])) {
$server = $server . '/bpadportal';
}
$url = $server . preg_replace('(' . Yii::app()->request->baseUrl . ')', '', Yii::app()->createUrl('api/page/detail'));
$item = array('id' => $id);
$items = http_build_query($item);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch,CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $items);
$output = curl_exec($ch);
$model = json_decode($output);
}
$title = $model->success == '0' ? 'Page not found' : $model->title;
$description = $model->success == '0' ? '' : $model->description;
$image = $model->success == '0' ? '' : $model->media_image != '-' ? $model->media_image : '';
}
if ($static == null && $model == null || $static != null && $model->success == '0') {
throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
}
$this->pageTitleShow = true;
$this->pageTitle = $title;
$this->pageDescription = Utility::shortText(Utility::hardDecode($description), 200);
$this->pageMeta = '';
$this->pageImage = $image;
$this->render('application.webs.page.front_view', array('model' => $model, 'a' => $static));
}
}
示例3: init
/**
* Initialize admin page theme
*/
public function init()
{
if (ArticleSetting::getInfo('permission') == 1) {
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
} else {
$this->redirect(Yii::app()->createUrl('site/index'));
}
}
示例4: init
/**
* Initialize public template
*/
public function init()
{
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
//load Lucene Library
Yii::import('application.vendors.*');
require_once 'Zend/Search/Lucene.php';
parent::init();
}
示例5: init
/**
* Initialize public template
*/
public function init()
{
$setting = OmmuSettings::model()->findByPk(1, array('select' => 'online, construction_date'));
if ($setting->online == 0 && date('Y-m-d', strtotime($setting->construction_date)) > date('Y-m-d')) {
$arrThemes = Utility::getCurrentTemplate('underconstruction');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
} else {
$this->redirect(Yii::app()->createUrl('site/index'));
}
}
示例6: init
/**
* Initialize admin page theme
*/
public function init()
{
if (!Yii::app()->user->isGuest) {
if (in_array(Yii::app()->user->level, array(1, 2))) {
$arrThemes = Utility::getCurrentTemplate('admin');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
} else {
throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
}
} else {
$this->redirect(Yii::app()->createUrl('site/login'));
}
}
示例7: init
/**
* Initialize admin page theme
*/
public function init()
{
if (!Yii::app()->user->isGuest) {
if (in_array(Yii::app()->user->level, array(1, 2))) {
$arrThemes = Utility::getCurrentTemplate('admin');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
} else {
$this->redirect(Yii::app()->createUrl('site/login'));
}
} else {
$this->redirect(Yii::app()->createUrl('site/login'));
}
}
示例8: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
// this method is called before any module controller action is performed
// you may place customized code here
//list public controller in this module
$publicControllers = array('site', 'user');
// pake ini untuk set theme per action di controller..
// $currentAction = Yii::app()->controller->id.'/'.$action->id;
if (!in_array(strtolower(Yii::app()->controller->id), $publicControllers) && !Yii::app()->user->isGuest) {
$arrThemes = Utility::getCurrentTemplate('admin');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
}
Utility::applyCurrentTheme($this);
return true;
} else {
return false;
}
}
示例9: actionAjaxDelete
/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionAjaxDelete($id)
{
if (!isset($_GET['type'])) {
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
Utility::applyCurrentTheme($this->module);
}
$model = $this->loadModel($id);
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
if (isset($id)) {
if ($model->delete()) {
$url = Yii::app()->controller->createUrl('ajaxmanage', array('id' => $model->article_id, 'replace' => 'true'));
echo CJSON::encode(array('type' => 2, 'id' => 'media-render', 'get' => $url));
}
}
} else {
$this->dialogDetail = true;
$this->dialogGroundUrl = Yii::app()->controller->createUrl('admin/edit', array('id' => $model->article_id));
$this->dialogWidth = 350;
$this->pageTitle = Phrase::trans(26056, 1);
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('front_delete');
}
}
示例10: init
/**
* Initialize admin page theme
*/
public function init()
{
$arrThemes = Utility::getCurrentTemplate('admin');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
}
示例11: getTemplateModule
public static function getTemplateModule($moduleId, $publicControllerActions)
{
$currentControllerAction = str_replace("/{$moduleId}/", '', str_replace(Yii::app()->baseUrl, '', $_SERVER["REQUEST_URI"]));
$part = explode('/', $currentControllerAction);
if (in_array($currentControllerAction, $publicControllerActions)) {
//public group
$groupPage = 'public';
} else {
if (!Yii::app()->user->isGuest) {
$groupPage = Yii::app()->user->id == 1 ? 'admin_sweeto' : 'back_office';
}
}
return $arrThemes = Utility::getCurrentTemplate($groupPage);
}