aboutsummaryrefslogtreecommitdiff
path: root/actions/friends/collections
diff options
context:
space:
mode:
Diffstat (limited to 'actions/friends/collections')
-rw-r--r--actions/friends/collections/add.php31
-rw-r--r--actions/friends/collections/delete.php23
-rw-r--r--actions/friends/collections/edit.php23
3 files changed, 77 insertions, 0 deletions
diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php
new file mode 100644
index 000000000..9dc17b37e
--- /dev/null
+++ b/actions/friends/collections/add.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Elgg collection add page
+ *
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
+ */
+
+$collection_name = get_input('collection_name');
+$friends = get_input('friends_collection');
+
+if (!$collection_name) {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+}
+
+$id = create_access_collection($collection_name);
+
+if ($id) {
+ $result = update_access_collection($id, $friends);
+ if ($result) {
+ system_message(elgg_echo("friends:collectionadded"));
+ forward("collections/" . elgg_get_logged_in_user_entity()->username);
+ } else {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+ }
+} else {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+} \ No newline at end of file
diff --git a/actions/friends/collections/delete.php b/actions/friends/collections/delete.php
new file mode 100644
index 000000000..ff8f1fb55
--- /dev/null
+++ b/actions/friends/collections/delete.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Elgg friends: delete collection action
+ *
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
+ */
+
+$collection_id = (int) get_input('collection');
+
+// check the ACL exists and we can edit
+if (!can_edit_access_collection($collection_id)) {
+ register_error(elgg_echo("friends:collectiondeletefailed"));
+ forward(REFERER);
+}
+
+if (delete_access_collection($collection_id)) {
+ system_message(elgg_echo("friends:collectiondeleted"));
+} else {
+ register_error(elgg_echo("friends:collectiondeletefailed"));
+}
+
+forward(REFERER);
diff --git a/actions/friends/collections/edit.php b/actions/friends/collections/edit.php
new file mode 100644
index 000000000..9eb5e1eab
--- /dev/null
+++ b/actions/friends/collections/edit.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Friends collection edit action
+ *
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
+ */
+
+$collection_id = get_input('collection_id');
+$friends = get_input('friend');
+
+// check it exists and we can edit
+if (!can_edit_access_collection($collection_id)) {
+ system_message(elgg_echo('friends:collection:edit_failed'));
+}
+
+if (update_access_collection($collection_id, $friends)) {
+ system_message(elgg_echo('friends:collections:edited'));
+} else {
+ system_message(elgg_echo('friends:collection:edit_failed'));
+}
+
+forward(REFERER); \ No newline at end of file