aboutsummaryrefslogtreecommitdiff
path: root/actions/toggle_personal_calendar.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-06-28 18:12:41 -0400
committerCash Costello <cash.costello@gmail.com>2011-06-28 18:12:41 -0400
commit29792a9858484266952a53268e4fd0dd29b2f4a5 (patch)
treebad977e423a6d1193d362295611fe4472c2373af /actions/toggle_personal_calendar.php
parent1dd01c7ff9685995b4bc9de0ceeb7856086c3f40 (diff)
downloadelgg-29792a9858484266952a53268e4fd0dd29b2f4a5.tar.gz
elgg-29792a9858484266952a53268e4fd0dd29b2f4a5.tar.bz2
moved the code into the base directory so that it is easier to work with
Diffstat (limited to 'actions/toggle_personal_calendar.php')
-rw-r--r--actions/toggle_personal_calendar.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/actions/toggle_personal_calendar.php b/actions/toggle_personal_calendar.php
new file mode 100644
index 000000000..f36b5836f
--- /dev/null
+++ b/actions/toggle_personal_calendar.php
@@ -0,0 +1,30 @@
+<?php
+$event_id = get_input('event_id',0);
+$user_id = get_input('user_id',get_loggedin_userid());
+$other = get_input('other','');
+$success = '@s@';
+$failure = '@f@';
+if ($other) {
+ $remove_response = elgg_echo('event_calendar:add_to_the_calendar');
+ $add_response = elgg_echo('event_calendar:remove_from_the_calendar');
+ $add_error = elgg_echo('event_calendar:add_to_the_calendar_error');
+} else {
+ $remove_response = $success.elgg_echo('event_calendar:remove_from_my_calendar_response');
+ $add_response = $success.elgg_echo('event_calendar:add_to_my_calendar_response');
+ $add_error = $failure.elgg_echo('event_calendar:add_to_my_calendar_error');
+}
+// three character prefix to indicate success or failure
+
+if (event_calendar_has_personal_event($event_id,$user_id)) {
+ event_calendar_remove_personal_event($event_id,$user_id);
+ echo $remove_response;
+} else {
+ if (event_calendar_add_personal_event($event_id,$user_id)) {
+ echo $success.$add_response;
+ } else {
+ echo $failure.$add_error;
+ }
+}
+
+exit;
+?> \ No newline at end of file