/** * Add routes for static content and any route added via {@link addRoute()} to the route chain * * @return $this */ protected function registerRoutes() { $router = $this->app->getFrontController()->getRouter(); // TODO: We should not be required to do this. Please check dispatch() $this->app->getfrontController()->addControllerDirectory($this->getControllerDir(), $this->getName()); /** @var \Zend_Controller_Router_Rewrite $router */ foreach ($this->routes as $name => $route) { $router->addRoute($name, $route); } $router->addRoute($this->name . '_jsprovider', new Zend_Controller_Router_Route('js/' . $this->name . '/:file', array('action' => 'javascript', 'controller' => 'static', 'module' => 'default', 'module_name' => $this->name))); $router->addRoute($this->name . '_img', new Zend_Controller_Router_Route_Regex('img/' . $this->name . '/(.+)', array('action' => 'img', 'controller' => 'static', 'module' => 'default', 'module_name' => $this->name), array(1 => 'file'))); return $this; }
/** * Register web integration * * Add controller directory to mvc * * @return self */ protected function registerWebIntegration() { if (!$this->app->isWeb()) { return $this; } if (file_exists($this->controllerdir) && is_dir($this->controllerdir)) { $this->app->getfrontController()->addControllerDirectory($this->controllerdir, $this->name); } $this->registerLocales()->registerRoutes(); return $this; }
/** * Register web integration * * Add controller directory to mvc * * @return $this */ protected function registerWebIntegration() { if (!$this->app->isWeb()) { return $this; } $moduleControllerDir = $this->getControllerDir(); if (is_dir($moduleControllerDir)) { $this->app->getfrontController()->addControllerDirectory($moduleControllerDir, $this->getName()); $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . ucfirst($this->getName()) . '\\' . Dispatcher::CONTROLLER_NAMESPACE, $moduleControllerDir); } $this->registerLocales()->registerRoutes(); return $this; }