/**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['fixture-generator'])) {
             $app->getModule('gii')->generators['fixture-generator'] = ['class' => __NAMESPACE__ . '\\FixtureGenerator'];
         }
     }
 }
示例#2
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['migen'])) {
             $app->getModule('gii')->generators['migen'] = 'sirroland\\migen\\gii\\Generator';
         }
     }
 }
示例#3
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['migrik'])) {
             $app->getModule('gii')->generators['migrik'] = 'insolita\\migrik\\gii\\Generator';
         }
     }
 }
示例#4
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['doubleModel'])) {
             $app->getModule('gii')->generators['doubleModel'] = 'claudejanz\\mygii\\generators\\model\\Generator';
         }
     }
 }
示例#5
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['fixturegii'])) {
             $app->getModule('gii')->generators['fixturegii'] = 'insolita\\fixturegii\\gii\\FixtureTemplateGenerator';
         }
     }
 }
示例#6
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['ajaxcrud'])) {
             $app->getModule('gii')->generators['ajaxcrud'] = 'johnitvn\\ajaxcrud\\generators\\Generator';
         }
     }
 }
示例#7
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['hii-model'])) {
             $app->getModule('gii')->generators['hii-model'] = 'grzegorzpierzakowski\\hii\\model\\Generator';
         }
     }
 }
示例#8
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['enhanced-gii'])) {
             $app->getModule('gii')->generators['enhanced-gii-model'] = 'mootensai\\enhancedgii\\model\\Generator';
             $app->getModule('gii')->generators['enhanced-gii-crud'] = 'mootensai\\enhancedgii\\crud\\Generator';
         }
     }
 }
示例#9
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['singletonn-gii'])) {
             $app->getModule('gii')->generators['singletonn-gii-model'] = 'singletonn\\gii\\model\\Generator';
             $app->getModule('gii')->generators['singletonn-gii-crud'] = 'singletonn\\gii\\crud\\Generator';
         }
     }
 }
示例#10
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         $app->getModule('gii')->generators['giiant-model'] = 'pafnow\\giiant\\model\\Generator';
         $app->getModule('gii')->generators['giiant-crud'] = 'pafnow\\giiant\\crud\\Generator';
         if ($app instanceof \yii\console\Application) {
             $app->controllerMap['giiant-batch'] = 'pafnow\\giiant\\commands\\BatchController';
         }
     }
 }
示例#11
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     Yii::setAlias("@ajaxcrud", __DIR__);
     Yii::setAlias("@johnitvn/ajaxcrud", __DIR__);
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['ajaxcrud'])) {
             $app->getModule('gii')->generators['ajaxcrud'] = 'johnitvn\\ajaxcrud\\generators\\Generator';
         }
     }
 }
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['giiant-crud']['templates']['twig'])) {
             $app->getModule('gii')->generators['giiant-crud'] = ['class' => 'schmunk42\\giiant\\crud\\Generator', 'templates' => ['twig' => '@vendor/esquire900/yii2-giiant-twig/crud']];
         }
         if ($app instanceof \yii\console\Application) {
             $app->controllerMap['giiant-twig'] = 'esquire900\\giianttwig\\commands\\ConvertController';
         }
     }
 }
示例#13
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['giix-model'])) {
             $app->getModule('gii')->generators['giix-model'] = 'veyselsahin\\giix\\model\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giix-crud'])) {
             $app->getModule('gii')->generators['giix-crud'] = 'veyselsahin\\giix\\crud\\Generator';
         }
         if ($app instanceof \yii\console\Application) {
             $app->controllerMap['giix-batch'] = 'veyselsahin\\giix\\commands\\BatchController';
         }
     }
 }
示例#14
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     //        \Yii::setAlias('@mtengii','@vendor/mootensai/yii2-enhanced-gii');
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['enhanced-gii'])) {
             $app->getModule('gii')->generators['enhanced-gii-model'] = 'mootensai\\enhancedgii\\model\\Generator';
             $app->getModule('gii')->generators['enhanced-gii-crud']['class'] = 'mootensai\\enhancedgii\\crud\\Generator';
             //                $app->getModule('gii')->generators['enhanced-gii-crud']['templates'] = [
             //                    'default' => '@mtengii/crud/default',
             //                    'nested' => '@mtengii/crud/nested'
             //                ];
             $app->getModule('gii')->generators['enhanced-gii-migration'] = 'mootensai\\enhancedgii\\migration\\Generator';
         }
     }
 }
示例#15
0
 /**
  * Rook gii templates
  *
  * @param Application $app the application currently running
  * @return array
  */
 public function registryGenerators($app)
 {
     $gii = $app->getModule('gii');
     if (!is_null($gii)) {
         $gii->generators = ArrayHelper::merge($gii->generators, ['model' => ['class' => \yii\gii\generators\model\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/model/skeleton']], 'crud' => ['class' => \yii\gii\generators\crud\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/crud/skeleton']], 'controller' => ['class' => \yii\gii\generators\controller\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/controller/skeleton']], 'form' => ['class' => \yii\gii\generators\form\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/form/skeleton']], 'module' => ['class' => \skeleton\gii\generators\module\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/module/skeleton']], 'extension' => ['class' => \yii\gii\generators\extension\Generator::class, 'templates' => ['skeleton' => '@skeleton/gii/generators/extension/skeleton']]]);
     }
 }
示例#16
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     /** @var Module $module */
     /** @var \yii\db\ActiveRecord $modelName */
     if ($app->hasModule('activeuser') && ($module = $app->getModule('activeuser')) instanceof Module) {
         $this->_modelMap = array_merge($this->_modelMap, $module->modelMap);
         foreach ($this->_modelMap as $name => $definition) {
             $class = "inblank\\activeuser\\models\\" . $name;
             Yii::$container->set($class, $definition);
             $modelName = is_array($definition) ? $definition['class'] : $definition;
             $module->modelMap[$name] = $modelName;
         }
         if ($app instanceof ConsoleApplication) {
             $app->controllerMap['activeuser'] = ['class' => 'inblank\\activeuser\\commands\\DefaultController'];
         } else {
             // init user
             Yii::$container->set('yii\\web\\User', ['loginUrl' => ['/activeuser/account/login'], 'identityClass' => self::di('User')]);
             $configUrlRule = ['prefix' => $module->urlPrefix, 'rules' => defined('IS_BACKEND') ? $module->urlRulesBackend : $module->urlRulesFrontend];
             if ($module->urlPrefix != 'activeuser') {
                 $configUrlRule['routePrefix'] = 'activeuser';
             }
             $app->urlManager->addRules([new GroupUrlRule($configUrlRule)], false);
             if (defined('IS_BACKEND')) {
                 // is backend, and controller have other namespace
                 $module->controllerNamespace = 'inblank\\activeuser\\controllers\\backend';
                 $module->frontendUrlManager = new yii\web\UrlManager(['baseUrl' => '/', 'enablePrettyUrl' => true, 'showScriptName' => false]);
                 $configUrlRule['rules'] = $module->urlRulesFrontend;
                 $module->frontendUrlManager->addRules([new GroupUrlRule($configUrlRule)], false);
             }
         }
         if (!isset($app->get('i18n')->translations['activeuser*'])) {
             $app->get('i18n')->translations['activeuser*'] = ['class' => PhpMessageSource::className(), 'basePath' => __DIR__ . '/messages'];
         }
     }
 }
