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(); }
/** * Extends parent method. * Call renderPartial() instead of render() on ajax request. * * @param $view * @param null $data * @param bool $return */ public function render($view, $data = null, $return = false) { if (Yii::app()->request->isAjaxRequest === true) { parent::renderPartial($view, $data, $return, false); } else { parent::render($view, $data, $return); } }
/** * override needed to, in case of ajax requests, use renderPartial and disable the jquery */ public function render($view, $data = array(), $return = false) { if (!Yii::app()->getRequest()->getIsAjaxRequest()) { return parent::render($view, $data, $return); } else { Yii::app()->getClientScript()->corePackages['jquery'] = false; return parent::renderPartial($view, $data, false, true); } }
/** * 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(); }
public function __construct($id, $module = null) { parent::__construct($id, $module); if (isset($_POST)) { $_POST = GxcHelpers::xss_clean($_POST); } if (isset($_GET)) { $_GET = GxcHelpers::xss_clean($_GET); } }
public function __construct($id, $module = null) { parent::__construct($id, $module); if (isset($_POST)) { $_POST = fn_clean_input($_POST); } if (isset($_GET)) { $_GET = fn_clean_input($_GET); } }
/** * 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 beforeRender($view) { $class = get_class($this); $action = $this->getAction()->getId(); $cs = Yii::app()->clientScript; if ($class === 'ShipmentController' && $action === 'createAWB' || $class === 'ShipmentController' && $action === 'updateAWB') { $cs->registerCssFile(Yii::app()->request->baseUrl . '/extjs/resources/css/ext-all.css'); $cs->registerScriptFile(Yii::app()->request->baseUrl . '/extjs/ext-all.js'); $cs->registerScriptFile(Yii::app()->request->baseUrl . '/js/ext.js'); $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/resetuistyle.css'); } else { $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/form-extended.css'); } return parent::beforeRender($view); }
public function __construct($id, $module = null) { parent::__construct($id, $module); if (YII_DEBUG) { $this->backend_asset = Yii::app()->assetManager->publish(Yii::getPathOfAlias('cms.assets.backend'), false, -1, true); } else { $this->backend_asset = Yii::app()->assetManager->publish(Yii::getPathOfAlias('cms.assets.backend'), false, -1, false); } if (isset($_POST)) { $_POST = fn_clean_input($_POST); } if (isset($_GET)) { $_GET = fn_clean_input($_GET); } }
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 __construct($id, $module = null) { parent::__construct($id, $module); }
public function init() { parent::init(); $this->dataSystem = System::model()->find(); $this->description = $this->dataSystem->description; }
public function beforeAction($action) { $this->setLayout('main'); return parent::beforeAction($action); }
public function init() { $this->registerAssets(); parent::init(); }
/** * @return array action filters */ public function filters() { return CMap::mergeArray(parent::filters(), array('rights', 'accessControl')); }