Add the possibility for modules to provide a setup wizard

refs #7163
This commit is contained in:
Johannes Meyer 2014-10-24 13:52:26 +02:00
parent 64e6886c9c
commit a8dd9c933d

View File

@ -18,6 +18,7 @@ use Icinga\Web\Hook;
use Icinga\Web\Menu; use Icinga\Web\Menu;
use Icinga\Web\Widget; use Icinga\Web\Widget;
use Icinga\Web\Widget\Dashboard\Pane; use Icinga\Web\Widget\Dashboard\Pane;
use Icinga\Web\Setup\SetupWizard;
use Icinga\Util\File; use Icinga\Util\File;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
@ -134,6 +135,13 @@ class Module
*/ */
private $configTabs = array(); private $configTabs = array();
/**
* Provided setup wizard
*
* @var string
*/
private $setupWizard;
/** /**
* Icinga application * Icinga application
* *
@ -642,6 +650,31 @@ class Module
return $tabs; return $tabs;
} }
/**
* Whether this module provides a setup wizard
*
* @return bool
*/
public function providesSetupWizard()
{
$this->launchConfigScript();
if (class_exists($this->setupWizard)) {
$wizard = new $this->setupWizard;
return $wizard instanceof SetupWizard;
}
return false;
}
/**
* Return this module's setup wizard
*
* @return SetupWizard
*/
public function getSetupWizard()
{
return new $this->setupWizard;
}
/** /**
* Provide a named permission * Provide a named permission
@ -705,6 +738,19 @@ class Module
return $this; return $this;
} }
/**
* Provide a setup wizard
*
* @param string $className The name of the class
*
* @return self
*/
protected function provideSetupWizard($className)
{
$this->setupWizard = $className;
return $this;
}
/** /**
* Register new namespaces on the autoloader * Register new namespaces on the autoloader
* *