Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\base\Application
Exemplo n.º 1
4
 /**
  *
  * @param \yii\web\Application $app
  * @param array                $config
  */
 protected function initialize($app, $config)
 {
     if ($app instanceof \yii\web\Application) {
         if (ArrayHelper::getValue($config, 'attach_client_behavior', true)) {
             $app->attachBehavior(ClientBehavior::className(), ClientBehavior::className());
         }
         AppHelper::registerAccessHandler(models\Sales::className(), components\AccessHandler::className());
     }
 }
Exemplo n.º 2
3
 /**
  *
  * @param \yii\web\Application $app
  * @param array                $config
  */
 protected function initialize($app, $config)
 {
     if ($app instanceof \yii\web\Application) {
         $app->attachBehaviors([hooks\TransferNoticeHook::className() => hooks\TransferNoticeHook::className()]);
         AppHelper::registerAccessHandler(models\Transfer::className(), AccessHandler::className());
         AppHelper::registerAccessHandler(models\TransferNotice::className(), AccessHandler::className());
     }
 }
Exemplo n.º 3
3
 /**
  * @inheritdoc
  */
 public function preInit(&$config)
 {
     if (!isset($config['timeZone']) && date_default_timezone_get()) {
         $config['timeZone'] = date_default_timezone_get();
     }
     parent::preInit($config);
 }
 /**
  * @inheritdoc
  */
 public function preInit(&$config)
 {
     date_default_timezone_set('America/New_York');
     if (!isset($config['timeZone']) && date_default_timezone_get()) {
         $config['timeZone'] = date_default_timezone_get();
     }
     parent::preInit($config);
 }
Exemplo n.º 5
2
 /** @param \yii\web\Application $app */
 public function bootstrap($app)
 {
     if ($app instanceof \yii\web\Application) {
         \Yii::$app->setComponents(['user' => ['class' => 'giantbits\\crelish\\components\\CrelishUser', 'identityClass' => 'giantbits\\crelish\\components\\CrelishUser', 'enableAutoLogin' => true], 'defaultRoute' => 'frontend/index', 'view' => ['class' => 'yii\\web\\View', 'renderers' => ['twig' => ['class' => 'yii\\twig\\ViewRenderer', 'cachePath' => '@runtime/Twig/cache', 'options' => ['auto_reload' => true], 'globals' => ['html' => '\\yii\\helpers\\Html']]]], 'urlManager' => ['class' => 'yii\\web\\UrlManager', 'enablePrettyUrl' => TRUE, 'showScriptName' => FALSE, 'enableStrictParsing' => TRUE, 'suffix' => '.html', 'rules' => []], 'i18n' => ['class' => 'yii\\i18n\\I18N', 'translations' => ['app*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en-US', 'fileMap' => ['app' => 'app.php', 'app/error' => 'error.php'], 'on missingTranslation' => [CrelishI18nEventHandler::class, 'handleMissingTranslation']]]]]);
         $app->getUrlManager()->addRules([['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish/<controller:[\\w\\-]+>/<action:[\\w\\-]+>', 'route' => 'crelish/<controller>/<action>'], ['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish/<id:\\w+>', 'route' => 'crelish/default/view'], ['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish', 'route' => 'crelish/default/index'], ['class' => 'yii\\web\\UrlRule', 'pattern' => '<controller:[\\w\\-]+>/<action:[\\w\\-]+>', 'route' => '/<controller>/<action>'], ['class' => 'giantbits\\crelish\\components\\CrelishBaseUrlRule']], TRUE);
     }
     // Register crelish.
     \Yii::$app->setModules(['crelish' => ['class' => 'giantbits\\crelish\\Module', 'theme' => \Yii::$app->params['crelish']['theme']], 'redactor' => 'yii\\redactor\\RedactorModule']);
 }
