예제 #1
0
 public function init()
 {
     Controller::initParams();
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     Yii::app()->setComponent('bootstrap', array('class' => 'ext.bootstrap.components.Bootstrap', 'responsiveCss' => true));
     Yii::setPathOfAlias('bootstrap', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../extensions/bootstrap');
     Yii::app()->bootstrap->init();
     // import the module-level models and components
     $this->setImport(array('admin.models.*', 'admin.components.*'));
     Yii::app()->setComponents(array('user' => array('class' => 'AdminUser', 'loginUrl' => Yii::app()->createAbsoluteUrl('admin/login'), 'allowAutoLogin' => true)), true);
     $this->layout = 'application.modules.admin.views.layouts.column1';
     if (Yii::app()->params['STORE_OFFLINE'] == '-1') {
         die('Admin Panel unavailable due to account suspension.');
     }
     if (isset($_POST['url']) && isset($_POST['password'])) {
         $model = new LoginForm();
         if ($model->loginLightspeed($_POST['user'], $_POST['password'])) {
             Yii::app()->getRequest()->redirect(Yii::app()->createUrl("/admin"));
         } else {
             die("You have an invalid password set in your eCommerce options. Cannot continue.");
         }
     }
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->shouldLogOut()) {
             Yii::app()->user->logout(false);
         }
     }
     _xls_set_conf('ADMIN_PANEL', date("Y-m-d H:i:s"));
     parent::init();
 }
예제 #2
0
 /**
  * Initializes the admin module.
  */
 public function init()
 {
     parent::init();
     Yii::setPathOfAlias('admin', dirname(__FILE__));
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => $this->getId() . '/default/error'), 'user' => array('class' => 'WebUser', 'stateKeyPrefix' => 'admin', 'loginUrl' => Yii::app()->createUrl($this->getId() . '/default/login')), 'widgetFactory' => array('class' => 'CWidgetFactory', 'widgets' => array())), false);
     $this->setImport(array('admin.models.*', 'admin.components.*'));
 }
예제 #3
0
 public function init()
 {
     parent::init();
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => 'siteadmin/default/error'), 'user' => array('class' => 'BackendUser', 'stateKeyPrefix' => 'siteadmin2', 'loginUrl' => Yii::app()->createUrl('siteadmin/default/login'), 'allowAutoLogin' => true, 'sitePart' => 'siteadmin')), false);
     Yii::app()->user->setReturnUrl(Yii::app()->createUrl('siteadmin'));
     Yii::app()->user->allowAutoLogin = true;
 }
예제 #4
0
 public function init()
 {
     parent::init();
     $moduleId = $this->getId();
     $this->setImport(array($moduleId . '.components.*', $moduleId . '.models.*', $moduleId . '.widgets.*'));
     $this->checkDependencies();
 }
 /**
  * Module constructor - Builds the initial module data
  *
  *
  * @author vadim
  *
  */
 public function init()
 {
     // If the langauge is set then set the application
     // Language appropriatly
     if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
         Yii::app()->setLanguage($_GET['lang']);
     }
     // Convert application name
     Yii::app()->name = Yii::app()->settings->applicationName != '' ? Yii::app()->settings->applicationName : Yii::app()->name;
     // Other settings
     if (count(Yii::app()->params)) {
         foreach (Yii::app()->params as $key => $value) {
             // Skip the ones that does not exists
             if (!Yii::app()->settings->{$key}) {
                 continue;
             }
             // Add them anyways
             Yii::app()->params[$key] = Yii::app()->settings->{$key} != '' ? Yii::app()->settings->{$key} : Yii::app()->params[$key];
         }
     }
     // Convert settings into params
     if (count(Yii::app()->settings->settings)) {
         foreach (Yii::app()->settings->settings as $settingKey => $settingValue) {
             Yii::app()->params[$settingKey] = $settingValue;
         }
     }
     parent::init();
 }
예제 #6
0
 public function init()
 {
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     // import the module-level models and components
     parent::init();
 }
예제 #7
0
 public function init()
 {
     parent::init();
     //module specific classes
     $this->setImport(array('admin.models.*', 'admin.models.forms.*', 'admin.components.*'));
     //module based componets
     $this->setComponents(array('user' => array('class' => 'CWebUser', 'loginUrl' => Yii::app()->createUrl('auth/login'), 'allowAutoLogin' => true, 'autoRenewCookie' => true, 'authTimeout' => 31557600, 'returnUrl' => Yii::app()->createUrl(self::MODULE_KEY . '/default/index'))));
 }
예제 #8
0
 function init()
 {
     $this->wtermOptions = array_merge($this->defaultWtermOptions, $this->wtermOptions);
     if ($this->useYiic) {
         $this->registerCommand('yiic', array('yiic'), 'Allows to run <strong>yiic</strong> commands.');
     }
     parent::init();
 }
