3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2011, StatusNet, Inc.
6 * Menu for admin panels
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.
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.
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/>.
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/
31 if (!defined('STATUSNET')) {
32 // This check helps protect against security problems;
33 // your code file can't be executed directly from the web.
38 * Menu for admin panels
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/
48 class AdminPanelNav extends Menu
57 $action_name = $this->action->trimmed('action');
58 $user = common_current_user();
59 $nickname = $user->nickname;
60 $name = $user->getProfile()->getBestName();
62 $stub = new HomeStubNav($this->action);
63 $this->submenu(_m('MENU','Home'), $stub);
65 $this->action->elementStart('ul');
66 $this->action->elementStart('li');
67 // TRANS: Header in administrator navigation panel.
68 $this->action->element('h3', null, _m('HEADER','Admin'));
69 $this->action->elementStart('ul', array('class' => 'nav'));
71 if (Event::handle('StartAdminPanelNav', array($this))) {
73 if (AdminPanelAction::canAdmin('site')) {
74 // TRANS: Menu item title in administrator navigation panel.
75 $menu_title = _('Basic site configuration');
76 // TRANS: Menu item in administrator navigation panel.
77 $this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
78 $menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
81 if (AdminPanelAction::canAdmin('user')) {
82 // TRANS: Menu item title in administrator navigation panel.
83 $menu_title = _('User configuration');
84 // TRANS: Menu item in administrator navigation panel.
85 $this->out->menuItem(common_local_url('useradminpanel'), _m('MENU','User'),
86 $menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
89 if (AdminPanelAction::canAdmin('access')) {
90 // TRANS: Menu item title in administrator navigation panel.
91 $menu_title = _('Access configuration');
92 // TRANS: Menu item in administrator navigation panel.
93 $this->out->menuItem(common_local_url('accessadminpanel'), _m('MENU','Access'),
94 $menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
97 if (AdminPanelAction::canAdmin('paths')) {
98 // TRANS: Menu item title in administrator navigation panel.
99 $menu_title = _('Paths configuration');
100 // TRANS: Menu item in administrator navigation panel.
101 $this->out->menuItem(common_local_url('pathsadminpanel'), _m('MENU','Paths'),
102 $menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
105 if (AdminPanelAction::canAdmin('sessions')) {
106 // TRANS: Menu item title in administrator navigation panel.
107 $menu_title = _('Sessions configuration');
108 // TRANS: Menu item in administrator navigation panel.
109 $this->out->menuItem(common_local_url('sessionsadminpanel'), _m('MENU','Sessions'),
110 $menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
113 if (AdminPanelAction::canAdmin('sitenotice')) {
114 // TRANS: Menu item title in administrator navigation panel.
115 $menu_title = _('Edit site notice');
116 // TRANS: Menu item in administrator navigation panel.
117 $this->out->menuItem(common_local_url('sitenoticeadminpanel'), _m('MENU','Site notice'),
118 $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
121 if (AdminPanelAction::canAdmin('license')) {
122 // TRANS: Menu item title in administrator navigation panel.
123 $menu_title = _('Set site license');
124 // TRANS: Menu item in administrator navigation panel.
125 $this->out->menuItem(common_local_url('licenseadminpanel'), _m('MENU','License'),
126 $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
129 if (AdminPanelAction::canAdmin('plugins')) {
130 // TRANS: Menu item title in administrator navigation panel.
131 $menu_title = _('Plugins configuration');
132 // TRANS: Menu item in administrator navigation panel.
133 $this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
134 $menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
137 Event::handle('EndAdminPanelNav', array($this));
139 $this->action->elementEnd('ul');
140 $this->action->elementEnd('li');
141 $this->action->elementEnd('ul');