2014-02-03 15:39:53 +01:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
|
|
|
namespace Icinga\Module\Doc;
|
|
|
|
|
|
|
|
use Icinga\Web\Controller\ActionController;
|
|
|
|
|
2014-05-27 14:48:35 +02:00
|
|
|
class DocController extends ActionController
|
2014-02-03 15:39:53 +01:00
|
|
|
{
|
|
|
|
/**
|
2014-05-23 09:36:14 +02:00
|
|
|
* Publish doc HTML and toc to the view
|
2014-02-03 15:39:53 +01:00
|
|
|
*
|
2014-05-23 09:36:14 +02:00
|
|
|
* @param string $module Name of the module for which to populate doc and toc. `null` for Icinga Web 2's doc
|
2014-02-03 15:39:53 +01:00
|
|
|
*/
|
2014-05-23 14:04:36 +02:00
|
|
|
protected function renderDocAndToc($module = null)
|
2014-02-03 15:39:53 +01:00
|
|
|
{
|
2014-05-23 09:36:14 +02:00
|
|
|
$parser = new DocParser($module);
|
|
|
|
list($docHtml, $docToc) = $parser->getDocAndToc();
|
|
|
|
$this->view->docHtml = $docHtml;
|
|
|
|
$this->view->docToc = $docToc;
|
2014-05-23 14:04:36 +02:00
|
|
|
$this->view->docName = $module === null ? 'Icinga Web 2' : ucfirst($module);
|
|
|
|
$this->_helper->viewRenderer('partials/docandtoc', null, true);
|
2014-02-03 15:39:53 +01:00
|
|
|
}
|
2014-05-27 14:49:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render a toc
|
|
|
|
*
|
|
|
|
* @param string $path Path to the documentation
|
|
|
|
* @param string
|
|
|
|
*/
|
|
|
|
protected function renderToc($path, $name)
|
|
|
|
{
|
|
|
|
$parser = new DocParser($path);
|
|
|
|
list($docHtml, $docToc) = $parser->getDocAndToc();
|
|
|
|
$this->view->docToc = $docToc;
|
|
|
|
$this->view->docName = $name;
|
|
|
|
$this->_helper->viewRenderer('partials/toc', null, true);
|
|
|
|
}
|
2014-05-23 09:36:14 +02:00
|
|
|
}
|