Exemplo n.º 6
2
 /**
  * Bootstraps the module for the web application.
  *
  * @param \yii\web\Application $app application instance.
  */
 protected function bootstrapWebApplication($app)
 {
     /** @var Module $module */
     $module = $app->getModule(Module::MODULE_ID);
     // prepend the URL rules to the URL manager
     $app->getUrlManager()->addRules([new GroupUrlRule($module->urlConfig)], false);
     // Configure the web user component
     $app->set('user', ArrayHelper::merge(['class' => $module->getClassName(Module::CLASS_WEB_USER), 'identityClass' => $module->getClassName(Module::CLASS_ACCOUNT), 'loginUrl' => $module->createRoute(Module::URL_ROUTE_LOGIN), 'enableAutoLogin' => true], $module->userConfig));
     // configure client authentication if necessary
     if ($module->enableClientAuth && !$app->has('authClientCollection')) {
         $app->set('authClientCollection', ArrayHelper::merge(['class' => Collection::className(), 'clients' => ['google' => ['class' => GoogleOpenId::className()]]], $module->clientAuthConfig));
     }
 }
Exemplo n.º 7
1
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $view = $app->getView();
     $pathMap = [];
     $pathMap['@app/views/layouts'] = '@hscstudio/startup/views/layouts';
     $pathMap['@app/views/site'] = '@hscstudio/startup/views/site';
     if (!empty($pathMap)) {
         $view->theme = Yii::createObject(['class' => 'yii\\base\\Theme', 'pathMap' => $pathMap]);
     }
     $assets = $view->assetManager->publish('@hscstudio/startup/assets');
 }
Exemplo n.º 8
1
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     if (isset($app->components['adminlte']['example']) and $app->components['adminlte']['example']) {
         $app->controllerMap['site'] = ['class' => 'hscstudio\\adminlte\\controllers\\SiteController'];
         $view = $app->getView();
         $pathMap = [];
         $pathMap['@app/views/layouts'] = '@hscstudio/adminlte/views/layouts';
         $pathMap['@app/views/site'] = '@hscstudio/adminlte/views/site';
         if (!empty($pathMap)) {
             $view->theme = Yii::createObject(['class' => 'yii\\base\\Theme', 'pathMap' => $pathMap]);
         }
     }
 }
