From e0e9ff33a7f5fc334af8127fc8680925ce967d14 Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Thu, 2 Feb 2012 16:19:37 +0100 Subject: added support for new personal calendar management options --- views/default/forms/event_calendar/edit.php | 30 +++++++++++++++-- views/default/plugins/event_calendar/settings.php | 16 +++++++--- views/default/widgets/event_calendar/content.php | 39 +++++++++++++++++++++++ 3 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 views/default/widgets/event_calendar/content.php (limited to 'views') diff --git a/views/default/forms/event_calendar/edit.php b/views/default/forms/event_calendar/edit.php index a84a79407..1830ef168 100644 --- a/views/default/forms/event_calendar/edit.php +++ b/views/default/forms/event_calendar/edit.php @@ -2,6 +2,12 @@ $event = $vars['event']; $fd = $vars['form_data']; +$personal_manage_options = array( + elgg_echo('event_calendar:personal_manage:open') => 'open', + elgg_echo('event_calendar:personal_manage:closed') => 'closed', + elgg_echo('event_calendar:personal_manage:private') => 'private', +); + $event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar'); $event_calendar_region_display = elgg_get_plugin_setting('region_display', 'event_calendar'); $event_calendar_type_display = elgg_get_plugin_setting('type_display', 'event_calendar'); @@ -10,6 +16,7 @@ $event_calendar_spots_display = elgg_get_plugin_setting('spots_display', 'event_ $event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar'); $event_calendar_hide_end = elgg_get_plugin_setting('hide_end', 'event_calendar'); $event_calendar_more_required = elgg_get_plugin_setting('more_required', 'event_calendar'); +$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar'); if ($event_calendar_more_required == 'yes') { $required_fields = array('title','venue','start_date','start_time', @@ -20,7 +27,8 @@ if ($event_calendar_more_required == 'yes') { } $all_fields = array('title','venue','start_time','start_date','end_time','end_date', 'brief_description','region','event_type','fees','contact','organiser','event_tags', - 'long_description','spots'); + 'long_description','spots','personal_manage'); + $prefix = array(); foreach ($all_fields as $fn) { if (in_array($fn,$required_fields)) { @@ -64,6 +72,12 @@ if ($event) { $start_time = $event->start_time; $end_time = $event->end_time; } + if ($event_calendar_personal_manage == 'by_event') { + $personal_manage = $event->personal_manage; + if (!$personal_manage) { + $personal_manage = 'open'; + } + } $event_action = 'manage_event'; $event_guid = $event->guid; } else { @@ -91,6 +105,9 @@ if ($event) { $start_time = $fd['start_time']; $end_time = $fd['end_time']; } + if ($event_calendar_personal_manage == 'by_event') { + $personal_manage = $fd['personal_manage']; + } $event_action = 'add_event'; $event_guid = 0; } @@ -175,7 +192,7 @@ if ($event_calendar_region_display == 'yes') { } } $body .= '

'; $body .= '

'.$prefix['region'].elgg_echo('event_calendar:region_description').'

'; } @@ -199,7 +216,7 @@ if ($event_calendar_type_display == 'yes') { } } $body .= '

'; $body .= '

'.$prefix['event_type'].elgg_echo('event_calendar:type_description').'

'; } @@ -220,6 +237,13 @@ $body .= elgg_view("input/text",array('name' => 'organiser','value'=>$organiser) $body .= '

'; $body .= '

'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'

'; +if ($event_calendar_personal_manage == 'by_event') { + $body .= '

'; + $body .= '

'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'

'; +} + $body .= '

'; diff --git a/views/default/plugins/event_calendar/settings.php b/views/default/plugins/event_calendar/settings.php index 54ff5c1c3..963f64549 100644 --- a/views/default/plugins/event_calendar/settings.php +++ b/views/default/plugins/event_calendar/settings.php @@ -3,6 +3,13 @@ $yn_options = array(elgg_echo('event_calendar:settings:yes')=>'yes', elgg_echo('event_calendar:settings:no')=>'no', ); +$membership_options = array( + elgg_echo('event_calendar:personal_manage:open') => 'open' , + elgg_echo('event_calendar:personal_manage:closed') => 'closed', + elgg_echo('event_calendar:personal_manage:private') => 'private', + elgg_echo('event_calendar:personal_manage:by_event') => 'by_event', +); + $access_options = array( ACCESS_PRIVATE => elgg_echo("PRIVATE"), ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), ACCESS_PUBLIC => elgg_echo("PUBLIC")); @@ -222,15 +229,14 @@ $body .= elgg_view('input/radio',array('name'=>'params[add_users_notify]','value $body .= '
'; $event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar'); -if (!$event_calendar_personal_manage) { - $event_calendar_personal_manage = 'yes'; +if (!$event_calendar_personal_manage && $personal_manage == 'yes') { + $event_calendar_personal_manage = 'open'; } $body .= elgg_echo('event_calendar:settings:personal_manage:title'); $body .= '
'; -$body .= elgg_view('input/radio',array('name'=>'params[personal_manage]','value'=>$event_calendar_personal_manage,'options'=>$yn_options)); - -$body .= '
'; +$body .= elgg_view('input/radio',array('name'=>'params[personal_manage]','value'=>$event_calendar_personal_manage,'options'=>$membership_options)); +$body .= '

'.elgg_echo('event_calendar:settings:personal_manage:description').'

'; $event_calendar_spots_display = elgg_get_plugin_setting('spots_display', 'event_calendar'); if (!$event_calendar_spots_display) { diff --git a/views/default/widgets/event_calendar/content.php b/views/default/widgets/event_calendar/content.php new file mode 100644 index 000000000..329046cb0 --- /dev/null +++ b/views/default/widgets/event_calendar/content.php @@ -0,0 +1,39 @@ + + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + + // Load event calendar model + elgg_load_library('elgg:event_calendar'); + + //the number of events to display + $num = (int) $vars['entity']->num_display; + if (!$num) + $num = 5; + + // Get the events + + $events = event_calendar_get_personal_events_for_user(elgg_get_page_owner_guid(),$num); + + // If there are any events to view, view them + if (is_array($events) && sizeof($events) > 0) { + + echo "
"; + + foreach($events as $event) { + echo elgg_view("object/event_calendar",array('entity' => $event)); + } + + echo "
"; + + } + +?> \ No newline at end of file -- cgit v1.2.3