예제 #9
0
 public function init()
 {
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     // import the module-level models and components
     $this->setImport(array('integration.models.*', 'integration.components.*', 'integration.controllers.*'));
     parent::init();
 }
예제 #10
0
 public function init()
 {
     parent::init();
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     Yii::app()->setComponents(array('errorHandler' => array('errorAction' => 'public/publicSite/page/view/notFound')));
     // import the module-level models and components
     $this->setImport(array('public.models.*', 'public.components.*'));
 }
예제 #11
0
	public function init()
	{
		$this->setImport(array(
			'nfy.models.*',
			'nfy.components.*',
			'users.models.*',
		));
		parent::init();
	}
예제 #12
0
 public function init()
 {
     parent::init();
     $this->setImport(array('admin.components.*', 'admin.models.*'));
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => 'admin/site/error'), 'user' => array('allowAutoLogin' => false, 'class' => 'BWebUser')));
     //$base_dir = $this->getBasePath();
     //$layoutPath = $base_dir.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'layouts';
     //$this->setLayoutPath($layoutPath);
 }
예제 #13
0
 public function init()
 {
     parent::init();
     // $this->setImport(array(
     // 	'application.models.*',
     // 	'auth.models.*',
     // 	'auth.components.*',
     // ));
 }
예제 #14
0
 /**
  * Module constructor - Builds the initial module data
  *
  *
  * @author vadim
  *
  */
 public function init()
 {
     // If the langauge is set then set the application
     // Language appropriatly
     if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
         Yii::app()->setLanguage($_GET['lang']);
     }
     parent::init();
 }
예제 #15
0
 public function init()
 {
     parent::init();
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     Yii::app()->urlManager->urlSuffix = '';
     Yii::app()->setComponents(array('errorHandler' => array('errorAction' => 'admin4/Site/error')));
     // import the module-level models and components
     $this->setImport(array('admin4.models.*', 'admin4.components.*', 'admin4.controllers.*'));
 }
예제 #16
0
 public function init()
 {
     // Load modules
     $modules = CmsModulereg::model()->findAll();
     $modulesConfig = array();
     foreach ($modules as $module) {
         $modulesConfig[] = $module->name;
         $this->setImport(array('cms.modules.' . $module->name . '.*'));
     }
     $this->setModules($modulesConfig);
     $this->setImport(array('cms.models.*', 'cms.components.*', 'cms.widgets.*'));
     parent::init();
 }
예제 #17
0
 public function init()
 {
     parent::init();
     Yii::import('api.components.*');
     $components = array('request' => array('class' => 'HttpRequest', 'enableCsrfValidation' => true));
     Yii::app()->setComponents($components, false);
     if (Yii::app()->user->isGuest) {
         Yii::app()->user->loginRequired();
     } else {
         return true;
     }
     return false;
 }
예제 #18
0
 public function init()
 {
     //$this->user=User::model()->findByPk(3);
     $this->user = Yii::app()->user;
     $this->defaultController = 'message';
     if (!$this->userModel) {
         throw new Exception(MessagingModule::t("Property Messaging::{userModel} not defined", array('{userModel}' => $this->userModel)));
     }
     if (!class_exists($this->userModel)) {
         throw new Exception(MessagingModule::t("Class {userModel} not defined", array('{userModel}' => $this->userModel)));
     }
     $this->setImport(array('messaging.models.*', 'messaging.components.*', 'messaging.controllers.*', 'messaging.views.*'));
     Yii::log("MessagingModule succesfully loaded.", "info", "MessagingModule");
     parent::init();
 }
예제 #19
0
파일: YWebModule.php 프로젝트: RSol/yupe
 public function init()
 {
     parent::init();
     if (is_object(Yii::app()->theme)) {
         $this->layout = 'webroot.themes.' . Yii::app()->theme->name . '.views.layouts.main';
     }
     // инициализация модуля
     $settings = Settings::model()->cache(Yii::app()->yupe->coreCacheTime)->findAll('module_id = :module_id', array('module_id' => $this->getId()));
     $editableParams = $this->getEditableParams();
     //@TODO обход не settings а editableParams как вариант =)
     foreach ($settings as $model) {
         $propertie = $model->param_name;
         if (property_exists($this, $propertie) && in_array($propertie, $editableParams)) {
             $this->{$propertie} = $model->param_value;
         }
     }
 }
예제 #20
0
파일: XWebModule.php 프로젝트: hung5s/yap
 public function init()
 {
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     parent::init();
     /**
      * If the module is an AngularJS web-based module and has ngl folder
      * then set that folder to be the module's default view folder
      */
     if (file_exists($this->basePath . '/ngl')) {
         $this->setViewPath($this->basePath . '/ngl');
     }
     // import the module-level models and components
     if (Yii::getPathOfAlias($this->Id)) {
         $this->setImport(array($this->Id . '.models.*', $this->Id . '.components.*'));
     }
     // api map
     $this->controllerMap = CMap::mergeArray($this->controllerMap, $this->loadApiMap());
 }
