engelsystem/www-ssl_old/admin/free_DECT.php

66 lines
2.0 KiB
PHP
Raw Normal View History

2011-06-01 12:13:39 +02:00
<?php
2011-06-01 15:02:00 +02:00
require_once ('../bootstrap.php');
2011-06-01 15:02:00 +02:00
include ("config/config_db.php");
include ("includes/funktion_db_list.php");
include ("includes/funktion_user.php");
#######################################################
# Ermitteln freier Engel
#
# auslesen aller Engel und dazugehoerige Schichten
#######################################################
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);";
$Erg = mysql_query($SQL, $con);
2011-06-01 15:02:00 +02:00
$Zeilen = mysql_num_rows($Erg);
2011-06-01 15:02:00 +02:00
$inuse = "";
for ($i = 0; $i < $Zeilen; $i++) {
if ($inuse != "")
$inuse .= " OR ";
$inuse .= "(UID = \"" . mysql_result($Erg, $i, "UID") . "\")";
}
2011-06-01 15:02:00 +02:00
if ($inuse != "") {
$inuse = " WHERE (NOT (" . $inuse . ")) AND (DECT!='')";
} else {
$inuse = " WHERE (DECT!='')";
}
//##########################################################################################################
2011-06-01 15:02:00 +02:00
$SQL = "SELECT * FROM User" . $inuse . ";";
$Erg = mysql_query($SQL, $con);
2011-06-01 15:02:00 +02:00
$Zeilen = mysql_num_rows($Erg);
for ($i = 0; $i < $Zeilen; $i++) {
// get DECT number
echo mysql_result($Erg, $i, "DECT") . "\t";
2011-06-01 15:02:00 +02:00
// 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);
2011-06-01 15:02:00 +02:00
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";
}
}
2011-06-01 15:02:00 +02:00
// 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";
}
2011-06-01 15:02:00 +02:00
echo "\n";
// echo "<br />";
}
?>