Exemplo n.º 9
1
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param \yii\web\Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->set($this->id, $this);
     Yii::$container->set('gromver\\models\\fields\\EditorField', ['controller' => 'grom/media/manager']);
     Yii::$container->set('gromver\\models\\fields\\MediaField', ['controller' => 'grom/media/manager']);
     Yii::$container->set('gromver\\modulequery\\ModuleQuery', ['cache' => $app->cache, 'cacheDependency' => new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()'])]);
     Yii::$container->set('gromver\\platform\\frontend\\components\\MenuMap', ['cache' => $app->cache, 'cacheDependency' => Table::dependency(MenuItem::tableName())]);
     /** @var MenuManager $manager */
     $manager = \Yii::createObject(MenuManager::className());
     $rules = [$manager];
     if (is_array($this->blockModules) && count($this->blockModules)) {
         $rules['grom/<module:(' . implode('|', $this->blockModules) . ')><path:(/.*)?>'] = 'grom/default/page-not-found';
         //блокируем доступ к контент модулям напрямую
     }
     $app->urlManager->addRules($rules, false);
     //вставляем в начало списка
     $app->set('menuManager', $manager);
     ModuleQuery::instance()->implement('\\gromver\\platform\\common\\interfaces\\BootstrapInterface')->invoke('bootstrap', [$app]);
 }
Exemplo n.º 10
1
 public function __construct($config = [])
 {
     parent::__construct($config);
     if (empty($this->siteLangs)) {
         $this->siteLangs = new Language();
     }
     if (empty($this->siteMenu)) {
         $this->siteMenu = new Menu();
     }
 }
Exemplo n.º 11
1
 public function __construct($config)
 {
     parent::__construct($config);
     // Set name from database if not set by config file.
     if (!isset($config['name'])) {
         if ($name = Config::setting('application.name')) {
             $this->name = $name;
         }
     }
     // Set email from database if not set by config file.
     if (!isset(Yii::$app->params['adminEmail'])) {
         Yii::$app->params['adminEmail'] = null;
         if ($email = Config::setting('application.admin.email')) {
             Yii::$app->params['adminEmail'] = $email;
         }
     }
     // Setup options for the user module.
     $user = Yii::$app->getModule('user');
     $user->enableRegistration = Config::setting('user.registration.enabled');
     $user->enableConfirmation = Config::setting('user.registration.confirmation');
     $user->enableUnconfirmedLogin = Config::setting('user.registration.unconfirmed.login');
     $user->enablePasswordRecovery = Config::setting('user.registration.password.recovery');
     $user->rememberFor = Config::setting('user.login.remember.time');
     $user->confirmWithin = Config::setting('user.registration.confirm.time');
     $user->recoverWithin = Config::setting('user.registration.recover.time');
     // Add some event listeners to the app user.
     $appUser = Yii::$app->user;
     $appUser->on($appUser::EVENT_AFTER_LOGIN, function ($e) use($appUser) {
         $class = $appUser->identityClass;
         $class::globalCookieSet($e->duration);
     });
     $appUser->on($appUser::EVENT_AFTER_LOGOUT, function ($e) use($appUser) {
         $class = $appUser->identityClass;
         $class::globalCookieClear();
     });
     $appUserClass = $appUser->identityClass;
     if ($appUser->isGuest) {
         $appUserClass::globalCookieClear();
     } else {
         $appUserClass::globalCookieSet();
     }
 }
Exemplo n.º 12
0
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $urlManager = $app->getUrlManager();
     $urlManager->enablePrettyUrl = true;
     $id = $this->uniqueId;
     $urlManager->addRules([['class' => classes\GroupUrlRule::className(), 'prefix' => $id, 'suffix' => '', 'rules' => ['' => '', 'GET assignment' => 'assignment/index', 'GET assignment/<id>' => 'assignment/view', 'POST assignment/assign/<id>' => 'assignment/assign', 'POST assignment/revoke/<id>' => 'assignment/revoke', 'GET item' => 'item/index', 'GET item/<id>' => 'item/view', 'POST item/assign/<id>' => 'item/add-child', 'POST item/revoke/<id>' => 'item/remove-child', 'PUT item/<id>' => 'item/update', 'POST item' => 'item/create', 'DELETE item/<id>' => 'item/delete', 'GET rule' => 'rule/index', 'GET rule/<id>' => 'rule/view', 'POST rule/<id>' => 'rule/update', 'POST rule' => 'rule/create', 'DELETE rule/<id>' => 'rule/delete', 'GET route' => 'route/index', 'POST route/add' => 'route/add', 'POST route/remove' => 'route/remove', 'GET menu' => 'menu/index', 'GET menu/values' => 'menu/values', 'GET menu/<id>' => 'menu/view', 'POST menu/<id>' => 'menu/update', 'POST menu' => 'menu/create', 'DELETE menu/<id>' => 'menu/delete']]], false);
 }
Exemplo n.º 13
0
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     /* @var $module \marsoltys\yii2user\Module */
     $module = Yii::$app->getModule("user");
     $urlManager = $app->getUrlManager();
     //$urlManager->enablePrettyUrl = true;
     $urlManager->addRules($module->urlRules, true);
     $app->set('user', ['identityClass' => $module->identityClass, 'loginUrl' => $module->loginUrl, 'class' => $module->userClass]);
 }
