]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/all.php
fa1be8c9628372c93fb7edafa4259f437d5e6c3c
[quix0rs-gnu-social.git] / actions / all.php
1 <?php
2
3 class AllAction extends ShowstreamAction {
4
5         // XXX: push this up to a common function.
6         
7         function show_notices($profile) {
8
9                 $notice = DB_DataObject::factory('notice');
10                 
11                 # XXX: chokety and bad
12                 
13                 $notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = {$profile->id})', 'OR');
14                 $notice->whereAdd('profile_id = {$profile->id}', 'OR');
15                 
16                 $notice->orderBy('created DESC');
17                 
18                 $page = $this->arg('page') || 1;
19                 
20                 $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
21                 
22                 $notice->find();
23                 
24                 common_start_element('div', 'notices');
25
26                 while ($notice->fetch()) {
27                         $this->show_notice($notice);
28                 }
29                 
30                 common_end_element('div');
31         }
32 }