]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
pagination for group inbox
authorEvan Prodromou <evan@status.net>
Mon, 7 Feb 2011 17:08:18 +0000 (12:08 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 7 Feb 2011 17:08:18 +0000 (12:08 -0500)
plugins/GroupPrivateMessage/groupinbox.php
plugins/GroupPrivateMessage/groupmessagelist.php

index 55bf4b0ee2dabdc850aca24a93322e23577d58a7..409f59aa1c0d3e819648c661a3877915109bd669 100644 (file)
@@ -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));
     }
 
     /**
index 09f453d5206a0ec9a8df3ff414b6ba32c1349f86..fb49f5c239f59a1949ee5fd2aafacc4bfdd7cbbd 100644 (file)
@@ -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;
     }
 }