git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

settingsnav.php 6.84 KB
Newer Older
1 2 3
<?php
/**
 * StatusNet - the distributed open-source microblogging tool
4
 * Copyright (C) 2010,2011, StatusNet, Inc.
5 6
 *
 * Settings menu
7
 *
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 * PHP version 5
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @category  Widget
 * @package   StatusNet
 * @author    Evan Prodromou <evan@status.net>
26
 * @copyright 2010,2011 StatusNet, Inc.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
 * @link      http://status.net/
 */

if (!defined('STATUSNET')) {
    // This check helps protect against security problems;
    // your code file can't be executed directly from the web.
    exit(1);
}

/**
 * A widget for showing the settings group local nav menu
 *
 * @category Widget
 * @package  StatusNet
 * @author   Evan Prodromou <evan@status.net>
 * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 * @link     http://status.net/
 *
 * @see      HTMLOutputter
 */
48
class SettingsNav extends Menu
49 50 51 52 53 54 55 56 57
{
    /**
     * Show the menu
     *
     * @return void
     */
    function show()
    {
        $actionName = $this->action->trimmed('action');
58 59 60 61
        $user = common_current_user();
        $nickname = $user->nickname;
        $name = $user->getProfile()->getBestName();

62 63 64
        $stub = new HomeStubNav($this->action);
        $this->submenu(_m('MENU','Home'), $stub);
        
65
        $this->action->elementStart('ul');
66
        $this->action->elementStart('li');
67 68
        // TRANS: Header in settings navigation panel.
        $this->action->element('h3', null, _m('HEADER','Settings'));
69 70 71 72
        $this->action->elementStart('ul', array('class' => 'nav'));

        if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
            $this->action->menuItem(common_local_url('profilesettings'),
73 74 75
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','Profile'),
                                    // TRANS: Menu item title in settings navigation panel.
76 77 78 79
                                    _('Change your profile settings'),
                                    $actionName == 'profilesettings');

            $this->action->menuItem(common_local_url('avatarsettings'),
80 81 82
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','Avatar'),
                                    // TRANS: Menu item title in settings navigation panel.
83 84 85 86
                                    _('Upload an avatar'),
                                    $actionName == 'avatarsettings');

            $this->action->menuItem(common_local_url('passwordsettings'),
87 88 89
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','Password'),
                                    // TRANS: Menu item title in settings navigation panel.
90 91 92 93
                                    _('Change your password'),
                                    $actionName == 'passwordsettings');

            $this->action->menuItem(common_local_url('emailsettings'),
94 95 96
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','Email'),
                                    // TRANS: Menu item title in settings navigation panel.
97 98 99 100
                                    _('Change email handling'),
                                    $actionName == 'emailsettings');

            $this->action->menuItem(common_local_url('urlsettings'),
101 102 103
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','URL'),
                                    // TRANS: Menu item title in settings navigation panel.
104 105 106 107
                                    _('URL shorteners'),
                                    $actionName == 'urlsettings');

            Event::handle('EndAccountSettingsNav', array(&$this->action));
108

109 110 111 112 113
            $haveImPlugin = false;

            Event::handle('HaveImPlugin', array(&$haveImPlugin));

            if ($haveImPlugin) {
114
                $this->action->menuItem(common_local_url('imsettings'),
115 116 117
                                        // TRANS: Menu item in settings navigation panel.
                                        _m('MENU','IM'),
                                        // TRANS: Menu item title in settings navigation panel.
118 119 120 121 122 123
                                        _('Updates by instant messenger (IM)'),
                                        $actionName == 'imsettings');
            }

            if (common_config('sms', 'enabled')) {
                $this->action->menuItem(common_local_url('smssettings'),
124 125 126
                                        // TRANS: Menu item in settings navigation panel.
                                        _m('MENU','SMS'),
                                        // TRANS: Menu item title in settings navigation panel.
127 128 129 130 131
                                        _('Updates by SMS'),
                                        $actionName == 'smssettings');
            }

            $this->action->menuItem(common_local_url('oauthconnectionssettings'),
132 133 134
                                    // TRANS: Menu item in settings navigation panel.
                                    _m('MENU','Connections'),
                                    // TRANS: Menu item title in settings navigation panel.
135 136 137
                                    _('Authorized connected applications'),
                                    $actionName == 'oauthconnectionsettings');

138 139 140 141 142 143 144 145 146
            if (common_config('oldschool', 'enabled')) {
                $this->action->menuItem(common_local_url('oldschoolsettings'),
                                        // TRANS: Menu item in settings navigation panel.
                                        _m('MENU','Old school'),
                                        // TRANS: Menu item title in settings navigation panel.
                                        _('UI tweaks for old-school users'),
                                        $actionName == 'oldschoolsettings');
            }

147 148 149 150
            Event::handle('EndConnectSettingsNav', array(&$this->action));
        }

        $this->action->elementEnd('ul');
151
        $this->action->elementEnd('li');
152
        $this->action->elementEnd('ul');
153 154
    }
}