/**
  * Initialize admin page theme
  */
 public function init()
 {
     $arrThemes = Utility::getCurrentTemplate('public');
     Yii::app()->theme = $arrThemes['folder'];
     $this->layout = $arrThemes['layout'];
     $this->dialogFixed = true;
 }
 /**
  * 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));
     }
 }
Example #3
0
 /**
  * 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'));
     }
 }
 /**
  * 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();
 }
 /**
  * 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'));
     }
 }
 /**
  * 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'));
     }
 }
 /**
  * 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'));
     }
 }
Example #8
0
 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;
     }
 }
 /**
  * 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');
     }
 }
 /**
  * Initialize admin page theme
  */
 public function init()
 {
     $arrThemes = Utility::getCurrentTemplate('admin');
     Yii::app()->theme = $arrThemes['folder'];
     $this->layout = $arrThemes['layout'];
 }
Example #11
0
 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);
 }