From 51f020d059980aaa391d90cb9aedbb89286dd620 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 9 Mar 2012 18:03:58 -0800 Subject: Fixes #19. Handling offset and limit in SQL to avoid pagination problems. --- lib/tidypics.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/tidypics.php') diff --git a/lib/tidypics.php b/lib/tidypics.php index 38c6b31a8..1b230cbe2 100644 --- a/lib/tidypics.php +++ b/lib/tidypics.php @@ -167,7 +167,9 @@ function tidypics_list_photos(array $options = array()) { $album = get_entity($options['container_guid']); if ($album) { $guids = $album->getImageList(); - $guids = array_slice($guids, $options['offset'], $options['limit']); + // need to pass all the guids and handle the limit / offset in sql + // to avoid problems with the navigation + //$guids = array_slice($guids, $options['offset'], $options['limit']); $options['guids'] = $guids; unset($options['container_guid']); } @@ -187,6 +189,10 @@ function tidypics_list_photos(array $options = array()) { } } + // for this function count means the total number of entities + // and is required for pagination + $options['count'] = $count; + return elgg_view_entity_list($sorted_entities, $options); } -- cgit v1.2.3