/** * Render a pdf * * @param string $path Path to the documentation * @param string $name Name of the documentation * @param string $url * @param array $urlParams */ protected function renderPdf($path, $name, $url, array $urlParams = array()) { $parser = new DocParser($path); $toc = new DocTocRenderer($parser->getDocTree()->getIterator()); $this->view->toc = $toc->setUrl($url)->setUrlParams($urlParams); $section = new DocSectionRenderer($parser->getDocTree()); $this->view->section = $section->setUrl($url)->setUrlParams($urlParams); $this->view->title = sprintf($this->translate('%s Documentation'), $name); $this->_request->setParam('format', 'pdf'); $this->_helper->viewRenderer->setRender('pdf', null, true); }
/** * Render search */ public function indexAction() { $parser = new DocParser($this->getWebPath()); $search = new DocSearchRenderer(new DocSearchIterator($parser->getDocTree()->getIterator(), new DocSearch($this->params->get('q')))); $search->setUrl('doc/icingaweb/chapter'); if (strlen($this->params->get('q')) < 3) { $this->view->searches = array(); return; } $searches = array('Icinga Web 2' => $search); foreach (Icinga::app()->getModuleManager()->listEnabledModules() as $module) { if (($path = $this->getModulePath($module)) !== null) { try { $parser = new DocParser($path); $search = new DocSearchRenderer(new DocSearchIterator($parser->getDocTree()->getIterator(), new DocSearch($this->params->get('q')))); } catch (DocException $e) { continue; } $search->setUrl('doc/module/chapter')->setUrlParams(array('moduleName' => $module)); $searches[$module] = $search; } } $this->view->searches = $searches; }