schichten koennen jetzt beliebig lang sein und werden vollstaendig in der Tagesuebersicht angezeiht

git-svn-id: svn://svn.cccv.de/engel-system@11 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
cookie 2005-10-21 23:00:29 +00:00
parent 50c5e06f09
commit 95fb776263
2 changed files with 135 additions and 39 deletions

View File

@ -128,10 +128,10 @@ function ausgabe_Feld_Inhalt( $SID, $Man )
// ausgabe benötigter Engel // ausgabe benötigter Engel
//////////////////////////// ////////////////////////////
//in vergangenheit //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). "')"; gmdate("Y-m-d H:i:s", time()+ 3600). "')";
$Ergtime = mysql_query($SQLtime, $con); $Ergtime = mysql_query($SQLtime, $con);
if( mysql_num_rows( $Ergtime)) if( mysql_num_rows( $Ergtime) > 0)
{ {
//mit sonder status //mit sonder status
$SQLerlaubnis = "SELECT Name FROM `EngelType` WHERE TID = '". $TempValue["TID"]. "'"; $SQLerlaubnis = "SELECT Name FROM `EngelType` WHERE TID = '". $TempValue["TID"]. "'";
@ -190,41 +190,66 @@ function CreateRoomShifts( $raum )
{ {
global $Spalten, $ausdatum, $con, $DEBUG, $GlobalZeileProStunde; global $Spalten, $ausdatum, $con, $DEBUG, $GlobalZeileProStunde;
$ZeitZeiger = 0; /////////////////////////////////////////////////////////////
// beginnt die erste schicht vor dem heutigen tag und geht darüber hinaus
$SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". /////////////////////////////////////////////////////////////
"WHERE ((`RID` = '$raum') AND (`DateE` like '$ausdatum%') AND ". $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ".
"(`DateS` < '$ausdatum') ) ORDER BY `DateS`;"; "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND ".
"(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;";
$ErgSonder = mysql_query($SQLSonder, $con); $ErgSonder = mysql_query($SQLSonder, $con);
if( (mysql_num_rows( $ErgSonder) > 1) ) if( (mysql_num_rows( $ErgSonder) > 1) )
{ {
echo Get_Text("pub_schichtplan_colision"). " ". echo Get_Text("pub_schichtplan_colision"). " ".
mysql_result($ErgSonder, $i, "DateS"). mysql_result($ErgSonder, $i, "DateS").
" '". mysql_result($ErgSonder, $i, "Man"). "' ". " '". mysql_result($ErgSonder, $i, "Man"). "' ".
" (". mysql_result($ErgSonder, $i, "SID"). " R$raum)###<br><br>"; " (". mysql_result($ErgSonder, $i, "SID"). " R$raum) (00-24)<br><br>";
} }
elseif( (mysql_num_rows( $ErgSonder) == 1) ) elseif( (mysql_num_rows( $ErgSonder) == 1) )
{ {
$Spalten[0].= "\t\t<td valign=\"top\" rowspan=\"". (24 * $GlobalZeileProStunde). "\">\n".
"\t\t\t<h3>&uarr;&uarr;&uarr;</h3>".
Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"),
mysql_result($ErgSonder, 0, "Man") ).
"\t\t\t<h3>&darr;&darr;&darr;</h3>".
"\n\t\t</td>\n";
return;
}
$ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateS"), 11, 2 )+ $ZeitZeiger = 0;
(substr( mysql_result($ErgSonder, 0, "DateS"), 14, 2 ) / 60)+
mysql_result($ErgSonder, 0, "Len") - 24; /////////////////////////////////////////////////////////////
if( $ZeitZeiger > 0) // beginnt die erste schicht vor dem heutigen tag?
$Spalten[0].= /////////////////////////////////////////////////////////////
"\t\t<td valign=\"top\" rowspan=\"". ($ZeitZeiger * $GlobalZeileProStunde). "\">\n". $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)<br><br>";
}
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<td valign=\"top\" rowspan=\"". ($ZeitZeiger * $GlobalZeileProStunde). "\">\n".
"\t\t\t<h3>&uarr;&uarr;&uarr;</h3>". "\t\t\t<h3>&uarr;&uarr;&uarr;</h3>".
Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"),
mysql_result($ErgSonder, 0, "Man") ). mysql_result($ErgSonder, 0, "Man") ).
"\n\t\t</td>\n"; "\n\t\t</td>\n";
} }
/////////////////////////////////////////////////////////////
// gibt die schichten für den tag aus
/////////////////////////////////////////////////////////////
$SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ".
"WHERE ((`RID` = '$raum') and (`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; "WHERE ((`RID` = '$raum') and ".
"(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and ".
"(`DateS` like '$ausdatum%')) ORDER BY `DateS`;";
$Erg = mysql_query($SQL, $con); $Erg = mysql_query($SQL, $con);
for( $i = 0; $i < mysql_num_rows($Erg); ++$i ) for( $i = 0; $i < mysql_num_rows($Erg); ++$i )
{ {
$ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+ $ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+
@ -241,11 +266,16 @@ function CreateRoomShifts( $raum )
} }
if($ZeitZeiger == $ZeitPos ) if($ZeitZeiger == $ZeitPos )
{ {
//sonderfall wenn die schicht über dei 24 stunden hinaus geht
// (eintrag abkürzen, pfeiel ausgeben)
$Spalten[$ZeitZeiger * $GlobalZeileProStunde].= $Spalten[$ZeitZeiger * $GlobalZeileProStunde].=
"\t\t<td valign=\"top\" rowspan=\"". ( $len * $GlobalZeileProStunde). "\">\n". "\t\t<td valign=\"top\" rowspan=\"".
( ( ($len+$ZeitZeiger)? $len : 24-$len+$ZeitZeiger) * $GlobalZeileProStunde).
"\">\n".
"\t\t\t". "\t\t\t".
Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"), Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"),
mysql_result($Erg, $i, "Man") ). mysql_result($Erg, $i, "Man") ).
(( ($ZeitZeiger+$len) > 24)? "\t\t\t<h3>&darr;&darr;&darr;</h3>" : "").
"\n\t\t</td>\n"; "\n\t\t</td>\n";
$ZeitZeiger += $len; $ZeitZeiger += $len;
} }
@ -254,7 +284,7 @@ function CreateRoomShifts( $raum )
echo Get_Text("pub_schichtplan_colision"). " ". echo Get_Text("pub_schichtplan_colision"). " ".
mysql_result($Erg, $i, "DateS"). mysql_result($Erg, $i, "DateS").
" '". mysql_result($Erg, $i, "Man"). "' ". " '". mysql_result($Erg, $i, "Man"). "' ".
" (". mysql_result($Erg, $i, "SID"). " R$raum)<br><br>"; " (". mysql_result($Erg, $i, "SID"). " R$raum) (xx-xx)<br><br>";
} }
} }
if( $ZeitZeiger <= 24 ) if( $ZeitZeiger <= 24 )
@ -321,8 +351,9 @@ function SummRoomShifts( $raum )
global $ausdatum, $con, $DEBUG, $GlobalZeileProStunde; global $ausdatum, $con, $DEBUG, $GlobalZeileProStunde;
$SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ".
"WHERE ((`RID` = '$raum') AND (`DateE` like '$ausdatum%') AND ". "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND ".
"(`DateS` like '$ausdatum%') ) ORDER BY `DateS`;"; "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;";
$ErgSonder = mysql_query($SQLSonder, $con); $ErgSonder = mysql_query($SQLSonder, $con);
return mysql_num_rows($ErgSonder); return mysql_num_rows($ErgSonder);

