loadSearchDashlets($searchString); return $dashboard; } /** * Renders the output * * @return string * @throws \Zend_Controller_Action_Exception */ public function render() { if (! $this->getPane(self::SEARCH_PANE)->hasComponents()) { throw new ActionError('Site not found', 404); } return parent::render(); } /** * Loads search dashlets * * @param string $searchString */ protected function loadSearchDashlets($searchString) { $pane = $this->createPane(self::SEARCH_PANE)->getPane(self::SEARCH_PANE)->setTitle(t('Search')); $this->activate(self::SEARCH_PANE); $manager = Icinga::app()->getModuleManager(); foreach ($manager->getLoadedModules() as $module) { $this->addSearchDashletsFromModule($searchString, $module, $pane); } if ($searchString === '' && $pane->hasComponents()) { $pane->removeComponents(); $pane->add('Ready to search', 'search/hint'); return; } } /** * Add available search dashlets to the pane * * @param string $searchString * @param Module $module * @param Pane $pane */ protected function addSearchDashletsFromModule($searchString, $module, $pane) { $searchUrls = $module->getSearchUrls(); if (! empty($searchUrls)) { $this->searchUrls[] = $module->getSearchUrls(); foreach ($searchUrls as $search) { $pane->addComponent( $search->title . ': ' . $searchString, Url::fromPath($search->url, array('q' => $searchString)) ); } } } }