From fcd43841ea9ad473348c386b9c6202948534a02b Mon Sep 17 00:00:00 2001 From: Jason Oster Date: Thu, 15 Apr 2010 20:36:14 +0000 Subject: Fix overlapping events, Bug #2968512 --- functions/draw_functions.php | 7 ++++++- functions/parse/overlapping_events.php | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'functions') diff --git a/functions/draw_functions.php b/functions/draw_functions.php index 836d41f..c20e04c 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -31,7 +31,12 @@ function drawEventTimes ($start, $end, $long_event = FALSE) { $end_min = "00"; } } - $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); + $sta = ($sta_h * 60 + $sta_min); + $end = ($end_h * 60 + $end_min); + if ($sta < $end) + $draw_len = $end - $sta; + else + $draw_len = $sta - $end; return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } diff --git a/functions/parse/overlapping_events.php b/functions/parse/overlapping_events.php index 509d94a..ab71db9 100644 --- a/functions/parse/overlapping_events.php +++ b/functions/parse/overlapping_events.php @@ -110,7 +110,7 @@ function flatten_ol_blocks($event_date, $ol_blocks, $new_block_key) { // Builds $overlap_array structure, and updates event_overlap in $master_array for the given events. // For a given date, - // - check to see if the event's already in a block, and if so, add it. + // - check to see if the event's already in a block, and if so, add it. // - make sure the new block doesn't overlap another block, and if so, merge the blocks. // - check that there aren't any events we already passed that we should handle. // - "flatten" the structure again, merging the blocks. @@ -182,7 +182,9 @@ function checkOverlap($event_date, $event_time, $uid) { foreach ($time as $loop_event_key => $loop_event) { // Make sure we haven't already dealt with the event, and we're not checking against ourself. if ($loop_event['event_overlap'] == 0 && $loop_event_key != $uid) { - $loopDrawTimes = drawEventTimes($loop_event['event_start'], $loop_event['display_end']); + $loopDrawTimes = drawEventTimes($loop_event['event_start'], $loop_event['display_end'], ($loop_event['event_length'] >= (60*60*24))); + if ($event_time == "0000") $loopDrawTimes['draw_start'] = "0000"; + if ($draw_end == "2400") $loopDrawTimes['draw_end'] = "2400"; if ($loopDrawTimes['draw_start'] < $drawTimes['draw_end'] && $loopDrawTimes['draw_end'] > $drawTimes['draw_start']) { if ($loopDrawTimes['draw_start'] < $drawTimes['draw_start']) { $block_start = $loopDrawTimes['draw_start']; -- cgit v1.2.3