- $cnt = $this->_buildTree();
-
- $this->out->elementStart('div', array('id' =>'notices_primary'));
- // TRANS: Header on conversation page. Hidden by default (h2).
- $this->out->element('h2', null, _('Notices'));
- $this->out->elementStart('ol', array('class' => 'notices xoxo'));
-
- if (array_key_exists('root', $this->tree)) {
- $rootid = $this->tree['root'][0];
- $this->showNoticePlus($rootid);
- }
-
- $this->out->elementEnd('ol');
- $this->out->elementEnd('div');
-
- return $cnt;
- }
-
- function _buildTree()
- {
- $cnt = 0;
-
- $this->tree = array();
- $this->table = array();
-
- while ($this->notice->fetch()) {
-
- $cnt++;
-
- $id = $this->notice->id;
- $notice = clone($this->notice);
-
- $this->table[$id] = $notice;
-
- if (is_null($notice->reply_to)) {
- $this->tree['root'] = array($notice->id);
- } else if (array_key_exists($notice->reply_to, $this->tree)) {
- $this->tree[$notice->reply_to][] = $notice->id;
- } else {
- $this->tree[$notice->reply_to] = array($notice->id);
- }
- }
-
- return $cnt;
- }
-
- /**
- * Shows a notice plus its list of children.
- *
- * @param integer $id ID of the notice to show
- *
- * @return void
- */
- function showNoticePlus($id)
- {
- $notice = $this->table[$id];
-
- // We take responsibility for doing the li
-
- $this->out->elementStart('li', array('class' => 'hentry notice',
- 'id' => 'notice-' . $id));
-
- $item = $this->newListItem($notice);
- $item->show();
-
- if (array_key_exists($id, $this->tree)) {
- $children = $this->tree[$id];
-
- $this->out->elementStart('ol', array('class' => 'notices'));
-
- sort($children);
-
- foreach ($children as $child) {
- $this->showNoticePlus($child);
- }
-
- $this->out->elementEnd('ol');
- }
-
- $this->out->elementEnd('li');
- }
-
- /**
- * Override parent class to return our preferred item.
- *
- * @param Notice $notice Notice to display
- *
- * @return NoticeListItem a list item to show
- */
- function newListItem($notice)
- {
- return new ConversationTreeItem($notice, $this->out);
+
+ return array(new Feed(Feed::JSON,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->id,
+ 'format' => 'as')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (Activity Streams JSON)')),
+ new Feed(Feed::RSS2,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->id,
+ 'format' => 'rss')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (RSS 2.0)')),
+ new Feed(Feed::ATOM,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->id,
+ 'format' => 'atom')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (Activity Streams JSON)')));