示例#17
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     /**
      * @var Module $gii
      */
     \Yii::setAlias('@carono', '@vendor/carono/yii2-components');
     if ($app instanceof \yii\console\Application) {
         $commands = ['city' => 'CityController', 'currency' => 'CurrencyController', 'dumper' => 'DumperController', 'carono' => 'CaronoController'];
         foreach ($commands as $name => $command) {
             $name = file_exists(\Yii::getAlias("@app/commands/{$command}.php")) ? "carono" . ucfirst($name) : $name;
             $app->controllerMap[$name] = 'carono\\components\\commands\\' . $command;
         }
         if (!isset($app->controllerMap['giix'])) {
             if (($gii = $app->getModule('gii')) && isset($gii->generators["giiant-model"])) {
                 if (!isset($gii->generators["giiant-model"]["templates"])) {
                     if (is_array($gii->generators["giiant-model"])) {
                         $gii->generators["giiant-model"]["templates"] = [];
                     } else {
                         $gii->generators["giiant-model"] = ["class" => 'schmunk42\\giiant\\generators\\model\\Generator', "templates" => []];
                     }
                 }
                 $template = '@vendor/carono/yii2-components/templates/giiant-model';
                 $gii->generators["giiant-model"]["templates"]["caronoModel"] = $template;
                 $app->controllerMap['giix'] = 'carono\\components\\commands\\GiixController';
             }
         }
     }
 }
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     /**@var Module $gii */
     if ($app->hasModule('gii') && ($gii = $app->getModule('gii'))) {
         if (!isset($gii->generators['migration'])) {
             $gii->generators['migration'] = 'navatech\\migration\\gii\\Generator';
         }
     }
 }
示例#19
0
 /**
  * @return array
  */
 protected function getAuthItemsFromModules()
 {
     $modules = $this->app->getModules();
     $authItems = [];
     foreach ($modules as $id => $config) {
         $module = $this->app->getModule($id);
         if (!$module instanceof Module) {
             continue;
         }
         $authItems = array_merge($authItems, $module->getAuthItems());
     }
     return $authItems;
 }
