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

View File

@ -4,6 +4,7 @@
namespace Icinga\Web;
use Icinga\Authentication\Manager;
use Icinga\Web\Menu\MenuItemRenderer;
use RecursiveIterator;
use Zend_Config;
@ -201,6 +202,10 @@ class Menu implements RecursiveIterator
*/
protected function addMainMenuItems()
{
$auth = Manager::getInstance();
if ($auth->isAuthenticated()) {
$this->add(t('Dashboard'), array(
'url' => 'dashboard',
'icon' => 'img/icons/dashboard.png',
@ -211,10 +216,6 @@ class Menu implements RecursiveIterator
'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
@ -231,11 +232,20 @@ class Menu implements RecursiveIterator
));
}
$this->add(t('Logout'), array(
'url' => 'authentication/logout',
'icon' => 'img/icons/logout.png',
'priority' => 300
$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
));
}
}
/**