]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
getting photos by page is now static.
authorIan Denhardt <ian@zenhack.net>
Sat, 4 Sep 2010 21:51:17 +0000 (17:51 -0400)
committerIan Denhardt <ian@zenhack.net>
Sat, 4 Sep 2010 21:51:17 +0000 (17:51 -0400)
plugins/GNUsocialPhotos/actions/photos.php
plugins/GNUsocialPhotos/classes/gnusocialphoto.php

index fd014efdeb3dc645dd99a4f4a61b6e99d9a6de1c..83060dc57375a6e47b0181cdc1256d516437d92a 100644 (file)
@@ -87,8 +87,7 @@ class PhotosAction extends Action
             $username = $pathparts[0];
             $this->elementStart('ul', array('class' => 'photothumbs'));
 
-                       $photo_obj= new GNUsocialPhoto();
-                       $photos = $photo_obj->getGalleryPage(1, 0, 9);
+                       $photos = GNUsocialPhoto::getGalleryPage(1, 0, 9);
 
             foreach ($photos as $photo) {
                 $this->elementStart('li');
index f218d570f4c42d9da56f3fc776706825b76c3dbc..3ff0e494dc96b9a22f4cb4631b118684005c761e 100644 (file)
@@ -109,18 +109,19 @@ class GNUsocialPhoto extends Memcached_DataObject
      * @param int gallery_size The number of thumbnails to show per page in the gallery.
      * @return array Array of GNUsocialPhotos for this gallery page.
      */
-    function getGalleryPage($page_id, $album_id, $gallery_size)
+    static function getGalleryPage($page_id, $album_id, $gallery_size)
     {
                $page_offset = ($page_id-1) * $gallery_size; 
-        $sql = 'SELECT * FROM GNUsocialPhoto order by notice_id limit ' . $page_offset . ',' . $gallery_size; 
-        $this->query($sql);
-        $thumbs = array();
+        $sql = 'SELECT * FROM GNUsocialPhoto order by notice_id limit ' . $page_offset . ',' . $gallery_size;
+        $photo = new GNUsocialPhoto();
+        $photo->query($sql);
+        $photos = array();
 
-        while ($this->fetch()) {
-            $thumbs[] = clone($this);
+        while ($photo->fetch()) {
+            $photos[] = clone($photo);
         }
 
-        return $thumbs;
+        return $photos;
     }
 
     /*