/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionPage($id) { $model = OmmuPages::model()->findByPk($id, array()); $this->pageTitle = Phrase::trans($model->name, 2); $this->pageDescription = Utility::shortText(Utility::hardDecode(Phrase::trans($model->desc, 2)), 300); $this->pageMeta = ''; $this->pageImage = $model->media != '' && $model->media_show == 1 ? Yii::app()->request->baseUrl . '/public/page/' . $model->media : ''; $this->render('application.webs.maintenance.front_page', array('model' => $model)); }
protected function renderContent() { $module = strtolower(Yii::app()->controller->module->id); $controller = strtolower(Yii::app()->controller->id); $action = strtolower(Yii::app()->controller->action->id); $currentAction = strtolower(Yii::app()->controller->id . '/' . Yii::app()->controller->action->id); if ($this->id != null) { $model = OmmuPages::model()->findByPk($this->id); } else { $criteria = new CDbCriteria(); $criteria->condition = 't.publish = :publish'; $criteria->params = array(':publish' => 1); $criteria->order = 't.published_date DESC'; $model = OmmuPages::model()->find($criteria); } $this->render('page_main_introduction', array('model' => $model)); }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = OmmuPages::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.')); } return $model; }