]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/settingsnav.php
Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline
[quix0rs-gnu-social.git] / lib / settingsnav.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010,2011, StatusNet, Inc.
5  *
6  * Settings menu
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  Widget
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2010,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  * A widget for showing the settings group local nav menu
39  *
40  * @category Widget
41  * @package  StatusNet
42  * @author   Evan Prodromou <evan@status.net>
43  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
44  * @link     http://status.net/
45  *
46  * @see      HTMLOutputter
47  */
48 class SettingsNav extends Menu
49 {
50     /**
51      * Show the menu
52      *
53      * @return void
54      */
55     function show()
56     {
57         $actionName = $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 settings 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 settings navigation panel.
71                              _m('MENU','Home'),
72                              // TRANS: Menu item title in settings navigation panel.
73                              // TRANS: %s is a username.
74                              sprintf(_('%s and friends'), $name),
75                              $this->action == 'all', 'nav_timeline_personal');
76         $this->action->elementEnd('ul');
77         $this->action->elementEnd('li');
78         $this->action->elementEnd('ul');
79
80         $this->action->elementStart('ul');
81         $this->action->elementStart('li');
82         // TRANS: Header in settings navigation panel.
83         $this->action->element('h3', null, _m('HEADER','Settings'));
84         $this->action->elementStart('ul', array('class' => 'nav'));
85
86         if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
87             $this->action->menuItem(common_local_url('profilesettings'),
88                                     // TRANS: Menu item in settings navigation panel.
89                                     _m('MENU','Profile'),
90                                     // TRANS: Menu item title in settings navigation panel.
91                                     _('Change your profile settings'),
92                                     $actionName == 'profilesettings');
93
94             $this->action->menuItem(common_local_url('avatarsettings'),
95                                     // TRANS: Menu item in settings navigation panel.
96                                     _m('MENU','Avatar'),
97                                     // TRANS: Menu item title in settings navigation panel.
98                                     _('Upload an avatar'),
99                                     $actionName == 'avatarsettings');
100
101             $this->action->menuItem(common_local_url('passwordsettings'),
102                                     // TRANS: Menu item in settings navigation panel.
103                                     _m('MENU','Password'),
104                                     // TRANS: Menu item title in settings navigation panel.
105                                     _('Change your password'),
106                                     $actionName == 'passwordsettings');
107
108             $this->action->menuItem(common_local_url('emailsettings'),
109                                     // TRANS: Menu item in settings navigation panel.
110                                     _m('MENU','Email'),
111                                     // TRANS: Menu item title in settings navigation panel.
112                                     _('Change email handling'),
113                                     $actionName == 'emailsettings');
114
115             $this->action->menuItem(common_local_url('userdesignsettings'),
116                                     // TRANS: Menu item in settings navigation panel.
117                                     _m('MENU','Design'),
118                                     // TRANS: Menu item title in settings navigation panel.
119                                     _('Design your profile'),
120                                     $actionName == 'userdesignsettings');
121
122             $this->action->menuItem(common_local_url('urlsettings'),
123                                     // TRANS: Menu item in settings navigation panel.
124                                     _m('MENU','URL'),
125                                     // TRANS: Menu item title in settings navigation panel.
126                                     _('URL shorteners'),
127                                     $actionName == 'urlsettings');
128
129             Event::handle('EndAccountSettingsNav', array(&$this->action));
130
131             if (common_config('xmpp', 'enabled')) {
132                 $this->action->menuItem(common_local_url('imsettings'),
133                                         // TRANS: Menu item in settings navigation panel.
134                                         _m('MENU','IM'),
135                                         // TRANS: Menu item title in settings navigation panel.
136                                         _('Updates by instant messenger (IM)'),
137                                         $actionName == 'imsettings');
138             }
139
140             if (common_config('sms', 'enabled')) {
141                 $this->action->menuItem(common_local_url('smssettings'),
142                                         // TRANS: Menu item in settings navigation panel.
143                                         _m('MENU','SMS'),
144                                         // TRANS: Menu item title in settings navigation panel.
145                                         _('Updates by SMS'),
146                                         $actionName == 'smssettings');
147             }
148
149             $this->action->menuItem(common_local_url('oauthconnectionssettings'),
150                                     // TRANS: Menu item in settings navigation panel.
151                                     _m('MENU','Connections'),
152                                     // TRANS: Menu item title in settings navigation panel.
153                                     _('Authorized connected applications'),
154                                     $actionName == 'oauthconnectionsettings');
155
156             Event::handle('EndConnectSettingsNav', array(&$this->action));
157         }
158
159         $this->action->elementEnd('ul');
160         $this->action->elementEnd('li');
161         $this->action->elementEnd('ul');
162     }
163 }