From 29792a9858484266952a53268e4fd0dd29b2f4a5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 28 Jun 2011 18:12:41 -0400 Subject: moved the code into the base directory so that it is easier to work with --- show_event.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 show_event.php (limited to 'show_event.php') diff --git a/show_event.php b/show_event.php new file mode 100644 index 000000000..f2869c36d --- /dev/null +++ b/show_event.php @@ -0,0 +1,60 @@ + + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + +// Load Elgg engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// Load event calendar model +require_once(dirname(__FILE__) . "/models/model.php"); + +// Define context +set_context('event_calendar'); + +global $CONFIG; + +$event_id = get_input('event_id',0); +if ($event_id && ($event = get_entity($event_id))) { + $event_container = get_entity($event->container_guid); + if ($event_container instanceOf ElggGroup) { + // Re-define context + set_context('groups'); + set_page_owner($event_container->getGUID()); + } + $count = event_calendar_get_users_for_event($event_id,0,0,true); + if ($count > 0) { + add_submenu_item(sprintf(elgg_echo('event_calendar:personal_event_calendars_link'),$count), $CONFIG->url . "mod/event_calendar/display_event_users.php?event_id=".$event_id, '0eventnonadmin'); + } + if (isloggedin()) { + $user_id = get_loggedin_userid(); + if (event_calendar_personal_can_manage($event,$user_id)) { + if (event_calendar_has_personal_event($event_id,$user_id)) { + add_submenu_item(elgg_echo('event_calendar:remove_from_my_calendar'), $CONFIG->url . "action/event_calendar/manage?event_action=remove_personal&event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin'); + } else { + if (!event_calendar_is_full($event_id) && !event_calendar_has_collision($event_id,$user_id)) { + add_submenu_item(elgg_echo('event_calendar:add_to_my_calendar'), $CONFIG->url . "action/event_calendar/manage?event_action=add_personal&event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin'); + } + } + } else { + if (!check_entity_relationship($user_id, 'event_calendar_request', $event_id)) { + add_submenu_item(elgg_echo('event_calendar:make_request_title'), $CONFIG->url . "action/event_calendar/request_personal_calendar?event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin'); + } + } + } + $body = elgg_view('object/event_calendar',array('entity'=>$event,'full'=>true)); + $title = $event->title; + page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body)); +} else { + register_error('event_calendar:error_nosuchevent'); + forward(); +} +?> \ No newline at end of file -- cgit v1.2.3