]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/settingsnav.php
all nav menus use menu superclass
[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
49 class SettingsNav extends Menu
50 {
51     /**
52      * Show the menu
53      *
54      * @return void
55      */
56
57     function show()
58     {
59         $actionName = $this->action->trimmed('action');
60         $this->action->elementStart('ul', array('class' => 'nav'));
61
62         if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
63             $this->action->menuItem(common_local_url('profilesettings'),
64                                     _('Profile'),
65                                     _('Change your profile settings'),
66                                     $actionName == 'profilesettings');
67
68             $this->action->menuItem(common_local_url('avatarsettings'),
69                                     _('Avatar'),
70                                     _('Upload an avatar'),
71                                     $actionName == 'avatarsettings');
72
73             $this->action->menuItem(common_local_url('passwordsettings'),
74                                     _('Password'),
75                                     _('Change your password'),
76                                     $actionName == 'passwordsettings');
77
78             $this->action->menuItem(common_local_url('emailsettings'),
79                                     _('Email'),
80                                     _('Change email handling'),
81                                     $actionName == 'emailsettings');
82
83             $this->action->menuItem(common_local_url('userdesignsettings'),
84                                     _('Design'),
85                                     _('Design your profile'),
86                                     $actionName == 'userdesignsettings');
87
88             $this->action->menuItem(common_local_url('urlsettings'),
89                                     _('URL'),
90                                     _('URL shorteners'),
91                                     $actionName == 'urlsettings');
92
93             Event::handle('EndAccountSettingsNav', array(&$this->action));
94         
95             if (common_config('xmpp', 'enabled')) {
96                 $this->action->menuItem(common_local_url('imsettings'),
97                                         _m('IM'),
98                                         _('Updates by instant messenger (IM)'),
99                                         $actionName == 'imsettings');
100             }
101
102             if (common_config('sms', 'enabled')) {
103                 $this->action->menuItem(common_local_url('smssettings'),
104                                         _m('SMS'),
105                                         _('Updates by SMS'),
106                                         $actionName == 'smssettings');
107             }
108
109             $this->action->menuItem(common_local_url('oauthconnectionssettings'),
110                                     _('Connections'),
111                                     _('Authorized connected applications'),
112                                     $actionName == 'oauthconnectionsettings');
113
114             Event::handle('EndConnectSettingsNav', array(&$this->action));
115         }
116
117         $this->action->elementEnd('ul');
118     }
119 }