Exemple #1
0
 public function afterInitialization()
 {
     parent::afterInitialization();
     $this->container->dispatcher->addListener('publiccontroller.render.before', function ($event) {
         $page = $event->getParams()->pageData['pageData'];
         if ($page instanceof \App\Models\Sections) {
             $path = $page->path;
             $url = $event->getContainer()->router->pathFor('page.s' . $page->id);
         }
         if ($page instanceof \App\Models\Pages && $page->category_id > 0) {
             $path = ModelsFactory::getModel('sections')->find($page->category_id)['path'];
             $path .= $page->category_id;
             $url = $event->getContainer()->router->pathFor('page.sp' . $page->category_id, ['pageCode' => $page->code]);
         }
         if ($page instanceof \App\Models\Pages && $page->category_id <= 0) {
             $path = '0' . \App\Models\Sections::PATH_DELIMITER;
             //$url = $event->getContainer()->router->pathFor('page.'.$page->id);
         }
         $bc = new BreadcrumbsBuilder($path);
         if (true) {
             $bc->parsePath()->addLastItem($url, $page->name);
         }
         $event->getParams()->pageData['breadcrumbs'] = $bc;
     });
 }
 public function afterInitialization()
 {
     parent::afterInitialization();
     $this->container->dispatcher->addListener('middleware.itemparpage.after', function ($event) {
         $page = new LastPagePaginatorMiddleware($event->getContainer());
         $page->setOption(1, $event->getParams()['allParams']);
     });
 }
Exemple #3
0
 public function afterInitialization()
 {
     parent::afterInitialization();
     $this->menuCreator();
     $this->container->dispatcher->addListener('app.beforeRun', function ($event) {
         PageRouteCollection::register($event->getApp());
     }, 2000);
 }
 public function afterInitialization()
 {
     parent::afterInitialization();
     $this->adminPanelMenuRegister();
     $this->container->dispatcher->addListener('app.beforeRun', function ($event) {
         $event->getApp()->group('/admin', function () {
             AdminRouteCollection::register($this);
         })->add(new AuthMiddleware());
     }, -980);
 }
Exemple #5
0
 public function afterInitialization()
 {
     parent::afterInitialization();
     $this->adminPanelRouteRegister();
     $this->menuCreator();
     $this->container->dispatcher->addListener('basecontroller.render.before', function ($event) {
         $arItems = $this->findFieldValues($event);
         if (!$arItems) {
             return true;
         }
         $model = ModelsFactory::getModel('sections');
         $arRes = $model->where('active', 1)->get();
         $data = [];
         foreach ($arRes as $item) {
             if (($arItems['parent_id'] || null === $arItems['parent_id']) && $item->id != $event->getParams()['fieldsValues']->id) {
                 $data[$item->id] = $item->name;
             }
         }
         foreach ($arItems as $name => $values) {
             $event->getParams()['ttt'][$name]->values = $values + $data;
         }
     });
 }
Exemple #6
0
 /**
  * After initialization method and register (DI, Route, Middleware)
  */
 public function afterInitialization()
 {
     parent::afterInitialization();
     $config = $this->getConfig();
     if (!isset($config->microInit) || in_array('all', $config->microInit)) {
         foreach ($this->arModulesName as $moduleName) {
             $cl = "Modules\\Core\\Source\\MicroModules\\" . $moduleName;
             $this->initMicroModule(new $cl());
         }
     }
     /*
             $module = new AdminPanelModule();
             if( Session::get('auth') ){
                 $this->initMicroModule($module);
                 $this->initMicroModule(new CustomizerAdminPanelModule());
             } else {
                 $module->beforeInitialization();
                 $module->registerRoute();
             }*/
     if (isset($this->container['settings']['protect_double_route_register']) && $this->container['settings']['protect_double_route_register']) {
         $this->routerControlSystem();
     }
 }
Exemple #7
0
 public function afterInitialization()
 {
     parent::afterInitialization();
 }