diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:04:14 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:04:14 -0300 |
commit | 4a86fa9b2e63b9d6bb0a07333d4c7d59df621270 (patch) | |
tree | 5770bd548bc70a10dbd5c24aee13c3449bf428a9 /mod/lightbox/classes | |
parent | d7317abf01cc1f5a6e4ee54f25664e51d23217b9 (diff) | |
parent | 66dd3f3f5f14bb0ba6d2c7ef83b5b612d5ee2e30 (diff) | |
download | elgg-4a86fa9b2e63b9d6bb0a07333d4c7d59df621270.tar.gz elgg-4a86fa9b2e63b9d6bb0a07333d4c7d59df621270.tar.bz2 |
Merge commit '66dd3f3f5f14bb0ba6d2c7ef83b5b612d5ee2e30' as 'mod/lightbox'
Diffstat (limited to 'mod/lightbox/classes')
-rw-r--r-- | mod/lightbox/classes/LightboxPluginAlbum.php | 31 | ||||
-rw-r--r-- | mod/lightbox/classes/LightboxPluginImage.php | 31 |
2 files changed, 62 insertions, 0 deletions
diff --git a/mod/lightbox/classes/LightboxPluginAlbum.php b/mod/lightbox/classes/LightboxPluginAlbum.php new file mode 100644 index 000000000..de272d981 --- /dev/null +++ b/mod/lightbox/classes/LightboxPluginAlbum.php @@ -0,0 +1,31 @@ +<?php + +/** + * Override the ElggObject + */ +class LightboxPluginAlbum extends ElggObject { + protected function initializeAttributes() { + parent::initializeAttributes(); + + $this->attributes['subtype'] = "album"; + } + + public function __construct($guid = null) { + parent::__construct($guid); + } + + public function attachImages($images) { + foreach($images as $image) { + if($image instanceof LightboxPluginImage) { + $this->addRelationship($image->guid, 'in_album'); + } else { + return false; + } + } + return true; + } + + public function delete() { + return parent::delete(); + } +} diff --git a/mod/lightbox/classes/LightboxPluginImage.php b/mod/lightbox/classes/LightboxPluginImage.php new file mode 100644 index 000000000..6d2b6bbea --- /dev/null +++ b/mod/lightbox/classes/LightboxPluginImage.php @@ -0,0 +1,31 @@ +<?php + +/** + * Override the ElggFile + */ +class LightboxPluginImage extends ElggFile { + protected function initializeAttributes() { + parent::initializeAttributes(); + + $this->attributes['subtype'] = "image"; + } + + public function __construct($guid = null) { + parent::__construct($guid); + } + + public function delete() { + + $thumbnails = array($this->thumbnail, $this->smallthumb, $this->largethumb); + foreach ($thumbnails as $thumbnail) { + if ($thumbnail) { + $delfile = new ElggFile(); + $delfile->owner_guid = $this->owner_guid; + $delfile->setFilename($thumbnail); + $delfile->delete(); + } + } + + return parent::delete(); + } +} |