publicgroupnav.php 3.35 KB
Newer Older
1 2
<?php
/**
3
 * StatusNet, the distributed open-source microblogging tool
4
 *
5
 * Menu for public group of actions
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * PHP version 5
 *
 * LICENCE: 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/>.
 *
22
 * @category  Menu
23
 * @package   StatusNet
24
 * @author    Evan Prodromou <evan@status.net>
25
 * @copyright 2008 StatusNet, Inc.
26
 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27
 * @link      http://status.net/
28 29
 */

30
if (!defined('STATUSNET') && !defined('LACONICA')) {
31 32 33
    exit(1);
}

34 35
require_once INSTALLDIR.'/lib/widget.php';

36
/**
37
 * Menu for public group of actions
38 39
 *
 * @category Output
40
 * @package  StatusNet
41 42
 * @author   Evan Prodromou <evan@status.net>
 * @author   Sarven Capadisli <csarven@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      Widget
47 48
 */

49
class PublicGroupNav extends Widget
50 51 52
{
    var $action = null;

53 54 55 56 57 58
    /**
     * Construction
     *
     * @param Action $action current action, used for output
     */

59 60
    function __construct($action=null)
    {
61
        parent::__construct($action);
62 63 64
        $this->action = $action;
    }

65 66 67 68 69 70
    /**
     * Show the menu
     *
     * @return void
     */

71 72
    function show()
    {
73 74
        $action_name = $this->action->trimmed('action');

sarven's avatar
sarven committed
75
        $this->action->elementStart('ul', array('class' => 'nav'));
76

77 78 79
        if (Event::handle('StartPublicGroupNav', array($this))) {
            $this->out->menuItem(common_local_url('public'), _('Public'),
                _('Public timeline'), $action_name == 'public', 'nav_timeline_public');
80

81 82
            $this->out->menuItem(common_local_url('groups'), _('Groups'),
                _('User groups'), $action_name == 'groups', 'nav_groups');
83

84 85
            $this->out->menuItem(common_local_url('publictagcloud'), _('Recent tags'),
                _('Recent tags'), $action_name == 'publictagcloud', 'nav_recent-tags');
86

Shashi Gowda's avatar
Shashi Gowda committed
87 88 89 90
            $this->out->menuItem(common_local_url('publicpeopletagcloud'), _('People tags'),
                _('People tags'), in_array($action_name, array('publicpeopletagcloud',
                                    'peopletag', 'selftag')), 'nav_people-tags');

91 92 93 94
            if (count(common_config('nickname', 'featured')) > 0) {
                $this->out->menuItem(common_local_url('featured'), _('Featured'),
                    _('Featured users'), $action_name == 'featured', 'nav_featured');
            }
95

96 97
            $this->out->menuItem(common_local_url('favorited'), _('Popular'),
                _("Popular notices"), $action_name == 'favorited', 'nav_timeline_favorited');
98

99 100
            Event::handle('EndPublicGroupNav', array($this));
        }
101
        $this->action->elementEnd('ul');
102 103
    }
}