diff --git a/inc/funktion_schichtplan.php b/inc/funktion_schichtplan.php index c9ebc079..fc67c813 100755 --- a/inc/funktion_schichtplan.php +++ b/inc/funktion_schichtplan.php @@ -128,10 +128,10 @@ function ausgabe_Feld_Inhalt( $SID, $Man ) // ausgabe benötigter Engel //////////////////////////// //in vergangenheit - $SQLtime = "SELECT `DateS` FROM `Shifts` WHERE (SID='$SID' AND `DateS`> '". + $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (SID='$SID' AND `DateS` >= '". gmdate("Y-m-d H:i:s", time()+ 3600). "')"; $Ergtime = mysql_query($SQLtime, $con); - if( mysql_num_rows( $Ergtime)) + if( mysql_num_rows( $Ergtime) > 0) { //mit sonder status $SQLerlaubnis = "SELECT Name FROM `EngelType` WHERE TID = '". $TempValue["TID"]. "'"; @@ -190,43 +190,68 @@ function CreateRoomShifts( $raum ) { global $Spalten, $ausdatum, $con, $DEBUG, $GlobalZeileProStunde; - $ZeitZeiger = 0; - - $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` like '$ausdatum%') AND ". - "(`DateS` < '$ausdatum') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag und geht darüber hinaus + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND ". + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); if( (mysql_num_rows( $ErgSonder) > 1) ) { echo Get_Text("pub_schichtplan_colision"). " ". mysql_result($ErgSonder, $i, "DateS"). " '". mysql_result($ErgSonder, $i, "Man"). "' ". - " (". mysql_result($ErgSonder, $i, "SID"). " R$raum)###

"; + " (". mysql_result($ErgSonder, $i, "SID"). " R$raum) (00-24)

"; } elseif( (mysql_num_rows( $ErgSonder) == 1) ) { - - $ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateS"), 11, 2 )+ - (substr( mysql_result($ErgSonder, 0, "DateS"), 14, 2 ) / 60)+ - mysql_result($ErgSonder, 0, "Len") - 24; - if( $ZeitZeiger > 0) - $Spalten[0].= - "\t\t\n". + $Spalten[0].= "\t\t\n". + "\t\t\t

↑↑↑

". + Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), + mysql_result($ErgSonder, 0, "Man") ). + "\t\t\t

↓↓↓

". + "\n\t\t\n"; + return; + } + + $ZeitZeiger = 0; + + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag? + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 00:00:00') AND ". + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); + if( (mysql_num_rows( $ErgSonder) > 1) ) + { + echo Get_Text("pub_schichtplan_colision"). " ". + mysql_result($ErgSonder, $i, "DateS"). + " '". mysql_result($ErgSonder, $i, "Man"). "' ". + " (". mysql_result($ErgSonder, $i, "SID"). " R$raum) (00-xx)

"; + } + elseif( (mysql_num_rows( $ErgSonder) == 1) ) + { + $ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateE"), 11, 2 )+ + (substr( mysql_result($ErgSonder, 0, "DateE"), 14, 2 ) / 60); + $Spalten[0].= "\t\t\n". "\t\t\t

↑↑↑

". Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), mysql_result($ErgSonder, 0, "Man") ). "\n\t\t\n"; - - } - - $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') and (`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; + ///////////////////////////////////////////////////////////// + // gibt die schichten für den tag aus + ///////////////////////////////////////////////////////////// + $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') and ". + "(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and ". + "(`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; $Erg = mysql_query($SQL, $con); - for( $i = 0; $i < mysql_num_rows($Erg); ++$i ) - { + { $ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+ (substr( mysql_result($Erg, $i, "DateS"), 14, 2 ) / 60); $len = mysql_result($Erg, $i, "Len"); @@ -241,11 +266,16 @@ function CreateRoomShifts( $raum ) } if($ZeitZeiger == $ZeitPos ) { + //sonderfall wenn die schicht über dei 24 stunden hinaus geht + // (eintrag abkürzen, pfeiel ausgeben) $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= - "\t\t\n". + "\t\t\n". "\t\t\t". Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"), mysql_result($Erg, $i, "Man") ). + (( ($ZeitZeiger+$len) > 24)? "\t\t\t

↓↓↓

" : ""). "\n\t\t\n"; $ZeitZeiger += $len; } @@ -254,7 +284,7 @@ function CreateRoomShifts( $raum ) echo Get_Text("pub_schichtplan_colision"). " ". mysql_result($Erg, $i, "DateS"). " '". mysql_result($Erg, $i, "Man"). "' ". - " (". mysql_result($Erg, $i, "SID"). " R$raum)

"; + " (". mysql_result($Erg, $i, "SID"). " R$raum) (xx-xx)

"; } } if( $ZeitZeiger <= 24 ) @@ -321,8 +351,9 @@ function SummRoomShifts( $raum ) global $ausdatum, $con, $DEBUG, $GlobalZeileProStunde; $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` like '$ausdatum%') AND ". - "(`DateS` like '$ausdatum%') ) ORDER BY `DateS`;"; + "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND ". + "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); return mysql_num_rows($ErgSonder); diff --git a/nonpublic/schichtplan.1.php b/nonpublic/schichtplan.1.php index 09671527..3b3bc30e 100755 --- a/nonpublic/schichtplan.1.php +++ b/nonpublic/schichtplan.1.php @@ -2,18 +2,83 @@ $Mmax) + { + $Tag = 1; + $Monat++; + } + + if( $Monat > 12 ) + { + $Monat = 1; + $Jahr++; + } + + return ("$Jahr-$Monat-$Tag"); +} //function DatumUm1Tagerhoehen( + +function Printlink( $Datum) +{ + GLOBAL $raum; + echo "\t
  • $Datum
  • \n"; +} //function Printlink( + +//suchen den ersten eintrags +$SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1"; $Erg = mysql_query($SQL, $con); -for ($i = 0 ; $i < mysql_fetch_row($Erg) ; $i++) - if ($tmp != substr(mysql_result($Erg, $i , 0), 0,10)) { - $tmp = substr(mysql_result($Erg, $i , 0), 0,10); - echo "\t
  • $tmp
  • \n"; -} - +do +{ + //Startdatum einlesen und link ausgeben + $DateS = substr(mysql_result($Erg, 0 , 0), 0,10); + Printlink( $DateS); + + //auslesen den endes und eventuelle weitere tage ausgeben + $SQL2 = "SELECT MAX(`DateE`) FROM `Shifts` ". + "WHERE ( (`DateS` like '$DateS%') AND NOT (`DateE` like '%00:00:00'))"; + $Erg2 = mysql_query($SQL2, $con); + $DateE = substr(mysql_result($Erg2, 0 , 0), 0,10); + + while( $DateS != $DateE) + { + $DateS = DatumUm1TagErhoehen( $DateS); + Printlink( $DateS); + } + + //suchen den nästen eintrag + $SQL = "SELECT `DateS` FROM `Shifts` ". + "WHERE (`DateS` > '$DateE 23:59:59' ) ". + "ORDER BY `DateS` ". + "LIMIT 1"; + $Erg = mysql_query($SQL, $con); +} while( mysql_fetch_row($Erg) > 0); + ?>