/** * Scan all controllers with given name in the application and (loaded) module folders and collects their provided * tabs * * @param string $controllerName The name of the controllers to use for tab collection * * @return Tabs A {@link Tabs} instance containing the application tabs first followed by the * tabs provided from the modules */ public static function collectControllerTabs($controllerName) { $controller = '\\Icinga\\' . Dispatcher::CONTROLLER_NAMESPACE . '\\' . $controllerName; $applicationTabs = $controller::createProvidedTabs(); $moduleTabs = self::collectModuleTabs($controllerName); $tabs = new Tabs(); foreach ($applicationTabs as $name => $tab) { $tabs->add($name, $tab); } foreach ($moduleTabs as $name => $tab) { // Don't overwrite application tabs if the module wants to if ($tabs->has($name)) { continue; } $tabs->add($name, $tab); } return $tabs; }
/** * Scan all controllers with the provided name * in the application and (loaded) module folders and collects their provided tabs * * @param string $controller The name of the controllers to use for tab collection * * @return Tabs A @see Tabs instance containing the application tabs first * followed by the tabs provided from the modules */ public static function collectControllerTabs($controller) { require_once Icinga::app()->getApplicationDir('/controllers/' . $controller . '.php'); $applicationTabs = $controller::createProvidedTabs(); $moduleTabs = self::collectModuleTabs($controller); $tabs = new Tabs(); foreach ($applicationTabs as $name => $tab) { $tabs->add($name, $tab); } foreach ($moduleTabs as $name => $tab) { // don't overwrite application tabs if the module wants to if ($tabs->has($name)) { continue; } $tabs->add($name, $tab); } return $tabs; }
/** * Return the tab object used to navigate through this dashboard * * @return Tabs */ public function getTabs() { $url = Url::fromPath('dashboard')->getUrlWithout($this->tabParam); if ($this->tabs === null) { $this->tabs = new Tabs(); foreach ($this->panes as $key => $pane) { $this->tabs->add($key, array('title' => sprintf(t('Show %s', 'dashboard.pane.tooltip'), $pane->getTitle()), 'label' => $pane->getTitle(), 'url' => clone $url, 'urlParams' => array($this->tabParam => $key))); } } return $this->tabs; }
/** * Return the tab object used to navigate through this dashboard * * @return Tabs */ public function getTabs() { $url = Url::fromRequest()->getUrlWithout($this->tabParam); if ($this->tabs === null) { $this->tabs = new Tabs(); foreach ($this->panes as $key => $pane) { $this->tabs->add($key, array('title' => $pane->getTitle(), 'url' => clone $url, 'urlParams' => array($this->tabParam => $key))); } } return $this->tabs; }