View File

@ -2,18 +2,83 @@
<? <?
$SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS`"; function DatumUm1TagErhoehen( $Datum)
{
$Jahr = substr( $Datum, 0, 4);
$Monat = substr( $Datum, 5, 2);
$Tag = substr( $Datum, 8, 2);
$Tag++;
switch( $Monat)
{
case 1: $Mmax=31; break;
case 2: $Mmax=28; break;
case 3: $Mmax=31; break;
case 4: $Mmax=30; break;
case 5: $Mmax=31; break;
case 6: $Mmax=30; break;
case 7: $Mmax=31; break;
case 8: $Mmax=31; break;
case 9: $Mmax=30; break;
case 10: $Mmax=31; break;
case 11: $Mmax=30; break;
case 12: $Mmax=31; break;
}
if( $Tag > $Mmax)
{
$Tag = 1;
$Monat++;
}
if( $Monat > 12 )
{
$Monat = 1;
$Jahr++;
}
return ("$Jahr-$Monat-$Tag");
} //function DatumUm1Tagerhoehen(
function Printlink( $Datum)
{
GLOBAL $raum;
echo "\t<li><a href='./schichtplan.php?ausdatum=$Datum";
// ist ein raum gesetzt?
if (IsSet($raum))
echo "&raum=$raum";
echo "'>$Datum</a></li>\n";
} //function Printlink(
//suchen den ersten eintrags
$SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1";
$Erg = mysql_query($SQL, $con); $Erg = mysql_query($SQL, $con);
for ($i = 0 ; $i < mysql_fetch_row($Erg) ; $i++) do
if ($tmp != substr(mysql_result($Erg, $i , 0), 0,10)) { {
$tmp = substr(mysql_result($Erg, $i , 0), 0,10); //Startdatum einlesen und link ausgeben
echo "\t<li><a href='./schichtplan.php?ausdatum=$tmp"; $DateS = substr(mysql_result($Erg, 0 , 0), 0,10);
// ist ein raum gesetzt? Printlink( $DateS);
if (IsSet($raum)) {
echo "&raum=$raum"; //auslesen den endes und eventuelle weitere tage ausgeben
} $SQL2 = "SELECT MAX(`DateE`) FROM `Shifts` ".
echo "'>$tmp</a></li>\n"; "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);
?> ?>