Exemplo n.º 14
0
 public function testSyncWithConnectAndFailedSyncAction()
 {
     $mockSynchronizer = Mockery::mock($this->mockApp->synchronizer);
     $mockSynchronizer->shouldReceive('isConnected')->andReturnUsing(function ($serviceName = null) {
         return true;
     });
     $mockSynchronizer->shouldReceive('syncService')->andReturnUsing(function ($serviceName = null) {
         return ['flag' => false, 'count' => 0];
     });
     $this->mockApp->set('synchronizer', $mockSynchronizer);
     Yii::$app = $this->mockApp;
     $action = new SyncAction('action', Yii::$app->controller, ['successUrl' => 'http://fakehost/successUrl', 'failedUrl' => 'http://fakehost/failedUrl']);
     $response = $action->runWithParams(['service' => $this->serviceName]);
     $this->assertTrue($response->getIsRedirection());
     $this->assertTrue($response->getHeaders()->get('location') === 'http://fakehost/failedUrl');
 }
Exemplo n.º 15
0
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $mailbox = ArrayHelper::merge($app->getModules()['mailbox'], ['class' => 'hscstudio\\mailbox\\Module']);
     $app->setModule('mailbox', $mailbox);
     if (!empty($app->getModules()['mailbox']['view'])) {
         $view = $app->getView();
         $pathMap = [];
         $pathMap['@hscstudio/mailbox/views/default'] = $app->getModules()['mailbox']['view'];
         if (!empty($pathMap)) {
             $view->theme = Yii::createObject(['class' => 'yii\\base\\Theme', 'pathMap' => $pathMap]);
         }
     }
 }
Exemplo n.º 16
0
 public function init()
 {
     parent::init();
     Common::setTimezone();
 }
Exemplo n.º 17
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param \yii\web\Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->set($this->id, $this);
     Yii::$container->set('gromver\\modulequery\\ModuleQuery', ['cache' => $app->cache, 'cacheDependency' => new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()'])]);
     ModuleQuery::instance()->implement('\\gromver\\platform\\common\\interfaces\\BootstrapInterface')->invoke('bootstrap', [$app]);
 }
Exemplo n.º 18
0
 /**
  * @param \yii\web\Request $request
  * @return \yii\web\Response
  */
 public function handleRequest($request)
 {
     return $this->handleRedirectRequest($request) ?: parent::handleRequest($request);
 }
Exemplo n.º 19
0
 public function coreComponents()
 {
     return array_merge(parent::coreComponents(), ['multiDomainsManager' => ['class' => 'vistart\\components\\web\\MultiDomainsManager'], 'user' => ['class' => 'vistart\\components\\web\\SSOUser']]);
 }
Exemplo n.º 20
0
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $view = $app->getView();
     AdminLtePluginAsset::register($view);
 }
Exemplo n.º 21
0
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $app->attachBehavior(AccessControl::className(), new AccessControl(['allowActions' => $this->allowActions]));
 }
Exemplo n.º 22
0
 public function init()
 {
     parent::init();
     $this->name = self::getSiteName();
 }
Exemplo n.º 23
0
<?php

/**
 * Entry point to frontend application
 */
use yii\web\Application;
$rootDir = dirname(__DIR__);
$appDir = $rootDir . '/app';
// include environment constants
include_once $appDir . '/config/env.php';
// include vendors autoload
include $rootDir . '/vendor/autoload.php';
// include yii2 application manually
include $rootDir . '/vendor/yiisoft/yii2/Yii.php';
// get frontend configuration
$config = (include $appDir . '/config/frontend.php');
// run application
$application = new Application($config);
$application->run();
Exemplo n.º 24
0
 public function init()
 {
     parent::init();
     $this->setLayoutPath("{$this->getViewPath()}/_layouts");
 }
