From 2557245a41579a15dd960e2033f4d5f39ff566ac Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Mon, 29 Aug 2011 20:59:54 +0200 Subject: first step in rewrite for Elgg 1.8 --- actions/event_calendar/add_personal.php | 17 ++++++++ actions/event_calendar/delete.php | 21 +++++++++ actions/event_calendar/edit.php | 51 ++++++++++++++++++++++ actions/event_calendar/remove_personal.php | 12 +++++ .../event_calendar/request_personal_calendar.php | 16 +++++++ 5 files changed, 117 insertions(+) create mode 100644 actions/event_calendar/add_personal.php create mode 100644 actions/event_calendar/delete.php create mode 100644 actions/event_calendar/edit.php create mode 100644 actions/event_calendar/remove_personal.php create mode 100644 actions/event_calendar/request_personal_calendar.php (limited to 'actions/event_calendar') diff --git a/actions/event_calendar/add_personal.php b/actions/event_calendar/add_personal.php new file mode 100644 index 000000000..fd6f6cee2 --- /dev/null +++ b/actions/event_calendar/add_personal.php @@ -0,0 +1,17 @@ +canEdit()) { + if (get_input('cancel','')) { + system_message(elgg_echo('event_calendar:delete_cancel_response')); + } else { + $container = get_entity($event->container_guid); + $event->delete(); + system_message(elgg_echo('event_calendar:delete_response')); + if (elgg_instanceof($container,'group')) { + forward('event_calendar/group/'.$container->guid); + } else { + forward('event_calendar/list'); + } + } +} else { + register_error(elgg_echo('event_calendar:error_delete')); +} + +forward(REFERER); \ No newline at end of file diff --git a/actions/event_calendar/edit.php b/actions/event_calendar/edit.php new file mode 100644 index 000000000..2365d3965 --- /dev/null +++ b/actions/event_calendar/edit.php @@ -0,0 +1,51 @@ + + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + +elgg_load_library('elgg:event_calendar'); + +// start a new sticky form session in case of failure +elgg_make_sticky_form('event_calendar'); + +$event_guid = get_input('event_guid',0); +$group_guid = get_input('group_guid',0); +$event = event_calendar_set_event_from_form($event_guid,$group_guid); +if ($event) { + // remove sticky form entries + elgg_clear_sticky_form('event_calendar'); + $user_guid = elgg_get_logged_in_user_guid(); + if ($event_guid) { + add_to_river('river/object/event_calendar/update','update',$user_guid,$event_guid); + system_message(elgg_echo('event_calendar:manage_event_response')); + } else { + $event_calendar_autopersonal = elgg_get_plugin_setting('autopersonal', 'event_calendar'); + if (!$event_calendar_autopersonal || ($event_calendar_autopersonal == 'yes')) { + event_calendar_add_personal_event($event_guid,$user_guid); + } + add_to_river('river/object/event_calendar/create','create',$user_guid,$event_guid); + system_message(elgg_echo('event_calendar:add_event_response')); + } + + forward($event->getURL()); +} else { + // redisplay form with error message + register_error(elgg_echo('event_calendar:manage_event_error')); + if ($event_guid) { + forward('event_calendar/edit/'.$event_guid); + } else { + if ($group_guid) { + forward('event_calendar/add/'.$group_guid); + } else { + forward('event_calendar/add/'); + } + } +} diff --git a/actions/event_calendar/remove_personal.php b/actions/event_calendar/remove_personal.php new file mode 100644 index 000000000..1308b17e9 --- /dev/null +++ b/actions/event_calendar/remove_personal.php @@ -0,0 +1,12 @@ +