From e759b15a92f48c2be32388c948571eaa3006f383 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 7 Feb 2011 12:08:18 -0500 Subject: [PATCH] pagination for group inbox --- plugins/GroupPrivateMessage/groupinbox.php | 8 +++++++- plugins/GroupPrivateMessage/groupmessagelist.php | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) 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; } } -- 2.39.5