From d77e8fd4cb76560ae2f1c180cc9ccbcde7e3942a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 30 Jul 2010 02:15:39 +0000 Subject: added methods for managing the order of photos in the album --- lib/album.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'lib') 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); + } } -- cgit v1.2.3