From 9431744d2515fb1860acdb13f77f46942887551e Mon Sep 17 00:00:00 2001 From: Janis Steiner <89935073+jakani24@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:04:45 +0000 Subject: [PATCH] Update print.php --- sys0-code/app/print.php | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/sys0-code/app/print.php b/sys0-code/app/print.php index a2320f0..b845c18 100644 --- a/sys0-code/app/print.php +++ b/sys0-code/app/print.php @@ -72,6 +72,7 @@ function is_time_between($startTime, $endTime, $checkTime) { @@ -318,21 +319,27 @@ function is_time_between($startTime, $endTime, $checkTime) { date_default_timezone_set('Europe/Zurich'); $reservation_conflict=false; $today=date("Y-m-d"); - $sql="select time_from, time_to from reservations where day='$today';"; + $sql="select time_from, time_to, for_class from reservations where day='$today';"; $stmt = $link->prepare($sql); $stmt->execute(); $result = $stmt->get_result(); //$row = $result->fetch_assoc(); $time_now=date("H:i"); + while ($row = $result->fetch_assoc()) { if (is_time_between($row["time_from"], $row["time_to"], $time_now)) { $reservation_conflict = true; + $for_class[]=$row["for_class"]; break; } } - - if ($reservation_conflict) { - echo "
"; + if(!isset($for_class)) + $for_class[]=0; + if ($reservation_conflict && !in_array($class,$for_class)) { + echo "
"; + $block=true; + }else{ + $block=false; } ?> @@ -495,17 +502,27 @@ function is_time_between($startTime, $endTime, $checkTime) { } ?> - -
- - -
+ '); + echo('
'); + echo(''); + echo(''); + echo('
'); + }else{ + echo "
"; + } + ?> + + Nur freie Drucker anzeigen.'); - }else{ - echo('
Auf einem Drucker Drucken, welcher besetzt ist.
'); - } + if($block==false){ + if(isset($_GET["send_to_queue"])){ + echo('
Nur freie Drucker anzeigen.
'); + }else{ + echo('
Auf einem Drucker Drucken, welcher besetzt ist.
'); + } + } ?>