diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-06-28 18:12:41 -0400 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-06-28 18:12:41 -0400 |
commit | 29792a9858484266952a53268e4fd0dd29b2f4a5 (patch) | |
tree | bad977e423a6d1193d362295611fe4472c2373af /show_event.php | |
parent | 1dd01c7ff9685995b4bc9de0ceeb7856086c3f40 (diff) | |
download | elgg-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 'show_event.php')
-rw-r--r-- | show_event.php | 60 |
1 files changed, 60 insertions, 0 deletions
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 @@ +<?php + +/** + * Show event + * + * @package event_calendar + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @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 |