diff options
author | Ian Denhardt <ian@zenhack.net> | 2010-09-04 17:51:17 -0400 |
---|---|---|
committer | Ian Denhardt <ian@zenhack.net> | 2010-09-04 17:51:17 -0400 |
commit | 9c24236b592a8f98a5b64d638e202a507de335f9 (patch) | |
tree | 305a935f09397baf27b44c6efb604e06489edd12 | |
parent | 70c1a9a506a6c6905fe25ffd7decfdfa5775f327 (diff) |
getting photos by page is now static.
-rw-r--r-- | plugins/GNUsocialPhotos/actions/photos.php | 3 | ||||
-rw-r--r-- | plugins/GNUsocialPhotos/classes/gnusocialphoto.php | 15 |
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php index fd014efde..83060dc57 100644 --- a/plugins/GNUsocialPhotos/actions/photos.php +++ b/plugins/GNUsocialPhotos/actions/photos.php @@ -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'); diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php index f218d570f..3ff0e494d 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php @@ -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; } /* |