diff options
-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); + } } |