summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorFelix Favre <gnomus@gnomus.de>2014-12-13 00:34:27 +0100
committerFelix Favre <gnomus@gnomus.de>2014-12-13 00:34:27 +0100
commit3e958227aab4e5e250a623c70a437cde748b42e0 (patch)
treeef63003c385322df38ca80e654ac9915e3f67d47 /includes
parentd644952fcd43f999e580a967e461862f4aa319d2 (diff)
fix shift collision display
Diffstat (limited to 'includes')
-rw-r--r--includes/pages/user_shifts.php14
1 files changed, 5 insertions, 9 deletions
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 .= "</th>";
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 <td>
while ($todo[$rid][$i] -- > 0)
- $shifts_table .= '<td class="' . ($empty_collides ? 'collides ' : '') . 'empty"></td>';
+ $shifts_table .= '<td class="empty"></td>';
}
$shifts_table .= "</tr>\n";
}