diff options
Diffstat (limited to 'www-ssl/admin/free_DECT.php')
-rw-r--r-- | www-ssl/admin/free_DECT.php | 93 |
1 files changed, 40 insertions, 53 deletions
diff --git a/www-ssl/admin/free_DECT.php b/www-ssl/admin/free_DECT.php index 83a4123f..4b4e3085 100644 --- a/www-ssl/admin/free_DECT.php +++ b/www-ssl/admin/free_DECT.php @@ -1,9 +1,9 @@ <?php +require_once ('../bootstrap.php'); -include ("../../../camp2011/includes/config_db.php"); -include ("../../../camp2011/includes/funktion_db_list.php"); -include ("../../../camp2011/includes/funktion_user.php"); - +include ("config/config_db.php"); +include ("includes/funktion_db_list.php"); +include ("includes/funktion_user.php"); ####################################################### # Ermitteln freier Engel @@ -11,68 +11,55 @@ include ("../../../camp2011/includes/funktion_user.php"); # auslesen aller Engel und dazugehoerige Schichten ####################################################### -$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);"; +$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);"; $Erg = mysql_query($SQL, $con); -$Zeilen = mysql_num_rows($Erg); +$Zeilen = mysql_num_rows($Erg); -$inuse=""; -for ($i=0; $i < $Zeilen; $i++) -{ - if ($inuse!="") - $inuse.= " OR "; - $inuse.= "(UID = \"". mysql_result($Erg, $i, "UID"). "\")"; -} -if ($inuse!="") -{ - $inuse=" WHERE (NOT (".$inuse.")) AND (DECT!='')"; +$inuse = ""; +for ($i = 0; $i < $Zeilen; $i++) { + if ($inuse != "") + $inuse .= " OR "; + $inuse .= "(UID = \"" . mysql_result($Erg, $i, "UID") . "\")"; } -else -{ - $inuse=" WHERE (DECT!='')"; +if ($inuse != "") { + $inuse = " WHERE (NOT (" . $inuse . ")) AND (DECT!='')"; +} else { + $inuse = " WHERE (DECT!='')"; } - //########################################################################################################## -$SQL = "SELECT * FROM User".$inuse.";"; +$SQL = "SELECT * FROM User" . $inuse . ";"; $Erg = mysql_query($SQL, $con); -$Zeilen = mysql_num_rows($Erg); -for ($i=0; $i < $Zeilen; $i++) -{ - // get DECT number - echo mysql_result($Erg, $i, "DECT"). "\t"; +$Zeilen = mysql_num_rows($Erg); +for ($i = 0; $i < $Zeilen; $i++) { + // get DECT number + echo mysql_result($Erg, $i, "DECT") . "\t"; - // get all user rights - $SQL_RIGHT = "SELECT * FROM UserCVS WHERE UID=". mysql_result($Erg, $i, "UID"). ";"; - $Erg_RIGHT = mysql_query($SQL_RIGHT, $con); - $UserRights = mysql_fetch_array($Erg_RIGHT); + // get all user rights + $SQL_RIGHT = "SELECT * FROM UserCVS WHERE UID=" . mysql_result($Erg, $i, "UID") . ";"; + $Erg_RIGHT = mysql_query($SQL_RIGHT, $con); + $UserRights = mysql_fetch_array($Erg_RIGHT); - foreach( $UserRights as $Var => $Value) - { - if( (strpos( $Var, ".php") === false) AND - (strpos( $Var, "/") === false) AND - (strpos( $Var, "UID") === false) AND - (is_numeric($Var) === false) ) - { - echo "\"".$Var. "\"=". $Value. "\t"; - } - } + foreach ($UserRights as $Var => $Value) { + if ((strpos($Var, ".php") === false) AND (strpos($Var, "/") === false) AND (strpos($Var, "UID") === false) AND (is_numeric($Var) === false)) { + echo "\"" . $Var . "\"=" . $Value . "\t"; + } + } - // get shift types - $SQL_TYPES = "SELECT TID FROM `ShiftEntry` WHERE UID=". mysql_result($Erg, $i, "UID"). " GROUP BY TID;"; - $Erg_TYPES = mysql_query($SQL_TYPES, $con); - $Zeilen_Typen = mysql_num_rows($Erg_TYPES); - for ($j=0; $j < $Zeilen_Typen; $j++) - { - echo "\"TID_". TID2Type( mysql_result($Erg_TYPES, $j, "TID")). "\"=Y\t"; - } + // get shift types + $SQL_TYPES = "SELECT TID FROM `ShiftEntry` WHERE UID=" . mysql_result($Erg, $i, "UID") . " GROUP BY TID;"; + $Erg_TYPES = mysql_query($SQL_TYPES, $con); + $Zeilen_Typen = mysql_num_rows($Erg_TYPES); + for ($j = 0; $j < $Zeilen_Typen; $j++) { + echo "\"TID_" . TID2Type(mysql_result($Erg_TYPES, $j, "TID")) . "\"=Y\t"; + } - echo "\n"; -// echo "<br />"; + echo "\n"; + // echo "<br />"; } - ?> |