ModuleActionController: module object shortcut

This helps modules with the need to know more about themselves. No
more App -> Module Manager -> Module voodoo.
This commit is contained in:
Thomas Gelf 2014-06-24 20:54:39 +02:00
parent 3576263559
commit 3f9f4bb9e1
1 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Web\Controller;
use Icinga\Application\Config;
use Icinga\Application\Icinga;
use Zend_Controller_Request_Abstract as Request;
use Zend_Controller_Response_Abstract as Response;
@ -12,6 +13,8 @@ class ModuleActionController extends ActionController
private $configs = array();
private $module;
protected $moduleName;
public function __construct(
@ -44,6 +47,14 @@ class ModuleActionController extends ActionController
}
}
public function Module()
{
if ($this->module === null) {
$this->module = Icinga::app()->getModuleManager()->getModule($this->moduleName);
}
return $this->module;
}
public function postDispatch()
{
$req = $this->getRequest();