From ca4ff2e70c0e5de884c77d5183a603b741f9e05d Mon Sep 17 00:00:00 2001 From: Jason Oster Date: Wed, 8 Jul 2009 18:28:13 +0000 Subject: Fix overlapping events which span a day, fix erroneously adding 15 minutes to events which span a day or more and end on the same time they start, add day-spanning icons in day and week views --- functions/draw_functions.php | 7 ++++--- functions/parse/end_vevent.php | 4 ++-- functions/parse/overlapping_events.php | 4 +++- functions/template.php | 28 +++++++++++++++++++++++++++- images/longevent_end.gif | Bin 0 -> 57 bytes images/longevent_mid.gif | Bin 0 -> 56 bytes images/longevent_start.gif | Bin 0 -> 57 bytes 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 images/longevent_end.gif create mode 100644 images/longevent_mid.gif create mode 100644 images/longevent_start.gif diff --git a/functions/draw_functions.php b/functions/draw_functions.php index 77564c9..836d41f 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -1,6 +1,6 @@ gridLength; @@ -24,14 +24,15 @@ function drawEventTimes ($start, $end) { $end_min = "00"; } - if (($sta_h . $sta_min) == ($end_h . $end_min)) { + if ((!$long_event) && (($sta_h . $sta_min) == ($end_h . $end_min))) { $end_min += $gridLength; if ($end_min == 60) { $end_h = sprintf("%02d", ($end_h + 1)); $end_min = "00"; } - } + } $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); + return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 8e8186a..a6546d5 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -66,7 +66,7 @@ if ($length < 0){ $end_time = $start_time; } # get hour and minute adjusted to allowed grid times -$drawKey = drawEventTimes($start_time, $end_time); +$drawKey = drawEventTimes($start_time, $end_time, ($length >= (60*60*24))); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4); $hour = $time3[1]; @@ -349,7 +349,7 @@ foreach($recur_data as $recur_data_unixtime) { 'sequence' => $sequence, 'recur' => $recur ); - } + } if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid); } } # end foreach recur_data diff --git a/functions/parse/overlapping_events.php b/functions/parse/overlapping_events.php index cca0ce5..509d94a 100644 --- a/functions/parse/overlapping_events.php +++ b/functions/parse/overlapping_events.php @@ -140,7 +140,9 @@ function checkOverlap($event_date, $event_time, $uid) { $ol_day_array = @$overlap_array[$event_date]; $draw_end = $event['event_end']; if (isset($event['display_end'])) $draw_end = $event['display_end']; - $drawTimes = drawEventTimes($event['event_start'], $draw_end); + $drawTimes = drawEventTimes($event['event_start'], $draw_end, ($event['event_length'] >= (60*60*24))); + if ($event_time == "0000") $drawTimes['draw_start'] = "0000"; + if ($draw_end == "2400") $drawTimes['draw_end'] = "2400"; // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. $already_merged_once = false; diff --git a/functions/template.php b/functions/template.php index 9ce5124..1400873 100644 --- a/functions/template.php +++ b/functions/template.php @@ -266,7 +266,7 @@ class Page { # ovlKey is a time slot; $ovlValue is an array with key=uid if ($ovlKey != "-1") { foreach($ovlValue as $ovl2Value) { - $nbrGridCols[($thisday)] = kgv($nbrGridCols[($thisday)], ($ovl2Value["event_overlap"] + 1)); + $nbrGridCols[$thisday] = kgv($nbrGridCols[$thisday], ($ovl2Value["event_overlap"] + 1)); } } } @@ -508,6 +508,19 @@ class Page { if ($event_status != '') { $confirmed .= ' '; } + $event_date_start = date('Ymd', $this_time_arr[$uid]['start_unixtime']); + $event_date_end = date('Ymd', $this_time_arr[$uid]['end_unixtime']); + if ($event_date_start != $event_date_end) { + if ($thisday == $event_date_start) { + $confirmed .= ' '; + } + else if ($thisday == $event_date_end) { + $confirmed .= ' '; + } + else { + $confirmed .= ' '; + } + } $event_temp = $loop_event; $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps'); $weekdisplay .= ''."\n"; @@ -731,6 +744,19 @@ class Page { $confirmed = ''; if (is_array($event_recur)) $confirmed .= ' '; if ($event_status != '') $confirmed .= ' '; + $event_date_start = date('Ymd', $this_time_arr[$uid]['start_unixtime']); + $event_date_end = date('Ymd', $this_time_arr[$uid]['end_unixtime']); + if ($event_date_start != $event_date_end) { + if ($getdate == $event_date_start) { + $confirmed .= ' '; + } + else if ($getdate == $event_date_end) { + $confirmed .= ' '; + } + else { + $confirmed .= ' '; + } + } $daydisplay .= ''."\n"; // Start drawing the event diff --git a/images/longevent_end.gif b/images/longevent_end.gif new file mode 100644 index 0000000..5e55240 Binary files /dev/null and b/images/longevent_end.gif differ diff --git a/images/longevent_mid.gif b/images/longevent_mid.gif new file mode 100644 index 0000000..ae7825e Binary files /dev/null and b/images/longevent_mid.gif differ diff --git a/images/longevent_start.gif b/images/longevent_start.gif new file mode 100644 index 0000000..bccf0ca Binary files /dev/null and b/images/longevent_start.gif differ -- cgit v1.2.3