diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2012-03-09 18:03:58 -0800 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2012-03-09 18:03:58 -0800 |
commit | 51f020d059980aaa391d90cb9aedbb89286dd620 (patch) | |
tree | 0cd83e42fbdd0fb95c2a24f3c92516ac23ec6cb8 /lib/tidypics.php | |
parent | 2245c9d883959db535f5380ea8d5278982c05b5b (diff) | |
download | elgg-51f020d059980aaa391d90cb9aedbb89286dd620.tar.gz elgg-51f020d059980aaa391d90cb9aedbb89286dd620.tar.bz2 |
Fixes #19. Handling offset and limit in SQL to avoid pagination problems.
Diffstat (limited to 'lib/tidypics.php')
-rw-r--r-- | lib/tidypics.php | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |