protected function beforeAction() { $this->layout = 'base_page'; if (!Yii::app()->user->isGuest) { $this->topMenu = Mainmenu::getMenu('top', 'admin'); $this->middleMenu = Mainmenu::getMenu('middle', 'admin'); $this->_admin = Admins::model()->findByPk(Yii::app()->user->id, array('select' => 'login')); if (null === $this->_admin || 'Users' == Yii::app()->session->get("typeAuthorize")) { $this->redirect(Yii::app()->homeUrl); } } return true; }
/** * Конструктор * @return bool */ protected function beforeAction() { $this->layout = 'start_page'; $this->topMenu = Mainmenu::getMenu('top', 'site'); $this->middleMenu = Mainmenu::getMenu('middle', 'site'); $this->listChat = Chat::getListChat(); $this->randomArt = Articles::getRandomArticles(10); $this->tags = Tags::getMenu(Tags::model()->findAll()); $settingChat = Settings::model()->findByAttributes(array('parameter' => Yii::app()->params['parameter']['chat'])); $this->stateChat = null != $settingChat ? (int) $settingChat->value : 0; if (!Yii::app()->user->isGuest) { $this->_user = Users::model()->findByPk(Yii::app()->user->id); } else { $this->_loginModel = new LoginForm(); } return true; }