示例#20
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['giiant-model'])) {
             $app->getModule('gii')->generators['giiant-model'] = 'schmunk42\\giiant\\generators\\model\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-extension'])) {
             $app->getModule('gii')->generators['giiant-extension'] = 'schmunk42\\giiant\\generators\\extension\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-crud'])) {
             $app->getModule('gii')->generators['giiant-crud'] = ['class' => 'schmunk42\\giiant\\generators\\crud\\Generator', 'templates' => ['editable' => __DIR__ . '/generators/crud/editable']];
         }
         if (!isset($app->getModule('gii')->generators['giiant-module'])) {
             $app->getModule('gii')->generators['giiant-module'] = 'schmunk42\\giiant\\generators\\module\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-test'])) {
             $app->getModule('gii')->generators['giiant-test'] = 'schmunk42\\giiant\\generators\\test\\Generator';
         }
         if ($app instanceof \yii\console\Application) {
             $app->controllerMap['giiant-batch'] = 'schmunk42\\giiant\\commands\\BatchController';
         }
     }
 }
示例#21
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app instanceof WebApplication) {
     }
     if ($app instanceof ConsoleApplication) {
         $app->controllerMap['module'] = ['class' => 'nullref\\core\\console\\ModuleController'];
         $app->controllerMap['modules-migrate'] = ['class' => 'nullref\\core\\console\\ModulesMigrateController'];
         $app->controllerMap['env'] = ['class' => 'nullref\\core\\console\\EnvController'];
         $app->getModule('core')->controllerMap['migrate'] = ['class' => 'nullref\\core\\console\\MigrateController'];
     }
     if (YII_ENV_DEV && class_exists('yii\\gii\\Module')) {
         Event::on(Gii::className(), Gii::EVENT_BEFORE_ACTION, function (Event $event) {
             /** @var Gii $gii */
             $gii = $event->sender;
             $gii->generators['relation-migration'] = ['class' => 'nullref\\core\\generators\\migration\\Generator'];
         });
     }
 }
示例#22
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         if (!isset($app->getModule('gii')->generators['giiant-model'])) {
             $app->getModule('gii')->generators['giiant-model'] = 'schmunk42\\giiant\\generators\\model\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-crud'])) {
             $app->getModule('gii')->generators['giiant-crud'] = 'schmunk42\\giiant\\generators\\crud\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-module'])) {
             $app->getModule('gii')->generators['giiant-module'] = 'schmunk42\\giiant\\generators\\module\\Generator';
         }
         if (!isset($app->getModule('gii')->generators['giiant-test'])) {
             $app->getModule('gii')->generators['giiant-test'] = 'schmunk42\\giiant\\generators\\test\\Generator';
         }
         if ($app instanceof \yii\console\Application) {
             $app->controllerMap['giiant-batch'] = 'schmunk42\\giiant\\commands\\BatchController';
         }
     }
 }
示例#23
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $module = $app->getModule('product');
     $class = Product::className();
     $definition = $class;
     /** @var Module $module */
     if ($module !== null && !empty($module->productModel)) {
         $definition = $module->productModel;
     }
     \Yii::$container->set($class, $definition);
     $className = is_array($definition) ? $definition['class'] : $definition;
     \Yii::$container->set(ProductQuery::className(), function () use($className) {
         return $className::find();
     });
     Event::on(ProductQuery::className(), ProductQuery::EVENT_INIT, function (Event $e) use($class, $className) {
         if ($e->sender->modelClass == $class) {
             $e->sender->modelClass = $className;
         }
     });
 }
示例#24
0
 /**
  * Set modules.
  *
  * @param Application $app the application currently running
  */
 protected function setModule($app)
 {
     foreach (Module::getActiveModules() as $module) {
         // Get module backend config.
         if ($config = $module->getBackendConfig()) {
             // Set module.
             $app->setModules([$module->name => $config]);
             // Merge application params with exist module params.
             if (is_file($module->getParamPath())) {
                 $params = (require $module->getParamPath());
                 if ($backendParams = ArrayHelper::getValue($params, 'backend')) {
                     $app->params = ArrayHelper::merge($app->params, $backendParams);
                 }
             }
             // Bootstrap injection.
             if ($module->backend_bootstrap) {
                 $component = $app->getModule($module->name);
                 if ($component instanceof BootstrapInterface) {
                     $component->bootstrap($app);
                 }
             }
         }
     }
 }
示例#25
0
 /**
  * Set modules.
  *
  * @param Application $app the application currently running
  */
 protected function setModule($app)
 {
     foreach (Module::getActiveModules() as $module) {
         // Get module backend config.
         if ($moduleConfig = $module->backendConfig) {
             // Set module.
             $app->setModules([$module->module_name => $moduleConfig]);
             // Merge application params with exist module params.
             if (is_file($module->paramPath)) {
                 $moduleParam = (require $module->paramPath);
                 if (isset($moduleParam['backend'])) {
                     $app->params = ArrayHelper::merge($app->params, $moduleParam['backend']);
                 }
             }
             // Bootstrap injection.
             if ($module->module_fb) {
                 $component = $app->getModule($module->module_name);
                 if ($component instanceof BootstrapInterface) {
                     $component->bootstrap($app);
                 }
             }
         }
     }
 }
