listsnav.php 2.66 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<?php
/**
 * StatusNet, the distributed open-source microblogging tool
 *
 * Lists a user has created
 *
 * 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/>.
 *
 * @category  Widget
 * @package   StatusNet
 * @author    Shashi Gowda <connect2shashi@gmail.com>
 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 * @link      http://status.net/
 */

if (!defined('STATUSNET') && !defined('LACONICA')) {
    exit(1);
}

/**
 * Peopletags a user has subscribed to
 *
 * @category Widget
 * @package  StatusNet
 * @author   Shashi Gowda <connect2shashi@gmail.com>
 * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 * @link     http://status.net/
 */
Evan Prodromou's avatar
Evan Prodromou committed
42
class ListsNav extends MoreMenu
43 44 45 46 47 48 49 50 51
{
    var $profile=null;
    var $lists=null;

    function __construct($out, Profile $profile)
    {
        parent::__construct($out);
        $this->profile = $profile;

52
        $this->lists = $profile->getLists(Profile::current());
53 54
    }

Evan Prodromou's avatar
Evan Prodromou committed
55
    function tag()
56
    {
Evan Prodromou's avatar
Evan Prodromou committed
57 58
        return 'lists';
    }
59

Evan Prodromou's avatar
Evan Prodromou committed
60 61 62
    function getItems()
    {
        $items = array();
63

Evan Prodromou's avatar
Evan Prodromou committed
64
        while ($this->lists->fetch()) {
65
                $mode = $this->lists->private ? 'private' : 'public';
Evan Prodromou's avatar
Evan Prodromou committed
66
                $items[] = array('showprofiletag',
67
                                 array('nickname' => $this->profile->getNickname(),
Evan Prodromou's avatar
Evan Prodromou committed
68 69 70 71
                                       'tag'    => $this->lists->tag),
                                 $this->lists->tag,
                                 '');
         }
72

Evan Prodromou's avatar
Evan Prodromou committed
73
         return $items;
74 75 76 77 78 79
    }

    function hasLists()
    {
        return (!empty($this->lists) && $this->lists->N > 0);
    }
Evan Prodromou's avatar
Evan Prodromou committed
80 81 82 83 84

    function seeAllItem()
    {
        return array('peopletagsbyuser',
                     array('nickname' => $this->profile->nickname),
85
                     // TRANS: Link description for seeing all lists.
Evan Prodromou's avatar
Evan Prodromou committed
86
                     _('See all'),
87 88
                     // TRANS: Link title for seeing all lists.
                     _('See all lists you have created.'));
Evan Prodromou's avatar
Evan Prodromou committed
89
    }
90
}