Exemplo n.º 25
-1
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $urlManager = $app->getUrlManager();
     $urlManager->enablePrettyUrl = true;
     $id = $this->uniqueId;
     $urlManager->addRules([$id => $id . '/default/index', 'GET ' . $id . '/assignment' => $id . '/assignment/index', 'GET ' . $id . '/assignment/<id>' => $id . '/assignment/view', 'POST ' . $id . '/assignment/assign/<id>' => $id . '/assignment/assign', 'POST ' . $id . '/assignment/revoke/<id>' => $id . '/assignment/revoke', 'GET ' . $id . '/item' => $id . '/item/index', 'GET ' . $id . '/item/<id>' => $id . '/item/view', 'POST ' . $id . '/item/assign/<id>' => $id . '/item/add-child', 'POST ' . $id . '/item/revoke/<id>' => $id . '/item/remove-child', 'PUT ' . $id . '/item/<id>' => $id . '/item/update', 'POST ' . $id . '/item' => $id . '/item/create', 'DELETE ' . $id . '/item/<id>' => $id . '/item/delete', 'GET ' . $id . '/rule' => $id . '/rule/index', 'GET ' . $id . '/rule/<id>' => $id . '/rule/view', 'POST ' . $id . '/rule/<id>' => $id . '/rule/update', 'POST ' . $id . '/rule' => $id . '/rule/create', 'DELETE ' . $id . '/rule/<id>' => $id . '/rule/delete', 'GET ' . $id . '/route' => $id . '/route/index', 'POST ' . $id . '/route/add' => $id . '/route/add', 'POST ' . $id . '/route/remove' => $id . '/route/remove', 'GET ' . $id . '/menu' => $id . '/menu/index', 'GET ' . $id . '/menu/values' => $id . '/menu/values', 'GET ' . $id . '/menu/<id>' => $id . '/menu/view', 'POST ' . $id . '/menu/<id>' => $id . '/menu/update', 'POST ' . $id . '/menu' => $id . '/menu/create', 'DELETE ' . $id . '/menu/<id>' => $id . '/menu/delete'], false);
 }
Exemplo n.º 26
-1
 public function run()
 {
     $modules = array_keys($this->getModules());
     foreach ($modules as $moduleName) {
         $moduleSettings = (array) $this->modules[$moduleName];
         if (isset($moduleSettings['autoload']) && $moduleSettings['autoload'] === 1) {
             \Yii::$app->getModule($moduleName);
         }
     }
     return parent::run();
 }
Exemplo n.º 27
-1
 public function __construct(array $config = [])
 {
     Yii::setAlias('system', __DIR__);
     Yii::setAlias('admin', dirname(__DIR__) . '/admin');
     $this->initPluginManager($config);
     $haloConfig = (require __DIR__ . '/config/haloconfig.php');
     $cfg = ArrayHelper::merge($haloConfig, $this->loadPluginConfigs('/config.php'), $config);
     $file = $cfg['vendorPath'] . '/yiisoft/extensions.php';
     $extensions = is_file($file) ? include $file : [];
     if (isset($cfg['extensions']) && is_array($cfg['extensions'])) {
         $cfg['extensions'] = ArrayHelper::merge($extensions, $cfg['extensions']);
     } else {
         $cfg['extensions'] = $extensions;
     }
     parent::__construct($cfg);
 }
Exemplo n.º 28
-1
 public function createController($route)
 {
     // find whether multisite is enabled
     if (Yii::$app->cmgCore->multiSite) {
         if ($route === '') {
             $route = $this->defaultRoute;
         }
         // double slashes or leading/ending slashes may cause substr problem
         $route = trim($route, '/');
         if (strpos($route, '//') !== false) {
             return false;
         }
         // Sub-Directory
         if (Yii::$app->cmgCore->subDirectory) {
             if (strpos($route, '/') !== false) {
                 list($site, $siteRoute) = explode('/', $route, 2);
                 // Find Site
                 $site = SiteService::findBySlug($site);
                 // Site Found
                 if (isset($site)) {
                     // Configure Current Site
                     Yii::$app->cmgCore->siteId = $site->id;
                     Yii::$app->cmgCore->siteName = $site->name;
                     Yii::$app->cmgCore->siteSlug = $site->slug;
                     Yii::$app->urlManager->baseUrl = Yii::$app->urlManager->baseUrl . "/" . $site->name;
                     return parent::createController($siteRoute);
                 }
             }
         } else {
             // Find Site
             $siteName = array_shift(explode(".", $_SERVER['HTTP_HOST']));
             if (!isset($siteName) || strcmp($siteName, 'www') == 0) {
                 $siteName = 'main';
             }
             $site = SiteService::findBySlug($siteName);
             // Site Found
             if (isset($site)) {
                 // Configure Current Site
                 Yii::$app->cmgCore->siteId = $site->id;
                 Yii::$app->cmgCore->siteName = $site->name;
                 Yii::$app->cmgCore->siteSlug = $site->slug;
                 return parent::createController($route);
             }
         }
     }
     return parent::createController($route);
 }
