aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2010-04-15 20:36:14 +0000
committerJason Oster <parasytic@users.sourceforge.net>2010-04-15 20:36:14 +0000
commitfcd43841ea9ad473348c386b9c6202948534a02b (patch)
tree5643fbd2b7f8faa0e266357961e55351e8054ec8 /functions
parentce0ebfc5272a8bb682f218d4d58d3d8d68e15f8a (diff)
downloadphpicalendar-fcd43841ea9ad473348c386b9c6202948534a02b.tar.gz
phpicalendar-fcd43841ea9ad473348c386b9c6202948534a02b.tar.bz2
phpicalendar-fcd43841ea9ad473348c386b9c6202948534a02b.zip
Fix overlapping events, Bug #2968512
Diffstat (limited to 'functions')
-rw-r--r--functions/draw_functions.php7
-rw-r--r--functions/parse/overlapping_events.php6
2 files changed, 10 insertions, 3 deletions
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'];

© 2014-2024 Faster IT GmbH | imprint | privacy policy