3 * StatusNet, the distributed open-source microblogging tool
5 * People tags subscribed to by a user
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Shashi Gowda <connect2shashi@gmail.com>
25 * @copyright 2008-2009 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/
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
34 require_once INSTALLDIR.'/lib/peopletaglist.php';
36 class PeopletagsubscriptionsAction extends OwnerDesignAction
41 function isReadOnly($args)
48 if ($this->page == 1) {
49 return sprintf(_("People tags subscriptions by %s"), $this->profile->nickname);
51 return sprintf(_("People tags subscriptions by %s, page %d"), $this->profile->nickname, $this->page);
55 function prepare($args)
57 parent::prepare($args);
59 $nickname_arg = $this->arg('nickname');
60 $nickname = common_canonical_nickname($nickname_arg);
62 // Permanent redirect on non-canonical nickname
64 if ($nickname_arg != $nickname) {
65 $args = array('nickname' => $nickname);
66 if ($this->arg('page') && $this->arg('page') != 1) {
67 $args['page'] = $this->arg['page'];
69 common_redirect(common_local_url('peopletagsbyuser', $args), 301);
73 $user = User::staticGet('nickname', $nickname);
76 $this->clientError(_('No such user.'), 404);
80 $this->profile = $user->getProfile();
82 if (!$this->profile) {
83 $this->serverError(_('User has no profile.'));
87 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
92 function handle($args)
94 parent::handle($args);
98 function showLocalNav()
100 $nav = new PersonalGroupNav($this);
104 function showAnonymousMessage()
107 sprintf(_('These are people tags subscribed to by **%s**. ' .
108 'People tags are how you sort similar ' .
109 'people on %%%%site.name%%%%, a [micro-blogging]' .
110 '(http://en.wikipedia.org/wiki/Micro-blogging) service ' .
111 'based on the Free Software [StatusNet](http://status.net/) tool. ' .
112 'You can easily keep track of what they ' .
113 'are doing by subscribing to the tag\'s timeline.' ), $this->profile->nickname);
114 $this->elementStart('div', array('id' => 'anon_notice'));
115 $this->raw(common_markup_to_html($notice));
116 $this->elementEnd('div');
119 function showContent()
121 $offset = ($this->page-1) * PEOPLETAGS_PER_PAGE;
122 $limit = PEOPLETAGS_PER_PAGE + 1;
124 $ptags = $this->profile->getTagSubscriptions($offset, $limit);
126 $pl = new PeopletagList($ptags, $this);
129 $this->pagination($this->page > 1, $cnt > PEOPLETAGS_PER_PAGE,
130 $this->page, 'peopletagsubscriptions', array('nickname' => $this->profile->id));
133 function showSections()
135 #TODO: tags with most subscribers
136 #TODO: tags with most "members"