]> 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
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         $user = common_current_user();
61         $nickname = $user->nickname;
62         $name = $user->getProfile()->getBestName();
63
64         // Stub section w/ home link
65         $this->action->elementStart('ul');
66         $this->action->element('h3', null, _('Home'));
67         $this->action->elementStart('ul', 'nav');
68         $this->out->menuItem(common_local_url('all', array('nickname' =>
69                                                            $nickname)),
70                              _('Home'),
71                              sprintf(_('%s and friends'), $name),
72                              $this->action == 'all', 'nav_timeline_personal');
73
74         $this->action->elementEnd('ul');
75         $this->action->elementEnd('ul');
76
77         $this->action->elementStart('ul');
78         $this->action->element('h3', null, _('Settings'));
79         $this->action->elementStart('ul', array('class' => 'nav'));
80
81         if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
82             $this->action->menuItem(common_local_url('profilesettings'),
83                                     _('Profile'),
84                                     _('Change your profile settings'),
85                                     $actionName == 'profilesettings');
86
87             $this->action->menuItem(common_local_url('avatarsettings'),
88                                     _('Avatar'),
89                                     _('Upload an avatar'),
90                                     $actionName == 'avatarsettings');
91
92             $this->action->menuItem(common_local_url('passwordsettings'),
93                                     _('Password'),
94                                     _('Change your password'),
95                                     $actionName == 'passwordsettings');
96
97             $this->action->menuItem(common_local_url('emailsettings'),
98                                     _('Email'),
99                                     _('Change email handling'),
100                                     $actionName == 'emailsettings');
101
102             $this->action->menuItem(common_local_url('userdesignsettings'),
103                                     _('Design'),
104                                     _('Design your profile'),
105                                     $actionName == 'userdesignsettings');
106
107             $this->action->menuItem(common_local_url('urlsettings'),
108                                     _('URL'),
109                                     _('URL shorteners'),
110                                     $actionName == 'urlsettings');
111
112             Event::handle('EndAccountSettingsNav', array(&$this->action));
113         
114             if (common_config('xmpp', 'enabled')) {
115                 $this->action->menuItem(common_local_url('imsettings'),
116                                         _m('IM'),
117                                         _('Updates by instant messenger (IM)'),
118                                         $actionName == 'imsettings');
119             }
120
121             if (common_config('sms', 'enabled')) {
122                 $this->action->menuItem(common_local_url('smssettings'),
123                                         _m('SMS'),
124                                         _('Updates by SMS'),
125                                         $actionName == 'smssettings');
126             }
127
128             $this->action->menuItem(common_local_url('oauthconnectionssettings'),
129                                     _('Connections'),
130                                     _('Authorized connected applications'),
131                                     $actionName == 'oauthconnectionsettings');
132
133             Event::handle('EndConnectSettingsNav', array(&$this->action));
134         }
135
136         $this->action->elementEnd('ul');
137         $this->action->elementEnd('ul');
138     }
139 }