Exemplo n.º 29
-1
 public function testParseRESTRequest()
 {
     $request = new Request();
     // pretty URL rules
     $manager = new UrlManager(['enablePrettyUrl' => true, 'showScriptName' => false, 'cache' => null, 'rules' => ['PUT,POST post/<id>/<title>' => 'post/create', 'DELETE post/<id>' => 'post/delete', 'post/<id>/<title>' => 'post/view', 'POST/GET' => 'post/get']]);
     // matching pathinfo GET request
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $request->pathInfo = 'post/123/this+is+sample';
     $result = $manager->parseRequest($request);
     $this->assertEquals(['post/view', ['id' => '123', 'title' => 'this+is+sample']], $result);
     // matching pathinfo PUT/POST request
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $request->pathInfo = 'post/123/this+is+sample';
     $result = $manager->parseRequest($request);
     $this->assertEquals(['post/create', ['id' => '123', 'title' => 'this+is+sample']], $result);
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $request->pathInfo = 'post/123/this+is+sample';
     $result = $manager->parseRequest($request);
     $this->assertEquals(['post/create', ['id' => '123', 'title' => 'this+is+sample']], $result);
     // no wrong matching
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $request->pathInfo = 'POST/GET';
     $result = $manager->parseRequest($request);
     $this->assertEquals(['post/get', []], $result);
     // createUrl should ignore REST rules
     $this->mockApplication(['components' => ['request' => ['hostInfo' => 'http://localhost/', 'baseUrl' => '/app']]], \yii\web\Application::className());
     $this->assertEquals('/app/post/delete?id=123', $manager->createUrl(['post/delete', 'id' => 123]));
     $this->destroyApplication();
     unset($_SERVER['REQUEST_METHOD']);
 }
