parent
74ea4d19b8
commit
40c2c64985
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
// @codingStandardsIgnoreStart
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
@ -9,39 +8,29 @@ use Icinga\Module\Doc\Controller as DocController;
|
||||||
class Doc_ModuleController extends DocController
|
class Doc_ModuleController extends DocController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display module documentations index
|
* List available modules
|
||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->view->enabledModules = Icinga::app()->getModuleManager()->listEnabledModules();
|
$this->view->enabledModules = Icinga::app()->getModuleManager()->listEnabledModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Display a module's documentation
|
|
||||||
*/
|
|
||||||
public function viewAction()
|
|
||||||
{
|
|
||||||
$this->populateView($this->getParam('name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide run-time dispatching of module documentation
|
* Provide run-time dispatching of module documentation
|
||||||
*
|
*
|
||||||
* @param string $methodName
|
* @param string $methodName
|
||||||
* @param array $args
|
* @param array $args
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __call($methodName, $args)
|
public function __call($methodName, $args)
|
||||||
{
|
{
|
||||||
// TODO(el): Setup routing to retrieve module name as param and point route to moduleAction
|
$moduleManager = Icinga::app()->getModuleManager();
|
||||||
$moduleManager = Icinga::app()->getModuleManager();
|
$moduleName = substr($methodName, 0, -6); // Strip 'Action' suffix
|
||||||
$moduleName = substr($methodName, 0, -6); // Strip 'Action' suffix
|
if (! $moduleManager->hasEnabled($moduleName)) {
|
||||||
if (!$moduleManager->hasEnabled($moduleName)) {
|
// TODO(el): Distinguish between not enabled and not installed
|
||||||
// TODO(el): Throw a not found exception once the code has been moved to the moduleAction (see TODO above)
|
|
||||||
return parent::__call($methodName, $args);
|
return parent::__call($methodName, $args);
|
||||||
}
|
}
|
||||||
$this->_helper->redirector->gotoSimpleAndExit('view', null, null, array('name' => $moduleName));
|
$this->renderDocAndToc($moduleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreEnd
|
|
||||||
|
|
Loading…
Reference in New Issue