示例#26
0
 /**
  * Verifies that nemmo\attachments module is installed and configured.
  * @param  Application $app
  * @return bool
  */
 protected function checkAttachmentsModuleInstalled(Application $app)
 {
     return $app->hasModule('attachments') && $app->getModule('attachments') instanceof \nemmo\attachments\Module;
 }
示例#27
0
 /**
  * @param string $id
  * @param bool $load
  * @return null|\wanhunet\base\Module
  */
 public function getModule($id, $load = true)
 {
     return parent::getModule($id, $load);
 }
示例#28
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     /** @var Module $module */
     if (($module = $app->getModule('admin')) == null || !$module instanceof Module) {
         return;
     }
     $class = 'nullref\\admin\\models\\Admin';
     $definition = $module->adminModel;
     if ($module->enableRbac) {
         $module->setComponents(['authManager' => $module->authManager, 'roleContainer' => $module->roleContainer]);
     }
     Yii::$container->set($class, $definition);
     $className = is_array($definition) ? $definition['class'] : $definition;
     Event::on(AdminQuery::className(), AdminQuery::EVENT_INIT, function (Event $e) use($class, $className) {
         if ($e->sender->modelClass == $class) {
             $e->sender->modelClass = $className;
         }
     });
     /** I18n */
     if (!isset($app->get('i18n')->translations['admin*'])) {
         $app->i18n->translations['admin*'] = ['class' => PhpMessageSource::className(), 'basePath' => '@nullref/admin/messages'];
     }
     if ($app instanceof WebApplication) {
         Yii::$app->setComponents(['admin' => ['class' => 'nullref\\admin\\components\\User', 'identityClass' => $className, 'loginUrl' => ['admin/login']]]);
         $app->urlManager->addRules(['/admin/login' => '/admin/main/login']);
         $app->urlManager->addRules(['/admin/logout' => '/admin/main/logout']);
         Event::on(BaseModule::className(), BaseModule::EVENT_BEFORE_ACTION, function () use($module) {
             if (Yii::$app->controller instanceof IAdminController) {
                 /** @var Controller $controller */
                 $controller = Yii::$app->controller;
                 $controller->layout = $module->layout;
                 if ($controller->module != $module) {
                     $controller->module->setLayoutPath($module->getLayoutPath());
                 }
                 if (!isset($controller->behaviors()['access'])) {
                     $controller->attachBehavior('access', AccessControl::className());
                 }
                 Yii::$app->errorHandler->errorAction = $module->errorAction;
             }
         });
     } elseif ($app instanceof ConsoleApplication) {
         if ($module !== null) {
             /** @var Module $module */
             if ($module->enableRbac) {
                 $module->controllerMap['rbac'] = ['class' => 'nullref\\admin\\console\\RbacController'];
             }
         }
     }
     Event::on(Module::className(), Module::EVENT_BEFORE_INIT, function (Event $event) use($app) {
         $module = $event->sender;
         /** @var Module $module */
         if ($module->enableRbac) {
             if ($app instanceof ConsoleApplication) {
                 $module->controllerMap['rbac'] = ['class' => 'nullref\\admin\\console\\RbacController'];
             }
             $module->setComponents(['authManager' => $module->authManager, 'roleContainer' => $module->roleContainer]);
         }
     });
     if (YII_ENV_DEV && class_exists('yii\\gii\\Module')) {
         Event::on(Gii::className(), Gii::EVENT_BEFORE_ACTION, function (Event $event) {
             /** @var Gii $gii */
             $gii = $event->sender;
             $gii->generators['crud'] = ['class' => 'yii\\gii\\generators\\crud\\Generator', 'templates' => ['admin-crud' => '@nullref/admin/generators/crud/admin']];
             $gii->generators['stuff'] = ['class' => 'nullref\\admin\\generators\\stuff\\Generator', 'templates' => ['default' => '@nullref/admin/generators/stuff/default']];
         });
     }
 }
示例#29
0
 /**
  * Verifies that matacms/matacms-user is installed and configured.
  * @param  Application $app
  * @return bool
  */
 protected function checkUserModuleInstalled(Application $app)
 {
     return $app->hasModule('user') && $app->getModule('user') instanceof UserModule;
 }
示例#30
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app->hasModule('gii')) {
         $app->getModule('gii')->generators['magicscopes'] = 'phpshko\\magicscopes\\gii\\model\\Generator';
     }
 }