mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
parent
e3c1734d1a
commit
64bed9867f
@ -13,6 +13,7 @@ use Zend_Paginator;
|
|||||||
use Zend_View_Helper_PaginationControl;
|
use Zend_View_Helper_PaginationControl;
|
||||||
use Icinga\Authentication\Auth;
|
use Icinga\Authentication\Auth;
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
|
use Icinga\Util\DirectoryIterator;
|
||||||
use Icinga\Util\TimezoneDetect;
|
use Icinga\Util\TimezoneDetect;
|
||||||
use Icinga\Util\Translator;
|
use Icinga\Util\Translator;
|
||||||
use Icinga\Web\Controller\Dispatcher;
|
use Icinga\Web\Controller\Dispatcher;
|
||||||
@ -33,6 +34,13 @@ use Icinga\Web\View;
|
|||||||
*/
|
*/
|
||||||
class Web extends EmbeddedWeb
|
class Web extends EmbeddedWeb
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The name of the default theme
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const DEFAULT_THEME = 'Icinga';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View object
|
* View object
|
||||||
*
|
*
|
||||||
@ -98,6 +106,33 @@ class Web extends EmbeddedWeb
|
|||||||
->setupPagination();
|
->setupPagination();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get themes provided by Web 2 and all enabled modules
|
||||||
|
*
|
||||||
|
* @return string[] Array of theme names as keys and values
|
||||||
|
*/
|
||||||
|
public function getThemes()
|
||||||
|
{
|
||||||
|
$themes = array(static::DEFAULT_THEME);
|
||||||
|
$applicationThemePath = $this->getBaseDir('public/css/themes');
|
||||||
|
if (DirectoryIterator::isReadable($applicationThemePath)) {
|
||||||
|
foreach (new DirectoryIterator($applicationThemePath, 'less') as $name => $theme) {
|
||||||
|
$themes[] = substr($name, 0, -5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$mm = $this->getModuleManager();
|
||||||
|
foreach ($mm->listEnabledModules() as $moduleName) {
|
||||||
|
$moduleThemePath = $mm->getModule($moduleName)->getCssDir() . '/themes';
|
||||||
|
if (! DirectoryIterator::isReadable($moduleThemePath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (new DirectoryIterator($moduleThemePath, 'less') as $name => $theme) {
|
||||||
|
$themes[] = $moduleName . '/' . substr($name, 0, -5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_combine($themes, $themes);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare routing
|
* Prepare routing
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user