Add user account menu and move logout and preferences inside it

This commit is contained in:
Alexander Fuhr 2014-11-12 13:22:14 +01:00
parent 2bae33d6ad
commit 993390941a
1 changed files with 41 additions and 31 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Web; namespace Icinga\Web;
use Icinga\Authentication\Manager;
use Icinga\Web\Menu\MenuItemRenderer; use Icinga\Web\Menu\MenuItemRenderer;
use RecursiveIterator; use RecursiveIterator;
use Zend_Config; use Zend_Config;
@ -201,41 +202,50 @@ class Menu implements RecursiveIterator
*/ */
protected function addMainMenuItems() protected function addMainMenuItems()
{ {
$this->add(t('Dashboard'), array( $auth = Manager::getInstance();
'url' => 'dashboard',
'icon' => 'img/icons/dashboard.png',
'priority' => 10
));
$section = $this->add(t('System'), array( if ($auth->isAuthenticated()) {
'icon' => 'img/icons/configuration.png',
'priority' => 200
));
$section->add(t('Preferences'), array(
'url' => 'preference',
'priority' => 200
));
$section->add(t('Configuration'), array(
'url' => 'config',
'priority' => 300
));
$section->add(t('Modules'), array(
'url' => 'config/modules',
'priority' => 400
));
if (Logger::writesToFile()) { $this->add(t('Dashboard'), array(
$section->add(t('Application Log'), array( 'url' => 'dashboard',
'url' => 'list/applicationlog', 'icon' => 'img/icons/dashboard.png',
'priority' => 500 'priority' => 10
));
$section = $this->add(t('System'), array(
'icon' => 'img/icons/configuration.png',
'priority' => 200
));
$section->add(t('Configuration'), array(
'url' => 'config',
'priority' => 300
));
$section->add(t('Modules'), array(
'url' => 'config/modules',
'priority' => 400
));
if (Logger::writesToFile()) {
$section->add(t('Application Log'), array(
'url' => 'list/applicationlog',
'priority' => 500
));
}
$section = $this->add($auth->getUser()->getUsername(), array(
'icon' => 'img/icons/user.png',
'priority' => 600
));
$section->add(t('Preferences'), array(
'url' => 'preference',
'priority' => 601
));
$section->add(t('Logout'), array(
'url' => 'authentication/logout',
'priority' => 700
)); ));
} }
$this->add(t('Logout'), array(
'url' => 'authentication/logout',
'icon' => 'img/icons/logout.png',
'priority' => 300
));
} }
/** /**