]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #19. Handling offset and limit in SQL to avoid pagination problems.
authorBrett Profitt <brett.profitt@gmail.com>
Sat, 10 Mar 2012 02:03:58 +0000 (18:03 -0800)
committerBrett Profitt <brett.profitt@gmail.com>
Sat, 10 Mar 2012 02:03:58 +0000 (18:03 -0800)
lib/tidypics.php

index 38c6b31a8dde43fb2db7209e00d0faec83b2d155..1b230cbe250b86414865100f85864c4da80e9679 100644 (file)
@@ -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);
 }