From 3e958227aab4e5e250a623c70a437cde748b42e0 Mon Sep 17 00:00:00 2001 From: Felix Favre Date: Sat, 13 Dec 2014 00:34:27 +0100 Subject: fix shift collision display --- includes/pages/user_shifts.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'includes') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index c1a5cc91..155a3a7c 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -494,7 +494,6 @@ function view_user_shifts() { $shifts_table .= ""; foreach ($myrooms as $room) { $rid = $room["id"]; - $empty_collides = false; foreach ($shifts as $shift) { if ($shift["RID"] == $rid) { if (floor($shift["start"] / (15 * 60)) == $thistime / (15 * 60)) { @@ -505,7 +504,10 @@ function view_user_shifts() { $collides = in_array($shift['SID'], array_keys($ownshifts)); if (! $collides) foreach ($ownshifts as $ownshift) { - if ($ownshift['start'] < $shift['end'] && $ownshift['end'] > $shift['start']) { + if ($ownshift['start'] >= $shift['start'] && $ownshift['start'] < $shift['end'] || + $ownshift['end'] > $shift['start'] && $ownshift['end'] <= $shift['end'] || + $ownshift['start'] < $shift['start'] && $ownshift['end'] > $shift['end']) + { $collides = true; break; } @@ -620,16 +622,10 @@ function view_user_shifts() { } } } - if ($shift['own'] && ! in_array('user_shifts_admin', $privileges)) { - $blocks = ($shift["end"] - $shift["start"]) / (15 * 60); - $firstblock = floor(($shift["start"] - $first) / (15 * 60)); - if ($i >= $firstblock && $i < $firstblock + $blocks) - $empty_collides = true; - } } // fill up row with empty while ($todo[$rid][$i] -- > 0) - $shifts_table .= ''; + $shifts_table .= ''; } $shifts_table .= "\n"; } -- cgit v1.2.3-54-g00ecf