diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-07-30 02:15:39 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-07-30 02:15:39 +0000 |
commit | d77e8fd4cb76560ae2f1c180cc9ccbcde7e3942a (patch) | |
tree | e267556872c56507e337ae31a9e10ad7754594a2 | |
parent | 9c0cc73e8ff5c389482579452312ca67e9c01a2c (diff) | |
download | elgg-d77e8fd4cb76560ae2f1c180cc9ccbcde7e3942a.tar.gz elgg-d77e8fd4cb76560ae2f1c180cc9ccbcde7e3942a.tar.bz2 |
added methods for managing the order of photos in the album
-rw-r--r-- | lib/album.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/album.php b/lib/album.php index 7cd27dcde..1eaabd3ba 100644 --- a/lib/album.php +++ b/lib/album.php @@ -16,4 +16,39 @@ class TidypicsAlbum extends ElggObject { public function __construct($guid = null) { parent::__construct($guid); } + + /** + * Returns an order list of image guids + * + * @return array + */ + public function getOrderedImageList() { + $listString = $this->orderedImages; + if (!$listString) { + return array(); + } + $list = unserialize($listString); + return $list; + } + + /** + * Sets the album image order + * + * @param array $list An indexed array of image guids + */ + public function setOrderedImageList($list) { + $listString = serialize($list); + $this->orderedImages = $listString; + } + + /** + * Add new images to the front of the image list + * + * @param array $list An indexed array of image guids + */ + public function prependOrderedImageList($list) { + $currentList = $this->getOrderedImageList(); + $list = array_merge($list, $currentList); + $this->setOrderedImageList($list); + } } |