forked from GNUsocial/gnu-social
getting photos by page is now static.
This commit is contained in:
parent
70c1a9a506
commit
9c24236b59
@ -87,8 +87,7 @@ class PhotosAction extends Action
|
|||||||
$username = $pathparts[0];
|
$username = $pathparts[0];
|
||||||
$this->elementStart('ul', array('class' => 'photothumbs'));
|
$this->elementStart('ul', array('class' => 'photothumbs'));
|
||||||
|
|
||||||
$photo_obj= new GNUsocialPhoto();
|
$photos = GNUsocialPhoto::getGalleryPage(1, 0, 9);
|
||||||
$photos = $photo_obj->getGalleryPage(1, 0, 9);
|
|
||||||
|
|
||||||
foreach ($photos as $photo) {
|
foreach ($photos as $photo) {
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
|
@ -109,18 +109,19 @@ class GNUsocialPhoto extends Memcached_DataObject
|
|||||||
* @param int gallery_size The number of thumbnails to show per page in the gallery.
|
* @param int gallery_size The number of thumbnails to show per page in the gallery.
|
||||||
* @return array Array of GNUsocialPhotos for this gallery page.
|
* @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;
|
$page_offset = ($page_id-1) * $gallery_size;
|
||||||
$sql = 'SELECT * FROM GNUsocialPhoto order by notice_id limit ' . $page_offset . ',' . $gallery_size;
|
$sql = 'SELECT * FROM GNUsocialPhoto order by notice_id limit ' . $page_offset . ',' . $gallery_size;
|
||||||
$this->query($sql);
|
$photo = new GNUsocialPhoto();
|
||||||
$thumbs = array();
|
$photo->query($sql);
|
||||||
|
$photos = array();
|
||||||
|
|
||||||
while ($this->fetch()) {
|
while ($photo->fetch()) {
|
||||||
$thumbs[] = clone($this);
|
$photos[] = clone($photo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $thumbs;
|
return $photos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user