aboutsummaryrefslogtreecommitdiff
path: root/lib/album.php
blob: 1eaabd3ba4c3feb116d4173950f1fbda62d52c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
 * Tidypics Album class
 *
 * @package TidypicsAlbum
 */


class TidypicsAlbum extends ElggObject {
	protected function initialise_attributes() {
		parent::initialise_attributes();

		$this->attributes['subtype'] = "album";
	}

	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);
	}
}