Example #1
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');
 }
Example #2
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]);
         }
     }
 }
 /**
  * 
  * @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]);
         }
     }
 }
 /**
  * 
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $view = $app->getView();
     AdminLtePluginAsset::register($view);
 }
Example #5
0
 /**
  * Hooks into the running Yii application by registering various event handlers.
  * Registers event handlers for searches in Big.
  * Is called at the end of the boostrapping process.
  *
  * @param yii\web\Application $app the application currently running.
  */
 public function registerApplicationHooks($app)
 {
     $app->getView()->on(View::EVENT_BEGIN_PAGE, function ($event) {
         // render blocks if the active theme has positions enabled
         $positions = $this->getActiveThemePositions();
         if (!empty($positions)) {
             $this->renderBlocks($positions);
         }
         // set the page title (if not set by a Block) when a layout starts to render.
         $view = $event->sender;
         $menu = $this->menuManager->getActive();
         if (empty($view->title) && $menu) {
             $view->title = empty($menu->meta_title) ? $menu->title : $menu->meta_title;
         }
     });
     if ($this->enableDynamicContent) {
         // register event handler that parses the application response
         $app->on(Application::EVENT_AFTER_REQUEST, [$this, 'parseResponse']);
     }
 }
Example #6
-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';
            }
        });
    }