3 * Laconica, the distributed open-source microblogging tool
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 Evan Prodromou <evan@controlyourself.ca>
25 * @copyright 2008-2009 Control Yourself, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://laconi.ca/
30 if (!defined('LACONICA')) {
34 require_once INSTALLDIR.'/lib/personalgroupnav.php';
35 require_once INSTALLDIR.'/lib/noticelist.php';
36 require_once INSTALLDIR.'/lib/feedlist.php';
43 * @author Evan Prodromou <evan@controlyourself.ca>
44 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
45 * @link http://laconi.ca/
48 class RepliesAction extends Action
56 * Check the input values and initialize the object.
57 * Shows an error page on bad input.
59 * @param array $args $_REQUEST data
61 * @return boolean success flag
64 function prepare($args)
66 parent::prepare($args);
68 $nickname = common_canonical_nickname($this->arg('nickname'));
70 $this->user = User::staticGet('nickname', $nickname);
73 $this->clientError(_('No such user.'));
77 $profile = $this->user->getProfile();
80 $this->serverError(_('User has no profile.'));
84 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
86 common_set_returnto($this->selfUrl());
94 * Just show the page. All args already handled.
96 * @param array $args $_REQUEST data
101 function handle($args)
103 parent::handle($args);
110 * Includes name of user and page number.
112 * @return string title of page
117 if ($this->page == 1) {
118 return sprintf(_("Replies to %s"), $this->user->nickname);
120 return sprintf(_("Replies to %s, page %d"),
121 $this->user->nickname,
127 * Feeds for the <head> section
134 $rssurl = common_local_url('repliesrss',
135 array('nickname' => $this->user->nickname));
136 $rsstitle = sprintf(_('Feed for replies to %s'), $this->user->nickname);
138 $this->element('link', array('rel' => 'alternate',
140 'type' => 'application/rss+xml',
141 'title' => $rsstitle));
145 * Output document relationship links
149 function showRelationshipLinks()
151 $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
152 $this->page, 'replies', array('nickname' => $this->user->nickname));
156 * show the personal group nav
161 function showLocalNav()
163 $nav = new PersonalGroupNav($this);
168 * Show the replies feed links
173 function showExportData()
175 $fl = new FeedList($this);
177 $rssurl = common_local_url('repliesrss',
178 array('nickname' => $this->user->nickname));
180 $fl->show(array(0=>array('href'=> $rssurl,
182 'version' => 'RSS 1.0',
183 'item' => 'repliesrss')));
189 * A list of notices that are replies to the user, plus pagination.
194 function showContent()
196 $notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
197 NOTICES_PER_PAGE + 1);
199 $nl = new NoticeList($notice, $this);
203 $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
204 $this->page, 'replies',
205 array('nickname' => $this->user->nickname));
208 function isReadOnly()