pagination for group inbox

This commit is contained in:
Evan Prodromou 2011-02-07 12:08:18 -05:00
parent 20824292c9
commit e759b15a92
2 changed files with 21 additions and 2 deletions

View File

@ -119,7 +119,13 @@ class GroupinboxAction extends GroupDesignAction
function showContent() function showContent()
{ {
$gml = new GroupMessageList($this, $this->gm); $gml = new GroupMessageList($this, $this->gm);
$gml->show(); $cnt = $gml->show();
$this->pagination($this->page > 1,
$cnt > MESSAGES_PER_PAGE,
$this->page,
'groupinbox',
array('nickname' => $this->group->nickname));
} }
/** /**

View File

@ -68,10 +68,23 @@ class GroupMessageList extends Widget
function show() function show()
{ {
$this->out->elementStart('ul', 'notices messages group-messages'); $this->out->elementStart('ul', 'notices messages group-messages');
while ($this->gm->fetch()) {
$cnt = 0;
while ($this->gm->fetch() && $cnt <= MESSAGES_PER_PAGE) {
$cnt++;
if ($cnt > MESSAGES_PER_PAGE) {
break;
}
$gmli = new GroupMessageListItem($this->out, $this->gm); $gmli = new GroupMessageListItem($this->out, $this->gm);
$gmli->show(); $gmli->show();
} }
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
return $cnt;
} }
} }