aboutsummaryrefslogtreecommitdiff
path: root/lib/navigation/AvatarNavigation.php
blob: 64bbdbc68a1db3be1adb31cbb5573b35bb350713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
 * AvatarNavigation.php - navigation for menu "below" the avatar in header
 *
 * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
 * @license GPL2 or any later version
 */
class AvatarNavigation extends Navigation
{
    /**
     * Initialize a new Navigation instance.
     */
    public function __construct()
    {
        parent::__construct(_('Avatar-Menü'));
    }

    /**
     * Initialize the subnavigation of this item. This method
     * is called once before the first item is added or removed.
     */
    public function initSubNavigation()
    {
        parent::initSubNavigation();

        // Link to profile
        $navigation = new Navigation(_('Profil'), 'dispatch.php/profile/index');
        $navigation->setImage(Icon::create('person'));
        $this->addSubNavigation('profile', $navigation);

        if ($GLOBALS['perm']->have_perm('autor')) {
            // Link to user data
            $navigation = new Navigation(_('Persönliche Angaben'), 'dispatch.php/settings/account');
            $navigation->setImage(Icon::create('key'));
            $this->addSubNavigation('account', $navigation);

            // Link to user settings
            $navigation = new Navigation(_('Einstellungen'), 'dispatch.php/settings/general');
            $navigation->setImage(Icon::create('admin'));
            $this->addSubNavigation('settings', $navigation);

            // Link to accessibility settings
            $navigation = new Navigation(_('Barrierefreiheit'), 'dispatch.php/settings/accessibility');
            $navigation->setImage(Icon::create('accessibility'));
            $this->addSubNavigation('accessibility', $navigation);
        }

        // Link to logout
        $navigation = new Navigation(_('Logout'), 'logout.php');
        $navigation->setImage(Icon::create('door-leave'));
        $navigation->setRenderAsButton();
        $this->addSubNavigation('logout', $navigation);
    }
}