Esempio n. 1
0
 protected function setupRouter()
 {
     if (Environment::isProduction() && isset($this->cache['router'])) {
         $this->setRouter($this->cache['router']);
     } else {
         //          SiteRoute::initialize();
         $router = $this->getRouter();
         // pripojim routy z bootstrapu
         foreach ($this->routes as $route) {
             $router[] = $route;
         }
         // Homepage
         $router[] = new Route('index.php', array('module' => 'Front', 'presenter' => 'Files', 'action' => 'list'), Route::ONE_WAY);
         // Modules routes
         //                foreach ($this->modules as $module)
         //                    $module->setupRouter($router);
         if (is_callable(array('AdminModule', 'createRoutes'))) {
             AdminModule::createRoutes($router);
         }
         FrontModule::createRoutes($router);
         // setups routes for submodules
         /**
          * Default route, match only 
          * 	Simple Front module presenters
          * 	Simple Admin module presenters
          */
         $router[] = new Route('[<lang [a-z]{2}>/]<module Front|Admin>/<presenter>/<action>/<id>', array('module' => 'Front', 'presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
         $this->cache->save('router', $router);
     }
 }