Inheritance: extends CController
 protected function beforeAction($action)
 {
     /**
      * $this->module->getId() !== 'install' избавляет от ошибок на этапе установки
      * $this->id !== 'backend' || ($this->id == 'backend' && $action->id != 'modupdate') устраняем проблемы с зацикливанием
      */
     if ($this->module->getId() !== 'install' && ($this->id !== 'backend' || $this->id == 'backend' && $action->id != 'modupdate') && ($updates = Yii::app()->migrator->checkForUpdates(array($this->module->getId() => $this->module))) !== null && count($updates) > 0) {
         Yii::app()->user->setFlash(YFlashMessages::WARNING_MESSAGE, Yii::t('YupeModule.yupe', 'You must install all migration before start working with module.'));
         $this->redirect(array('/yupe/backend/modupdate', 'name' => $this->module->getId()));
     }
     return parent::beforeAction($action);
 }
 /**
  * Вызывается при инициализации FrontController
  * Присваивает значения, необходимым переменным
  */
 public function init()
 {
     parent::init();
     $this->pageTitle = $this->yupe->siteName;
     $this->metaTitle = $this->yupe->siteName;
     $this->description = $this->yupe->siteDescription;
     $this->keywords = $this->yupe->siteKeyWords;
     Yii::app()->theme = $this->yupe->theme ?: 'default';
     if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
         $bootstrap = Yii::app()->getTheme()->getBasePath() . DIRECTORY_SEPARATOR . "bootstrap.php";
         if (is_file($bootstrap)) {
             require $bootstrap;
         }
     }
 }
Example #3
0
 /**
  * Вызывается при инициализации FrontController
  * Присваивает значения, необходимым переменным
  */
 public function init()
 {
     parent::init();
     $this->pageTitle = $this->yupe->siteName;
     $this->description = $this->yupe->siteDescription;
     $this->keywords = $this->yupe->siteKeyWords;
     if ($this->yupe->theme) {
         Yii::app()->theme = $this->yupe->theme;
         $bootstrap = Yii::app()->theme->basePath . DIRECTORY_SEPARATOR . "bootstrap.php";
         if (is_file($bootstrap)) {
             require $bootstrap;
         }
     } else {
         Yii::app()->theme = 'default';
     }
 }