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 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' =>
70 // TRANS: Menu item in administrator navigation panel.
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');
77 $this->action->elementEnd('ul');
78 $this->action->elementEnd('li');
79 $this->action->elementEnd('ul');
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'));
87 if (Event::handle('StartAdminPanelNav', array($this))) {
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');
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');
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');
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');
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');
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');
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');
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');
153 Event::handle('EndAdminPanelNav', array($this));
155 $this->action->elementEnd('ul');
156 $this->action->elementEnd('li');
157 $this->action->elementEnd('ul');