]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added methods for managing the order of photos in the album
authorCash Costello <cash.costello@gmail.com>
Fri, 30 Jul 2010 02:15:39 +0000 (02:15 +0000)
committerCash Costello <cash.costello@gmail.com>
Fri, 30 Jul 2010 02:15:39 +0000 (02:15 +0000)
lib/album.php

index 7cd27dcde28c2c78185622e98f63087b5b910e93..1eaabd3ba4c3feb116d4173950f1fbda62d52c3c 100644 (file)
@@ -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);
+       }
 }