예제 #21
0
    public function init()
    {
        parent::init();

        //attach events from $this->eventMap
        foreach ($this->handlers() as $event=>$handler)
            $this->addHandler($event, $handler);

        //dataTypes register
        ModelFactory::registerDataTypes($this->dataTypes());

        //register widets
        Y::resources()->registerWidgets($this->widgets());

        //set assets path
        if (is_dir($path = Yii::getPathOfAlias($this->getId().'.assets'))) {
            $this->scriptPath = Yii::app()->getAssetManager()->publish($path);
        }
    }
예제 #22
0
 public function init()
 {
     parent::init();
     Yii::app()->name = 'Система управления';
     //Yii::app()->theme = 'bootstrap-admin';
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     // import the module-level models and components
     $this->setImport(array('admin.models.*', 'admin.components.*'));
     Yii::app()->setComponents(array('errorHandler' => array('errorAction' => '/admin/default/error')));
     //$this->layout = '/layouts/column2';
     $code = '';
     // загрузка текущей организации
     if (!Yii::app()->user->isGuest && Yii::app()->session['code_no'] == '') {
         // проверяем параметр kod_no у текущего пользователя
         $codeNoUser = User::model()->findByPk(Yii::app()->user->getId())->kod_no;
         if ($codeNoUser != '' && User::checkNo($codeNoUser)) {
             $code = $codeNoUser;
         } else {
             $codeNoUser = '';
         }
         if ($codeNoUser == '') {
             if (Yii::app()->user->admin) {
                 if (Organization::model()->exists()) {
                     $code = Organization::model()->find(array('order' => 'code'))->code;
                 }
             } else {
                 if (isset(User::model()->findByPk(Yii::app()->user->getId())->organization)) {
                     $code = User::model()->findByPk(Yii::app()->user->getId())->organization[0]['code'];
                 }
             }
             if ($code != '') {
                 User::changeNo($code);
             }
         }
         Yii::app()->session['code_no'] = $code;
     }
 }
예제 #23
0
 public function init()
 {
     // Convert application name
     Yii::app()->name = Yii::app()->settings->applicationName ? Yii::app()->settings->applicationName : Yii::app()->name;
     // Other settings
     if (count(Yii::app()->params)) {
         foreach (Yii::app()->params as $key => $value) {
             // Skip the ones that does not exists
             if (!Yii::app()->settings->{$key}) {
                 continue;
             }
             // Add them anyways
             Yii::app()->params[$key] = Yii::app()->settings->{$key} != '' ? Yii::app()->settings->{$key} : Yii::app()->params[$key];
         }
     }
     // Convert settings into params
     if (count(Yii::app()->settings->settings)) {
         foreach (Yii::app()->settings->settings as $settingKey => $settingValue) {
             Yii::app()->params[$settingKey] = $settingValue;
         }
     }
     parent::init();
 }
예제 #24
0
 /**
  * Initializes the audit module.
  */
 public function init()
 {
     parent::init();
     // setup paths
     $this->setImport(array('audit.models.*', 'audit.components.*'));
     // map models
     foreach ($this->getDefaultModelMap() as $method => $data) {
         foreach ($data as $name => $options) {
             if (empty($this->modelMap[$method][$name])) {
                 $this->modelMap[$method][$name] = $options;
             }
         }
     }
     // init yiiStrap
     $this->initYiiStrap();
 }
 /**
  * TranslateModule::init()
  * 
  * @return
  */
 public function init()
 {
     $this->defaultController = 'Translate';
     $this->setImport(array('translate.models.*', 'translate.controllers.*', 'translate.components.*'));
     return parent::init();
 }
예제 #26
0
 public function init()
 {
     parent::init();
     $moduleId = $this->getId();
     $this->setImport(array($moduleId . '.components.*', $moduleId . '.models.*'));
 }
예제 #27
0
 /**
  * Initializes the email module.
  */
 public function init()
 {
     parent::init();
     $this->name = 'TwModule';
 }
예제 #28
0
 /**
  * Initializes the gii module.
  */
 public function init()
 {
     parent::init();
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => $this->getId() . '/default/error'), 'user' => array('class' => 'CWebUser', 'stateKeyPrefix' => 'cache', 'loginUrl' => Yii::app()->createUrl($this->getId() . '/default/login'))), false);
 }
예제 #29
0
 /**
  * Initializes the gii module.
  */
 public function init()
 {
     parent::init();
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => $this->getId() . '/default/error'), 'user' => array('class' => 'CWebUser', 'stateKeyPrefix' => 'gii', 'loginUrl' => Yii::app()->createUrl($this->getId() . '/default/login')), 'widgetFactory' => array('class' => 'CWidgetFactory', 'widgets' => array())), false);
     $this->generatorPaths[] = 'gii.generators';
     $this->controllerMap = $this->findGenerators();
 }
예제 #30
0
 public function init()
 {
     parent::init();
 }