]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/adminpanelnav.php
Same goes to onStartShowAside() which has 'Action' as type-hint.
[quix0rs-gnu-social.git] / lib / adminpanelnav.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2011, StatusNet, Inc.
5  *
6  * Menu for admin panels
7  *
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category  Menu
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2011 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET')) {
32     // This check helps protect against security problems;
33     // your code file can't be executed directly from the web.
34     exit(1);
35 }
36
37 /**
38  * Menu for admin panels
39  *
40  * @category Output
41  * @package  StatusNet
42  * @author   Evan Prodromou <evan@status.net>
43  * @author   Sarven Capadisli <csarven@status.net>
44  * @copyright 2011 StatusNet, Inc.
45  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
46  * @link     http://status.net/
47  */
48 class AdminPanelNav extends Menu
49 {
50     /**
51      * Show the menu
52      *
53      * @return void
54      */
55     function show()
56     {
57         $action_name = $this->action->trimmed('action');
58         $user = common_current_user();
59         $nickname = $user->nickname;
60         $name = $user->getProfile()->getBestName();
61
62         // Stub section w/ home link
63         $this->action->elementStart('ul');
64         $this->action->elementStart('li');
65         // TRANS: Header in administrator navigation panel.
66         $this->action->element('h3', null, _m('HEADER','Home'));
67         $this->action->elementStart('ul', 'nav');
68         $this->out->menuItem(common_local_url('all', array('nickname' =>
69                                                            $nickname)),
70                              // TRANS: Menu item in administrator navigation panel.
71                              _m('MENU','Home'),
72                              // TRANS: Menu item title in administrator navigation panel.
73                              // TRANS: %s is a username.
74                              sprintf(_('%s and friends'), $name),
75                              $this->action == 'all', 'nav_timeline_personal');
76
77         $this->action->elementEnd('ul');
78         $this->action->elementEnd('li');
79         $this->action->elementEnd('ul');
80
81         $this->action->elementStart('ul');
82         $this->action->elementStart('li');
83         // TRANS: Header in administrator navigation panel.
84         $this->action->element('h3', null, _m('HEADER','Admin'));
85         $this->action->elementStart('ul', array('class' => 'nav'));
86
87         if (Event::handle('StartAdminPanelNav', array($this))) {
88
89             if (AdminPanelAction::canAdmin('site')) {
90                 // TRANS: Menu item title in administrator navigation panel.
91                 $menu_title = _('Basic site configuration');
92                 // TRANS: Menu item in administrator navigation panel.
93                 $this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
94                                      $menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
95             }
96
97             if (AdminPanelAction::canAdmin('user')) {
98                 // TRANS: Menu item title in administrator navigation panel.
99                 $menu_title = _('User configuration');
100                 // TRANS: Menu item in administrator navigation panel.
101                 $this->out->menuItem(common_local_url('useradminpanel'), _m('MENU','User'),
102                                      $menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
103             }
104
105             if (AdminPanelAction::canAdmin('access')) {
106                 // TRANS: Menu item title in administrator navigation panel.
107                 $menu_title = _('Access configuration');
108                 // TRANS: Menu item in administrator navigation panel.
109                 $this->out->menuItem(common_local_url('accessadminpanel'), _m('MENU','Access'),
110                                      $menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
111             }
112
113             if (AdminPanelAction::canAdmin('paths')) {
114                 // TRANS: Menu item title in administrator navigation panel.
115                 $menu_title = _('Paths configuration');
116                 // TRANS: Menu item in administrator navigation panel.
117                 $this->out->menuItem(common_local_url('pathsadminpanel'), _m('MENU','Paths'),
118                                     $menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
119             }
120
121             if (AdminPanelAction::canAdmin('sessions')) {
122                 // TRANS: Menu item title in administrator navigation panel.
123                 $menu_title = _('Sessions configuration');
124                 // TRANS: Menu item in administrator navigation panel.
125                 $this->out->menuItem(common_local_url('sessionsadminpanel'), _m('MENU','Sessions'),
126                                      $menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
127             }
128
129             if (AdminPanelAction::canAdmin('sitenotice')) {
130                 // TRANS: Menu item title in administrator navigation panel.
131                 $menu_title = _('Edit site notice');
132                 // TRANS: Menu item in administrator navigation panel.
133                 $this->out->menuItem(common_local_url('sitenoticeadminpanel'), _m('MENU','Site notice'),
134                                      $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
135             }
136
137             if (AdminPanelAction::canAdmin('license')) {
138                 // TRANS: Menu item title in administrator navigation panel.
139                 $menu_title = _('Set site license');
140                 // TRANS: Menu item in administrator navigation panel.
141                 $this->out->menuItem(common_local_url('licenseadminpanel'), _m('MENU','License'),
142                                      $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
143             }
144
145             if (AdminPanelAction::canAdmin('plugins')) {
146                 // TRANS: Menu item title in administrator navigation panel.
147                 $menu_title = _('Plugins configuration');
148                 // TRANS: Menu item in administrator navigation panel.
149                 $this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
150                                      $menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
151             }
152
153             Event::handle('EndAdminPanelNav', array($this));
154         }
155         $this->action->elementEnd('ul');
156         $this->action->elementEnd('li');
157         $this->action->elementEnd('ul');
158     }
159 }