aboutsummaryrefslogtreecommitdiff
path: root/classes/TidypicsAlbum.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-11 20:59:29 -0500
committercash <cash.costello@gmail.com>2011-12-11 20:59:29 -0500
commitbe3479085d475428a213868e13e8504e924e32ba (patch)
tree4039eb0fc64185a9531d6b2dd9a135dcca225425 /classes/TidypicsAlbum.php
parent67ce751dec9442ccef35bdbe596f9832b3b11c22 (diff)
downloadelgg-be3479085d475428a213868e13e8504e924e32ba.tar.gz
elgg-be3479085d475428a213868e13e8504e924e32ba.tar.bz2
added navigation when viewing full image
Diffstat (limited to 'classes/TidypicsAlbum.php')
-rw-r--r--classes/TidypicsAlbum.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php
index e5a8e2c0c..e04344a6b 100644
--- a/classes/TidypicsAlbum.php
+++ b/classes/TidypicsAlbum.php
@@ -207,41 +207,45 @@ class TidypicsAlbum extends ElggObject {
}
/**
- * Get the GUID of the image before the current one
+ * Get the previous image in the album
*
- * @param int $currentGuid
- * @return int
+ * @param int $guid GUID of the current image
+ * @return TidypicsImage
*/
- public function getPreviousImageGuid($currentGuid) {
+ public function getPreviousImage($guid) {
$imageList = $this->getImageList();
- $key = array_search($currentGuid, $imageList);
+ $key = array_search($guid, $imageList);
if ($key === FALSE) {
- return 0;
+ return null;
}
$key--;
if ($key < 0) {
- return 0;
+ return get_entity(end($imageList));
}
- return $imageList[$key];
+ return get_entity($imageList[$key]);
}
/**
- * Get the GUID of the image after the current one
+ * Get the next image in the album
*
- * @param int $currentGuid
- * @return int
+ * @param int $guid GUID of the current image
+ * @return TidypicsImage
*/
- public function getNextImageGuid($currentGuid) {
+ public function getNextImage($guid) {
$imageList = $this->getImageList();
- $key = array_search($currentGuid, $imageList);
+ $key = array_search($guid, $imageList);
if ($key === FALSE) {
- return 0;
+ return null;
}
$key++;
if ($key >= count($imageList)) {
- return 0;
+ return get_entity($imageList[0]);
}
- return $imageList[$key];
+ return get_entity($imageList[$key]);
+ }
+
+ public function getIndex($guid) {
+ return array_search($guid, $this->getImageList()) + 1;
}
/**