public function init() { /* if(!isset(Yii::app()->user->Company)){ Yii::app()->user->setState('Company',0); } */ Yii::log("Selected Company ID: " . Yii::app()->user->Company, 'info', 'app'); if (Yii::app()->user->Company == 0) { if (Yii::app()->controller->id != 'company') { //print "'".Yii::app()->controller->id."'"; $this->redirect(Yii::app()->createAbsoluteUrl('company/index')); Yii::app()->end(); } else { Yii::app()->db->setActive(false); Yii::app()->db->connectionString = Yii::app()->dbMain->connectionString; Yii::app()->db->tablePrefix = Yii::app()->dbMain->tablePrefix; Yii::app()->db->username = Yii::app()->dbMain->username; Yii::app()->db->password = Yii::app()->dbMain->password; Yii::app()->db->setActive(true); } } else { //hasAccess! $this->company = Company::model()->findByPk(Yii::app()->user->Company); Company::model()->loadComp($this->company); } //*/ return parent::init(); }
/** * Initializes the controller. */ public function init() { $this->_authorizer = $this->module->getAuthorizer(); $this->layout = $this->module->layout; $this->defaultAction = 'permissions'; // Register the scripts $this->module->registerScripts(); return parent::init(); }
/** * Initializes the controller. */ public function init() { parent::init(); $this->_authorizer = $this->module->getAuthorizer(); $this->layout = $this->module->layout; $this->defaultAction = 'view'; // Register the scripts $this->module->registerScripts(); }
/** * Initializes the controller. */ public function init() { if ($this->module->install !== true) { $this->redirect(Yii::app()->homeUrl); } $this->_authorizer = $this->module->getAuthorizer(); $this->_installer = $this->module->getInstaller(); $this->layout = $this->module->layout; $this->defaultAction = 'run'; // Register the scripts. $this->module->registerScripts(); return parent::init(); }
public function init() { //设置theme if (isset($_GET['theme'])) { Yii::app()->session['theme'] = $_GET['theme']; } if (isset(Yii::app()->session['theme'])) { Yii::app()->theme = Yii::app()->session['theme']; } //设置activeMenu $this->activeMenu = Yii::app()->getController()->id; parent::init(); }
public function init() { $site = Sites::model()->getCurrentSite(); //echo $site->theme; Yii::app()->theme = $site->theme; $this->site_id = $site->id; Yii::import('application.extensions.sesmail.*'); require_once 'vendors/aws-sdk/sdk.class.php'; $this->ses = new YiiSesMail(); if (stristr($_SERVER['REQUEST_URI'], 'admin')) { //if(!Yii::app()->user->isSuperUser) { // $this->redirect("/"); // exit; //} $session = new CHttpSession(); $session->open(); $site_id = $session['site_id']; // override the site_id (since switched) if ($site_id) { $this->site_id = $site_id; } $this->sites = CHtml::listData(Sites::model()->findAll(), 'id', 'name'); $this->admin = 1; $this->layout = '//layouts/admin'; } else { $this->isEditor = Yii::app()->user->checkAccess('admin'); $this->niches = Offers::model()->getNiches($this->site_id); //$this->site_id = $site->getCurrentSite(); //Yii::import('application.extensions.sesmail.*'); //require_once('protected/extensions/sesmail/YiiSesMail.php'); //require_once('vendors/aws-sdk/sdk.class.php'); $session = new CHttpSession(); $session->open(); $seenOffer = $session['seenBackout']; if ($seenOffer) { $this->hideBackout = true; } Yii::import('application.modules.user.models.*'); $this->registration_model = new RegistrationForm(); $this->login_model = new UserLogin(); } parent::init(); }
public function init() { $this->registerAssets(); parent::init(); }
public function init() { parent::init(); $this->dataSystem = System::model()->find(); $this->description = $this->dataSystem->description; }