aboutsummaryrefslogtreecommitdiff
path: root/lib/tidypics.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-07-13 22:43:52 -0400
committerCash Costello <cash.costello@gmail.com>2012-07-13 22:43:52 -0400
commit919ae814fa2b651072b5bbb901e2183220a0dd30 (patch)
tree2c6a8c50486da6deecb9a6413b62e734c2cc5c44 /lib/tidypics.php
parente790d7ec5d74c5a2279d6bd73e2508eb18209da9 (diff)
parente6e33ca1a7afb00a855f57df5a5263674b23c93c (diff)
downloadelgg-919ae814fa2b651072b5bbb901e2183220a0dd30.tar.gz
elgg-919ae814fa2b651072b5bbb901e2183220a0dd30.tar.bz2
Pull in several small fixes from Brett's fork
Diffstat (limited to 'lib/tidypics.php')
-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);
}