diff options
Diffstat (limited to 'models/model.php')
-rw-r--r-- | models/model.php | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/models/model.php b/models/model.php index 6646442e8..09e8b2092 100644 --- a/models/model.php +++ b/models/model.php @@ -106,11 +106,11 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) { //$event->munged_start_date_string = $start_date_text." ".date_default_timezone_get();*/ // TODO: is the timezone bit necessary? - $event->start_date = strtotime($start_date_text." ".date_default_timezone_get()); + $event->start_date = strtotime($start_date_text." GMT"); $end_date_text = trim(get_input('end_date','')); //$event->original_end_date = get_input('end_date'); if ($end_date_text) { - $event->end_date = strtotime($end_date_text." ".date_default_timezone_get()); + $event->end_date = strtotime($end_date_text." GMT"); //$event->munged_end_date_string = $end_date_text." ".date_default_timezone_get(); } else { $event->end_date = ''; @@ -1506,7 +1506,7 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_ $params = event_calendar_generate_listing_params($page_type,$container_guid,$start_date,$display_mode,$filter,$region); - $url = full_url(); + $url = current_page_url(); if (substr_count($url, '?')) { $url .= "&view=ical"; } else { @@ -1517,24 +1517,32 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_ $menu_options = array( 'name' => 'ical', 'id' => 'event-calendar-ical-link', - 'text' => '<img src="'.elgg_get_site_url().'mod/event_calendar/images/ics.png" />', + 'text' => elgg_view_icon('calendar'), 'href' => $url, 'title' => elgg_echo('feed:ical'), 'priority' => 800, + 'rel' => 'popup', ); $menu_item = ElggMenuItem::factory($menu_options); elgg_register_menu_item('extras', $menu_item); $body = elgg_view_layout("content", $params); + $body .= elgg_view_module('popup', elgg_echo('feed:ical'), elgg_echo('event_calendar:ical_popup_message') . elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('export'), + 'class' => 'elgg-button elgg-button-action', + )), array( + 'id' => 'event-calendar-ical', + 'class' => 'event-calendar-ical hidden', + )); - return elgg_view_page($title,$body); + return elgg_view_page($title, $body); } function event_calendar_get_page_content_edit($page_type,$guid,$start_date='') { elgg_load_js('elgg.event_calendar'); $vars = array(); $vars['id'] = 'event-calendar-edit'; - $vars['name'] = 'event_calendar_edit'; // just in case a feature adds an image upload $vars['enctype'] = 'multipart/form-data'; @@ -1651,7 +1659,7 @@ function event_calendar_prepare_edit_form_vars($event = NULL, $page_type = '', $ if ($page_type == 'schedule') { $values['schedule_type'] = 'poll'; } else { - $values['schedule_type'] = 'fixed'; + $values['schedule_type'] = 'all_day'; } if ($event) { @@ -1836,7 +1844,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig ); $content = elgg_view('event_calendar/show_events', $vars); - if ($page_type == 'owner') { + if ($page_type == 'group') { $filter_override = ''; } else { $filter_override = elgg_view('event_calendar/filter_menu',$vars); @@ -2114,6 +2122,18 @@ function event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delt $event->end_time += $minute_delta; } } + $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday'); + $week_repeats = array(); + $weekday_delta = (($day_delta % 7) + 7) % 7; // Imagine delta is -12: ((-12 % 7) + 7 % 7) = +2 (thursdays are saturdays) + foreach ($dow as $i => $w) { + $v = 'event-calendar-repeating-'.$w.'-value'; + $new_day = $dow[($i+$weekday_delta)%7]; + $week_repeats[$new_day] = $event->$v; + } + foreach ($week_repeats as $w => $value) { + $v = 'event-calendar-repeating-'.$w.'-value'; + $event->$v = $value; + } return TRUE; } } @@ -2165,7 +2185,7 @@ function event_calendar_get_page_content_fullcalendar_events($start_date,$end_da } else { $event_item['id'] = $event->guid; $event_item['is_event_poll'] = FALSE; - $event_item['url'] = elgg_get_site_url().'event_calendar/view_light_box/'.$event->guid; + $event_item['url'] = elgg_get_site_url().'event_calendar/view/'.$event->guid; } $event_array[] = $event_item; |