]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/settingsnav.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / lib / settingsnav.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010, 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 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 Widget
50 {
51     var $action = null;
52
53     /**
54      * Construction
55      *
56      * @param Action $action current action, used for output
57      */
58     function __construct($action=null)
59     {
60         parent::__construct($action);
61         $this->action = $action;
62     }
63
64     /**
65      * Show the menu
66      *
67      * @return void
68      */
69
70     function show()
71     {
72         $actionName = $this->action->trimmed('action');
73         $this->action->elementStart('ul', array('class' => 'nav'));
74
75         if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
76             $this->action->menuItem(common_local_url('profilesettings'),
77                                     _('Profile'),
78                                     _('Change your profile settings'),
79                                     $actionName == 'profilesettings');
80
81             $this->action->menuItem(common_local_url('avatarsettings'),
82                                     _('Avatar'),
83                                     _('Upload an avatar'),
84                                     $actionName == 'avatarsettings');
85
86             $this->action->menuItem(common_local_url('passwordsettings'),
87                                     _('Password'),
88                                     _('Change your password'),
89                                     $actionName == 'passwordsettings');
90
91             $this->action->menuItem(common_local_url('emailsettings'),
92                                     _('Email'),
93                                     _('Change email handling'),
94                                     $actionName == 'emailsettings');
95
96             $this->action->menuItem(common_local_url('userdesignsettings'),
97                                     _('Design'),
98                                     _('Design your profile'),
99                                     $actionName == 'userdesignsettings');
100
101             $this->action->menuItem(common_local_url('urlsettings'),
102                                     _('URL'),
103                                     _('URL shorteners'),
104                                     $actionName == 'urlsettings');
105
106             Event::handle('EndAccountSettingsNav', array(&$this->action));
107         
108             if (common_config('xmpp', 'enabled')) {
109                 $this->action->menuItem(common_local_url('imsettings'),
110                                         _m('IM'),
111                                         _('Updates by instant messenger (IM)'),
112                                         $actionName == 'imsettings');
113             }
114
115             if (common_config('sms', 'enabled')) {
116                 $this->action->menuItem(common_local_url('smssettings'),
117                                         _m('SMS'),
118                                         _('Updates by SMS'),
119                                         $actionName == 'smssettings');
120             }
121
122             $this->action->menuItem(common_local_url('oauthconnectionssettings'),
123                                     _('Connections'),
124                                     _('Authorized connected applications'),
125                                     $actionName == 'oauthconnectionsettings');
126
127             Event::handle('EndConnectSettingsNav', array(&$this->action));
128         }
129
130         $this->action->elementEnd('ul');
131     }
132 }