]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/replynoticestream.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / lib / replynoticestream.php
1 <?php
2
3 class ReplyNoticeStream extends CachingNoticeStream
4 {
5     function __construct($userId)
6     {
7         parent::__construct(new RawReplyNoticeStream($userId),
8                             'reply:stream:' . $userId);
9     }
10 }
11
12 class RawReplyNoticeStream extends NoticeStream
13 {
14     protected $userId;
15
16     function __construct($userId)
17     {
18         $this->userId = $userId;
19     }
20
21     function getNoticeIds($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0)
22     {
23         $reply = new Reply();
24         $reply->profile_id = $this->userId;
25
26         Notice::addWhereSinceId($reply, $since_id, 'notice_id', 'modified');
27         Notice::addWhereMaxId($reply, $max_id, 'notice_id', 'modified');
28
29         $reply->orderBy('modified DESC, notice_id DESC');
30
31         if (!is_null($offset)) {
32             $reply->limit($offset, $limit);
33         }
34
35         $ids = array();
36
37         if ($reply->find()) {
38             while ($reply->fetch()) {
39                 $ids[] = $reply->notice_id;
40             }
41         }
42
43         return $ids;
44     }
45 }