2014-01-24 16:41:37 +01:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
|
|
|
use Icinga\Application\Icinga;
|
2014-02-03 15:39:53 +01:00
|
|
|
use Icinga\Module\Doc\Controller as DocController;
|
2014-01-24 16:41:37 +01:00
|
|
|
|
2014-02-03 15:39:53 +01:00
|
|
|
class Doc_ModuleController extends DocController
|
2014-01-24 16:41:37 +01:00
|
|
|
{
|
|
|
|
/**
|
2014-05-23 14:06:28 +02:00
|
|
|
* List available modules
|
2014-01-24 16:41:37 +01:00
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2014-02-03 15:39:53 +01:00
|
|
|
$this->view->enabledModules = Icinga::app()->getModuleManager()->listEnabledModules();
|
2014-01-24 16:41:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide run-time dispatching of module documentation
|
|
|
|
*
|
2014-05-23 14:06:28 +02:00
|
|
|
* @param string $methodName
|
|
|
|
* @param array $args
|
2014-01-24 16:41:37 +01:00
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function __call($methodName, $args)
|
|
|
|
{
|
2014-05-23 14:06:28 +02:00
|
|
|
$moduleManager = Icinga::app()->getModuleManager();
|
|
|
|
$moduleName = substr($methodName, 0, -6); // Strip 'Action' suffix
|
|
|
|
if (! $moduleManager->hasEnabled($moduleName)) {
|
|
|
|
// TODO(el): Distinguish between not enabled and not installed
|
2014-01-24 16:41:37 +01:00
|
|
|
return parent::__call($methodName, $args);
|
|
|
|
}
|
2014-05-23 14:06:28 +02:00
|
|
|
$this->renderDocAndToc($moduleName);
|
2014-01-24 16:41:37 +01:00
|
|
|
}
|
|
|
|
}
|