diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 162238e6..235208b9 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -364,6 +364,13 @@ function view_user_shifts() {
$SQL .= "
ORDER BY `start`";
$shifts = sql_select($SQL);
+ $ownshifts_source = sql_select("SELECT `Shifts`.* FROM `Shifts` INNER JOIN `ShiftEntry` ON (`Shifts`.`SID` = `ShiftEntry`.`SID` AND `ShiftEntry`.`UID` = '" . sql_escape($user['UID']) . "')
+ WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ")
+ AND DATE(FROM_UNIXTIME(`start`)) IN ('" . implode("','", $_SESSION['user_shifts']['days']) . "') ");
+ $ownshifts = array();
+ foreach ($ownshifts_source as $ownshift)
+ $ownshifts[$ownshift['SID']] = $ownshift;
+ unset($ownshifts_source);
$shifts_table = "";
//qqqq
@@ -383,33 +390,32 @@ function view_user_shifts() {
)
*/
if(count($_SESSION['user_shifts']['days'])==1 && $_SESSION['user_shifts']['new_style']) {
- $myrooms = $rooms;
-
- // delete un-selected rooms from array
- foreach($myrooms as $k => $v)
- if(array_search($v["id"],$_SESSION['user_shifts']['rooms'])===FALSE)
- unset($myrooms[$k]);
-
$first=date("U",strtotime($_SESSION['user_shifts']['days'][0]." 00:00:00"));
$last=date("U",strtotime($_SESSION['user_shifts']['days'][0]." 23:59:59"));
$maxshow=24*4;
$block=array();
$todo=array();
+ $myrooms = $rooms;
- // initialize $block array
- foreach($myrooms as $room)
- $block[$room["id"]] = array_fill(0, $maxshow, 0);
+ // delete un-selected rooms from array
+ foreach($myrooms as $k => $v) {
+ if(array_search($v["id"],$_SESSION['user_shifts']['rooms'])===FALSE)
+ unset($myrooms[$k]);
+ // initialize $block array
+ $block[$v["id"]] = array_fill(0, $maxshow, 0);
+ }
// calculate number of parallel shifts in each timeslot for each room
- foreach($shifts as $shift) {
+ foreach($shifts as $k => $shift) {
$rid = $shift["RID"];
$blocks = ($shift["end"]-$shift["start"]) / (15*60);
$firstblock = floor(($shift["start"]-$first) / (15*60));
for($i = $firstblock; $i < $blocks + $firstblock && $i < $maxshow; $i++)
$block[$rid][$i]++;
+ $shifts[$k]['own'] = in_array($shift['SID'], array_keys($ownshifts));
}
- $shifts_table = "
';
// qqq
} else {
$shifts_table = array();
diff --git a/public/css/base.css b/public/css/base.css
index 638f6ef4..61e0702e 100644
--- a/public/css/base.css
+++ b/public/css/base.css
@@ -129,7 +129,15 @@ table {
background-color: #BCF5A9;
}
-#shifts td:not(.free):not(.occupied) {
+#shifts td.own {
+ background-color: #CECEF6;
+}
+
+#shifts td.collides {
+ background-color: #9B9B9B;
+}
+
+#shifts td.empty {
border: 0;
}
diff --git a/public/css/scrolltable.js b/public/css/scrolltable.js
deleted file mode 100644
index 1319495c..00000000
--- a/public/css/scrolltable.js
+++ /dev/null
@@ -1,26 +0,0 @@
-function scrolltable(elem) {
- var widths = new Array();
- var thead = elem.getElementsByTagName('thead')[0];
- var tbody = elem.getElementsByTagName('tbody')[0];
- var ths = Array.prototype.slice.call(thead.getElementsByTagName('th'),0);
- ths = ths.concat(Array.prototype.slice.call(tbody.getElementsByTagName('tr')[0].getElementsByTagName('td'), 0));
- ths.push(tbody.getElementsByTagName('th')[0]);
- console.debug(ths);
- for(var i = 0; i < ths.length; i++)
- widths.push(ths[i].offsetWidth);
- widths.push(tbody.offsetWidth);
- elem.className = elem.className + ' scrollable';
- var tbodywidth = widths.pop();
- tbody.style.width = (tbodywidth + 16) + 'px';
- tbody.style.height = (window.innerHeight - 100) + 'px';
- for(var i = 0; i < ths.length; i++) {
- var paddingLeft = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-left'));
- var paddingRight = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('padding-right'));
- var borderLeft = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('border-left-width'));
- var borderRight = parseInt(window.getComputedStyle(ths[i], null).getPropertyValue('border-right-width'));
- var targetwidth = widths.shift();
- ths[i].style.maxWidth = ths[i].style.minWidth = (targetwidth - paddingLeft - paddingRight - borderRight) + 'px';
- if (ths[i].offsetWidth > targetwidth)
- ths[i].style.maxWidth = ths[i].style.minWidth = (parseInt(ths[i].style.minWidth) - 1) + 'px';
- }
-}
diff --git a/templates/layout.html b/templates/layout.html
index f47d3693..f6d19c6f 100644
--- a/templates/layout.html
+++ b/templates/layout.html
@@ -12,7 +12,6 @@
-
%atom_link%