2011-06-01 12:13:39 +02:00
< ? php
2011-06-01 15:02:00 +02:00
require_once ( '../bootstrap.php' );
2005-09-10 19:25:43 +02:00
$title = " Erzengel " ;
$header = " Freie Engel " ;
2011-06-01 15:02:00 +02:00
include ( " includes/header.php " );
include ( " includes/funktion_db_list.php " );
2005-09-10 19:25:43 +02:00
2011-06-01 15:02:00 +02:00
echo " Hallo " . $_SESSION [ 'Nick' ] . " ,<br /> \n " ;
2005-09-10 19:25:43 +02:00
2011-06-01 12:13:39 +02:00
echo " <br /><br /> \n \n Hier findest du alle Engel, welche zur Zeit in keiner Schicht verplant sind:<br /><br /> \n " ;
2005-09-10 19:25:43 +02:00
#######################################################
# Ermitteln freier Engel
#
# auslesen aller Engel und dazugehoerige Schichten
#######################################################
// $SQL= "SELECT User.Nick, Schichtplan.*, Schichtbelegung. * FROM User LEFT JOIN Schichtplan ON User.UID=Schichtbelegung.UID, Schichtplan.SID LEFT JOIN Schichtbelegung.SID WHERE User.UID = Schichtbelegung.UID AND Schichtplan.SID = Schichtbelegung.SID AND Schichtplan.Date < now() and Schichtplan.EndDate > now() ORDER BY Nick";
/* geht nicht ? ? ? unter stabel !!
$SQL = " SELECT User.Nick, Schichtplan.*, Schichtbelegung.* " .
2011-06-01 12:13:39 +02:00
" FROM Schichtplan, User LEFT OUTER " .
" JOIN Schichtbelegung ON User.UID=Schichtbelegung.UID " .
" WHERE Schichtplan.SID = Schichtbelegung.SID AND " .
" Schichtplan.Date < now() and " .
" Schichtplan.EndDate > now() " .
" ORDER BY Nick " ;
2005-09-10 19:25:43 +02:00
$SQL = " SELECT Shifts.*, ShiftEntry.*, User.Nick " .
2011-06-01 12:13:39 +02:00
" FROM User " .
" INNER JOIN (Shifts INNER JOIN ShiftEntry ON Shifts.SID = ShiftEntry.SID) ON User.UID = ShiftEntry.UID " .
" WHERE (Shifts.DateS<=Now() AND Shifts.DateE>=Now() ); " ;
2005-09-10 19:25:43 +02:00
*/
2011-06-01 15:02:00 +02:00
$SQL = " SELECT Shifts.*, ShiftEntry.* " .
" FROM `Shifts` INNER JOIN ShiftEntry ON Shifts.SID = ShiftEntry.SID " .
" WHERE (Shifts.DateS<=Now() AND Shifts.DateE>=Now() AND ShiftEntry.UID>0); " ;
2005-09-10 19:25:43 +02:00
//SELECT User.Nick, Schichtplan.*, Schichtbelegung. * FROM User LEFT JOIN Schichtbelegung ON User.UID=Schichtbelegung.UID, Schichtplan LEFT JOIN Schichtbelegung ON Schichtplan.SID = Schichtbelegung.SID WHERE Schichtplan.Date < now() and Schichtplan.EndDate > now() ORDER BY Nick
//echo "<pre>$SQL</pre>";
$Erg = mysql_query ( $SQL , $con );
2011-06-01 15:02:00 +02:00
$Zeilen = mysql_num_rows ( $Erg );
2005-09-10 19:25:43 +02:00
// for ($i = 1; $i < mysql_num_fields($Erg); $i++)
// echo "|".mysql_field_name($Erg, $i);
echo " <table width= \" 100% \" class= \" border \" cellpadding= \" 2 \" cellspacing= \" 1 \" > \n " ;
echo " \t <tr class= \" contenttopic \" > \n " ;
echo " \t \t <td>Nick</td> \n " ;
echo " \t \t <td>Schicht</td> \n " ;
echo " \t \t <td>Ort</td> \n " ;
echo " \t \t <td>Von</td> \n " ;
echo " \t \t <td>Bis</td> \n " ;
echo " \t </tr> \n " ;
2011-06-01 15:02:00 +02:00
$inuse = " " ;
for ( $i = 0 ; $i < $Zeilen ; $i ++ ) {
echo " <tr class= \" content \" > \n " ;
echo " <td><a href= \" ./userChangeNormal.php?Type=Normal&enterUID= " . mysql_result ( $Erg , $i , " UID " ) . " \" > " .
UID2Nick ( mysql_result ( $Erg , $i , " UID " )) . " </td></a> \n " ;
echo " <td></td> \n " ;
echo " <td> " . mysql_result ( $Erg , $i , " RID " ) . " </td> \n " ;
echo " <td> " . mysql_result ( $Erg , $i , " DateS " ) . " </td> \n " ;
echo " <td> " . mysql_result ( $Erg , $i , " DateE " ) . " </td> \n " ;
echo " </tr> \n " ;
if ( $inuse != " " )
$inuse .= " OR " ;
$inuse .= " (Nick = \" " . UID2Nick ( mysql_result ( $Erg , $i , " UID " )) . " \" ) " ;
2005-09-10 19:25:43 +02:00
}
2011-06-01 15:02:00 +02:00
if ( $inuse != " " )
$inuse = " WHERE NOT ( " .
$inuse . " ) " ;
2005-09-10 19:25:43 +02:00
echo " </table> \n " ;
//##########################################################################################################
2011-06-01 12:13:39 +02:00
echo " <br /><br /> \n \n hier findest du alle Engel, welche zur Zeit in keiner Schichten verplant sind:<br /><br /> \n " ;
2005-09-10 19:25:43 +02:00
echo " <table width= \" 100% \" class= \" border \" cellpadding= \" 2 \" cellspacing= \" 1 \" \ > \n " ;
echo " \t <tr class= \" contenttopic \" > \n \t \t <td>Nick</td> \n \t \t <td>DECT</td> \n \t </tr> \n " ;
2011-06-01 15:02:00 +02:00
$SQL = " SELECT Nick, UID, DECT FROM User " . $inuse . " ; " ;
2005-09-10 19:25:43 +02:00
$Erg = mysql_query ( $SQL , $con );
2011-06-01 15:02:00 +02:00
$Zeilen = mysql_num_rows ( $Erg );
for ( $i = 0 ; $i < $Zeilen ; $i ++ ) {
echo " \t <tr class= \" content \" > \n " ;
echo " \t \t <td><a href= \" ./userChangeNormal.php?Type=Normal&enterUID= " . mysql_result ( $Erg , $i , " UID " ) . " \" > " .
mysql_result ( $Erg , $i , " Nick " ) . " </a></td> \n " ;
echo " \t \t <td> " . mysql_result ( $Erg , $i , " DECT " ) . " </td> \n " ;
echo " \n </tr> \n " ;
2005-09-10 19:25:43 +02:00
}
echo " </table> \n " ;
2011-06-01 15:02:00 +02:00
include ( " includes/footer.php " );
2005-09-10 19:25:43 +02:00
?>