Exemplo n.º 30
-1
    /**
     * 
     * @param \yii\web\Application $app
     */
    public function bootstrap($app)
    {
        $app->set('view', ['class' => 'yii\\web\\View', 'theme' => ['pathMap' => ['' => '']]]);
        $view = $app->getView();
        $pathMap = [];
        if (!isset($this->features['datecontrol'])) {
            $this->features['datecontrol'] = true;
        }
        if ($this->features['datecontrol'] != false) {
            $app->setModules(['datecontrol' => ['class' => '\\kartik\\datecontrol\\Module', 'displaySettings' => [\kartik\datecontrol\Module::FORMAT_DATE => 'dd-MM-yyyy', \kartik\datecontrol\Module::FORMAT_TIME => 'HH:mm:ss', \kartik\datecontrol\Module::FORMAT_DATETIME => 'dd-MM-yyyy HH:mm:ss'], 'saveSettings' => [\kartik\datecontrol\Module::FORMAT_DATE => 'php:Y-m-d', \kartik\datecontrol\Module::FORMAT_TIME => 'php:H:i:s', \kartik\datecontrol\Module::FORMAT_DATETIME => 'php:Y-m-d H:i:s'], 'autoWidget' => true, 'autoWidgetSettings' => [\kartik\datecontrol\Module::FORMAT_DATE => ['pluginOptions' => ['autoclose' => true]], \kartik\datecontrol\Module::FORMAT_DATETIME => ['pluginOptions' => ['autoclose' => true]], \kartik\datecontrol\Module::FORMAT_TIME => ['pluginOptions' => ['autoclose' => true]]]]]);
            Yii::$container->set('kartik\\datecontrol\\DateControl', ['ajaxConversion' => false]);
        }
        if (!isset($this->features['gridview'])) {
            $this->features['gridview'] = true;
        }
        if ($this->features['gridview'] != false) {
            $app->setModules(['gridview' => ['class' => '\\kartik\\grid\\Module']]);
        }
        if (!isset($this->features['gii'])) {
            $this->features['gii'] = true;
        }
        if ($this->features['gii'] != false) {
            $app->setModules(['gii' => ['class' => 'yii\\gii\\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'], 'generators' => ['crud' => ['class' => 'hscstudio\\heart\\modules\\gii\\crud\\Generator', 'templates' => ['my' => '@hscstudio/heart/modules/gii/crud/default']]]]]);
        }
        if (!isset($this->features['privilege'])) {
            $this->features['privilege'] = true;
        }
        if ($this->features['privilege'] != false) {
            $authManager = ArrayHelper::remove($this->features['privilege'], 'authManager', ['class' => 'yii\\rbac\\DbManager']);
            $allowActions = ArrayHelper::remove($this->features['privilege'], 'allowActions', ['debug/*', 'site/*', 'gii/*', 'privilege/*', 'gridview/*']);
            $app->set('authManager', $authManager);
            $app->setModule('privilege', array_merge(['class' => '\\mdm\\admin\\Module', 'layout' => '@hscstudio/heart/views/layouts/column2'], $this->features['privilege']));
            $app->attachBehavior('access', ['class' => '\\mdm\\admin\\components\\AccessControl', 'allowActions' => $allowActions]);
            //$app->getModule('privilege')->bootstrap($app);
            /* $pathMap['@mdm/admin/views'] = '@hscstudio/heart/modules/admin/views'; */
        }
        $pathMap['@app/views/layouts'] = '@hscstudio/heart/views/layouts';
        if (!empty($pathMap)) {
            $view->theme = Yii::createObject(['class' => 'yii\\base\\Theme', 'pathMap' => $pathMap]);
        }
        $assets = $view->assetManager->publish('@hscstudio/heart/assets/heart');
        $view->registerCssFile($assets[1] . '/css/heart.css', ['depends' => [BootstrapAsset::className()]], 'css-heart');
        $view->registerCssFile($assets[1] . '/css/metroui.css', ['depends' => [BootstrapAsset::className()]], 'css-metroui');
        $view->registerCssFile($assets[1] . '/css/family-tree.css', ['depends' => [BootstrapAsset::className()]], 'css-family-tree');
        $view->registerJsFile($assets[1] . '/js/heart.js', ['depends' => [BootstrapPluginAsset::className()]]);
        $css = '
		.overlay, .loading-img {
			  position: fixed;
			  top: 0;
			  left: 0;
			  width: 100%;
			  height: 100%;
		}
		
		.overlay {
		  z-index: 1010;
		  background: rgba(255, 255, 255, 0.7);
		}
		
		.overlay.dark {
		  background: rgba(0, 0, 0, 0.5);
		}
		
		.loading-img {
		  z-index: 1020;
		  background: transparent url("' . $assets[1] . '/img/ajax-loader1.gif") 50% 20% no-repeat;
		}
		
		.bootstrap-switch {
			min-width:125px !important;
		}
		';
        $view->registerCss($css);
        $view->registerJsFile($assets[1] . '/js/bootstrap-growl.min.js', ['depends' => [BootstrapPluginAsset::className()]]);
        \yii\base\Event::on('yii\\web\\Controller', 'beforeAction', function ($event) {
            if ($event->sender->uniqueId == 'site') {
                $event->sender->layout = 'column1';
            }
        });
    }