aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/tidypics.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/tidypics.php b/lib/tidypics.php
index 38c6b31a8..16773f982 100644
--- a/lib/tidypics.php
+++ b/lib/tidypics.php
@@ -59,6 +59,12 @@ function tp_get_img_dir() {
return $file->getFilenameOnFilestore() . 'image/';
}
+/**
+ * Prepare vars for a form, pulling from an entity or sticky forms.
+ *
+ * @param type $entity
+ * @return type
+ */
function tidypics_prepare_form_vars($entity = null) {
// input names => defaults
$values = array(
@@ -91,6 +97,11 @@ function tidypics_prepare_form_vars($entity = null) {
return $values;
}
+/**
+ * Returns available image libraries.
+ *
+ * @return string
+ */
function tidypics_get_image_libraries() {
$options = array();
if (extension_loaded('gd')) {
@@ -144,6 +155,11 @@ function tidypics_is_upgrade_available() {
/**
* This lists the photos in an album as sorted by metadata
*
+ * @todo this only supports a single album. The only case for use a
+ * procedural function like this instead of TidypicsAlbum::viewImgaes() is to
+ * fetch images across albums as a helper to elgg_get_entities().
+ * This should function be deprecated or fixed to work across albums.
+ *
* @param array $options
* @return string
*/
@@ -167,7 +183,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']);
}
@@ -178,6 +196,7 @@ function tidypics_list_photos(array $options = array()) {
foreach ($entities as $entity) {
$keys[] = $entity->guid;
}
+ var_dump($options);
$entities = array_combine($keys, $entities);
$sorted_entities = array();
@@ -187,6 +206,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);
}