Fix new shift time filter and show dates for longer shift tables

This commit is contained in:
Jan-Philipp Litza 2012-12-30 16:02:23 +01:00
parent 3efe63fa10
commit b32ade0a34
1 changed files with 8 additions and 11 deletions

View File

@ -337,12 +337,8 @@ function view_user_shifts() {
if (!isset ($_SESSION['user_shifts']['new_style'])) if (!isset ($_SESSION['user_shifts']['new_style']))
$_SESSION['user_shifts']['new_style'] = true; $_SESSION['user_shifts']['new_style'] = true;
foreach (array ('start', 'end') as $key) { foreach (array ('start', 'end') as $key) {
if (isset ($_REQUEST[$key . '_day'])) { if (isset ($_REQUEST[$key . '_day']) && in_array($_REQUEST[$key . '_day'], $days))
$filtered = array_intersect($_REQUEST[$key . '_day'], $days); $_SESSION['user_shifts'][$key . '_day'] = $_REQUEST[$key . '_day'];
if (!empty ($filtered))
$_SESSION['user_shifts'][$key . '_day'] = $filtered;
unset ($filtered);
}
if (isset ($_REQUEST[$key . '_time']) && preg_match('#^\d{1,2}:\d\d$#', $_REQUEST[$key . '_time'])) if (isset ($_REQUEST[$key . '_time']) && preg_match('#^\d{1,2}:\d\d$#', $_REQUEST[$key . '_time']))
$_SESSION['user_shifts'][$key . '_time'] = $_REQUEST[$key . '_time']; $_SESSION['user_shifts'][$key . '_time'] = $_REQUEST[$key . '_time'];
if (!isset ($_SESSION['user_shifts'][$key . '_day'])) { if (!isset ($_SESSION['user_shifts'][$key . '_day'])) {
@ -454,11 +450,12 @@ function view_user_shifts() {
$shifts_table.="</tr></thead><tbody>"; $shifts_table.="</tr></thead><tbody>";
for($i = 0; $i < $maxshow; $i++) { for($i = 0; $i < $maxshow; $i++) {
$thistime = $first + ($i*15*60); $thistime = $first + ($i*15*60);
if($thistime%(60*60) == 0) { $shifts_table .= "<tr><th>";
$shifts_table .= "<tr><th>" . date("H:i",$thistime) . "</th>"; if($thistime%(24*60*60) == 23*60*60 && $endtime - $starttime > 24*60*60)
} else { $shifts_table .= date('y-m-d<b\r>H:i', $thistime);
$shifts_table .= "<tr><th></th>"; elseif($thistime%(60*60) == 0)
} $shifts_table .= date("H:i", $thistime);
$shifts_table .= "</th>";
foreach($myrooms as $room) { foreach($myrooms as $room) {
$rid = $room["id"]; $rid = $room["id"];
$empty_collides = false; $empty_collides = false;