aboutsummaryrefslogtreecommitdiff
path: root/mod/lightbox/classes
diff options
context:
space:
mode:
Diffstat (limited to 'mod/lightbox/classes')
-rw-r--r--mod/lightbox/classes/LightboxPluginAlbum.php31
-rw-r--r--mod/lightbox/classes/LightboxPluginImage.php31
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();
+ }
+}