aboutsummaryrefslogtreecommitdiff
path: root/mod/lightpics/actions/photos/album
diff options
context:
space:
mode:
Diffstat (limited to 'mod/lightpics/actions/photos/album')
-rw-r--r--mod/lightpics/actions/photos/album/save.php48
-rw-r--r--mod/lightpics/actions/photos/album/set_cover.php23
-rw-r--r--mod/lightpics/actions/photos/album/sort.php21
3 files changed, 92 insertions, 0 deletions
diff --git a/mod/lightpics/actions/photos/album/save.php b/mod/lightpics/actions/photos/album/save.php
new file mode 100644
index 000000000..cc7181678
--- /dev/null
+++ b/mod/lightpics/actions/photos/album/save.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Save album action
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+
+// Get input data
+$title = get_input('title');
+$description = get_input('description');
+$tags = get_input('tags');
+$access_id = get_input('access_id');
+$container_guid = get_input('container_guid', elgg_get_logged_in_user_guid());
+$guid = get_input('guid');
+
+elgg_make_sticky_form('tidypics');
+
+if (empty($title)) {
+ register_error(elgg_echo("album:blank"));
+ forward(REFERER);
+}
+
+if ($guid) {
+ $album = get_entity($guid);
+} else {
+ $album = new TidypicsAlbum();
+}
+
+$album->container_guid = $container_guid;
+$album->owner_guid = elgg_get_logged_in_user_guid();
+$album->access_id = $access_id;
+$album->title = $title;
+$album->description = $description;
+if ($tags) {
+ $album->tags = string_to_tag_array($tags);
+}
+
+if (!$album->save()) {
+ register_error(elgg_echo("album:error"));
+ forward(REFERER);
+}
+
+elgg_clear_sticky_form('tidypics');
+
+system_message(elgg_echo("album:created"));
+forward($album->getURL());
diff --git a/mod/lightpics/actions/photos/album/set_cover.php b/mod/lightpics/actions/photos/album/set_cover.php
new file mode 100644
index 000000000..b37bb9c90
--- /dev/null
+++ b/mod/lightpics/actions/photos/album/set_cover.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Set album cover image
+ */
+
+// Get input data
+$album_guid = get_input('album_guid');
+$image_guid = get_input('image_guid');
+
+$album = get_entity($album_guid);
+
+if (!elgg_instanceof($album, 'object', 'album')) {
+ register_error(elgg_echo('album:invalid_album'));
+ forward(REFERER);
+}
+
+if ($album->setCoverImageGuid($image_guid)) {
+ system_message(elgg_echo('album:save_cover_image'));
+ forward(REFERER);
+} else {
+ register_error(elgg_echo('album:cannot_save_cover_image'));
+ forward(REFERER);
+} \ No newline at end of file
diff --git a/mod/lightpics/actions/photos/album/sort.php b/mod/lightpics/actions/photos/album/sort.php
new file mode 100644
index 000000000..fd62a7ba7
--- /dev/null
+++ b/mod/lightpics/actions/photos/album/sort.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Sorting album action - takes a comma separated list of image guids
+ */
+
+$album_guid = get_input('album_guid');
+$album = get_entity($album_guid);
+if (!$album) {
+
+}
+
+$guids = get_input('guids');
+$guids = explode(',', $guids);
+
+if ($album->setImageList($guids)) {
+ system_message(elgg_echo('tidypics:album:sorted', array($album->getTitle())));
+} else {
+ register_error(elgg_echo('tidypics:album:could_not_sort', array($album->getTitle())));
+}
+
+forward($album->getURL()); \ No newline at end of file