From: Evan Prodromou Date: Mon, 7 Feb 2011 17:08:18 +0000 (-0500) Subject: pagination for group inbox X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e759b15a92f48c2be32388c948571eaa3006f383;p=quix0rs-gnu-social.git pagination for group inbox --- diff --git a/plugins/GroupPrivateMessage/groupinbox.php b/plugins/GroupPrivateMessage/groupinbox.php index 55bf4b0ee2..409f59aa1c 100644 --- a/plugins/GroupPrivateMessage/groupinbox.php +++ b/plugins/GroupPrivateMessage/groupinbox.php @@ -119,7 +119,13 @@ class GroupinboxAction extends GroupDesignAction function showContent() { $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)); } /** diff --git a/plugins/GroupPrivateMessage/groupmessagelist.php b/plugins/GroupPrivateMessage/groupmessagelist.php index 09f453d520..fb49f5c239 100644 --- a/plugins/GroupPrivateMessage/groupmessagelist.php +++ b/plugins/GroupPrivateMessage/groupmessagelist.php @@ -68,10 +68,23 @@ class GroupMessageList extends Widget function show() { $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->show(); } + $this->out->elementEnd('ul'); + + return $cnt; } }