aboutsummaryrefslogtreecommitdiff
path: root/classes
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 /classes
parente790d7ec5d74c5a2279d6bd73e2508eb18209da9 (diff)
parente6e33ca1a7afb00a855f57df5a5263674b23c93c (diff)
downloadelgg-919ae814fa2b651072b5bbb901e2183220a0dd30.tar.gz
elgg-919ae814fa2b651072b5bbb901e2183220a0dd30.tar.bz2
Pull in several small fixes from Brett's fork
Diffstat (limited to 'classes')
-rw-r--r--classes/TidypicsAlbum.php36
1 files changed, 28 insertions, 8 deletions
diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php
index 3d7d12b32..ad1a357de 100644
--- a/classes/TidypicsAlbum.php
+++ b/classes/TidypicsAlbum.php
@@ -110,21 +110,41 @@ class TidypicsAlbum extends ElggObject {
/**
* View a list of images
*
- * @param int $limit
- * @param int $offset
+ * @param array $options Options to pass to elgg_view_entity_list()
* @return string
*/
- public function viewImages($limit, $offset = 0) {
- $images = $this->getImages($limit, $offset);
- if (count($images) == 0) {
+ public function viewImages(array $options = array()) {
+ $count = $this->getSize();
+
+ if ($count == 0) {
return '';
}
- $count = $this->getSize();
+ $defaults = array(
+ 'count' => $count,
+ 'limit' => 16,
+ 'offset' => max(get_input('offset'), 0),
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'pagination' => true,
+ 'gallery_class' => 'tidypics-gallery',
+ );
+
+ $options = array_merge($defaults, (array) $options);
+ $images = $this->getImages($options['limit'], $options['offset']);
- return elgg_view_entity_list($images, $count, $offset, $limit, false, false, true);
+ if (count($images) == 0) {
+ return '';
+ }
+
+ return elgg_view_entity_list($images, $options);
}
+ /**
+ * Returns the cover image entity
+ * @return TidypicsImage
+ */
public function getCoverImage() {
return get_entity($this->getCoverImageGuid());
}
@@ -190,7 +210,7 @@ class TidypicsAlbum extends ElggObject {
$guidsString = implode(',', $list);
$options = array(
'wheres' => array("e.guid IN ($guidsString)"),
- 'order_by' => "FIELD (e.guid, $guidsString)",
+ 'order_by' => "FIELD(e.guid, $guidsString)",
'callback' => 'tp_guid_callback',
'limit' => ELGG_ENTITIES_NO_VALUE
);