/** * Register new namespaces on the autoloader * * @return self */ protected function registerAutoloader() { $moduleName = ucfirst($this->getName()); $moduleLibraryDir = $this->getLibDir() . '/' . $moduleName; if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir()) && is_dir($moduleLibraryDir)) { $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir); if (is_dir($this->getFormDir())) { $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName . '\\Form', $this->getFormDir()); } } 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; }
/** * Register module namespaces on our class loader * * @return $this */ protected function registerAutoloader() { if ($this->registeredAutoloader) { return $this; } $moduleName = ucfirst($this->getName()); $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $this->getLibDir() . '/' . $moduleName, $this->getApplicationDir()); $this->registeredAutoloader = true; return $this; }
/** * Register module namespaces on the autoloader * * @return $this */ protected function registerAutoloader() { if ($this->registeredAutoloader) { return $this; } $moduleName = ucfirst($this->getName()); $moduleLibraryDir = $this->getLibDir() . '/' . $moduleName; if (is_dir($moduleLibraryDir)) { $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir); } $moduleFormDir = $this->getFormDir(); if (is_dir($moduleFormDir)) { $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName . '\\Forms', $moduleFormDir); } $this->registeredAutoloader = true; return $this; }