2005-09-10 19:25:43 +02:00
|
|
|
|
<?php
|
|
|
|
|
$title = "Räume";
|
|
|
|
|
$header = "Verwaltung der Räume";
|
|
|
|
|
include ("./inc/header.php");
|
|
|
|
|
include ("./inc/funktion_user.php");
|
2005-11-22 18:25:49 +01:00
|
|
|
|
include ("./inc/funktion_schichtplan_aray.php");
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
|
|
$Sql = "SELECT * FROM `Room` ORDER BY Number, Name";
|
|
|
|
|
$Erg = mysql_query($Sql, $con);
|
|
|
|
|
|
2005-11-06 02:19:11 +01:00
|
|
|
|
if( !IsSet($_GET["action"]) )
|
2005-09-10 19:25:43 +02:00
|
|
|
|
{
|
|
|
|
|
echo "Hallo ".$_SESSION['Nick'].
|
|
|
|
|
",<br>\nhier hast du die Möglichkeit, neue Räume für die Schichtpläne einzutragen ".
|
|
|
|
|
"oder vorhandene abzuändern:<br><br>\n";
|
|
|
|
|
|
|
|
|
|
echo "<a href=\"./room.php?action=new\">- Neuen Raum/Ort eintragen</a><br>\n";
|
|
|
|
|
|
|
|
|
|
echo "<table width=\"100%\" class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n";
|
|
|
|
|
echo "<tr class=\"contenttopic\">\n";
|
|
|
|
|
|
|
|
|
|
for( $i = 1; $i < mysql_num_fields($Erg); $i++ )
|
|
|
|
|
{
|
2005-10-21 19:39:16 +02:00
|
|
|
|
if( substr( mysql_field_name($Erg, $i), 0, 12) == "DEFAULT_EID_")
|
|
|
|
|
echo "\t<td> Anzahl ". $EngelTypeID[substr( mysql_field_name($Erg, $i), 12)]. "</td>";
|
|
|
|
|
else
|
|
|
|
|
echo "\t<td>". mysql_field_name($Erg, $i)."</td>";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
|
|
|
|
echo "\t<td>Ändern</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
|
|
|
|
|
for( $t = 0; $t < mysql_num_rows($Erg); $t++ )
|
|
|
|
|
{
|
|
|
|
|
echo "\t<tr class=\"content\">\n";
|
|
|
|
|
for ($j = 1; $j < mysql_num_fields($Erg); $j++)
|
|
|
|
|
{
|
|
|
|
|
echo "\t\t<td>".mysql_result($Erg, $t, $j)."</td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "\t\t<td><a href=\"./room.php?action=change&RID=".mysql_result($Erg, $t, "RID")."\">###</a></td>\n";
|
|
|
|
|
echo "\t</tr>\n";
|
|
|
|
|
} // ende Auflistung Raeume
|
|
|
|
|
echo "</table>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
UnSet($SQL);
|
|
|
|
|
|
2005-11-06 02:19:11 +01:00
|
|
|
|
switch ($_GET["action"]) {
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
|
|
case 'new':
|
|
|
|
|
echo "Neuen Raum einrichten: <br>";
|
2005-11-06 02:19:11 +01:00
|
|
|
|
echo "<form action=\"./room.php\" method=\"GET\">\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "<table>\n";
|
|
|
|
|
|
|
|
|
|
for( $Uj = 1; $Uj < mysql_num_fields($Erg); $Uj++ )
|
|
|
|
|
{
|
|
|
|
|
//sonderfall fuer Default Engel
|
|
|
|
|
if( substr( mysql_field_name($Erg, $Uj), 0, 12) == "DEFAULT_EID_")
|
2005-10-21 19:39:16 +02:00
|
|
|
|
$FeldName = "Anzahl ". $EngelTypeID[substr( mysql_field_name($Erg, $Uj), 12)];
|
|
|
|
|
else
|
|
|
|
|
$FeldName = mysql_field_name($Erg, $Uj);
|
|
|
|
|
|
|
|
|
|
echo "<td>$FeldName</td>".
|
|
|
|
|
"<td><input type=\"text\" size=\"40\" name=\"".mysql_field_name($Erg, $Uj)."\">";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "</td></tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"newsave\">\n";
|
|
|
|
|
echo "<input type=\"submit\" value=\"sichern...\">\n";
|
|
|
|
|
echo "</form>";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'newsave':
|
2005-11-06 02:19:11 +01:00
|
|
|
|
$vars = $HTTP_GET_VARS;
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$count = count($vars) - 1;
|
|
|
|
|
$vars = array_splice($vars, 0, $count);
|
2005-11-06 02:19:11 +01:00
|
|
|
|
$Keys = "";
|
|
|
|
|
$Values = "";
|
|
|
|
|
foreach($vars as $key => $value)
|
|
|
|
|
{
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$Keys .= ", `$key`";
|
|
|
|
|
$Values .= ", '$value'";
|
|
|
|
|
}
|
2005-11-16 00:19:38 +01:00
|
|
|
|
$SQL = "INSERT INTO `Room` (". substr( $Keys, 2). ") VALUES (". substr( $Values, 2). ")";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
SetHeaderGo2Back();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'change':
|
2005-11-06 02:19:11 +01:00
|
|
|
|
if (! IsSet($_GET["RID"])) {
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "Fehlerhafter Aufruf!";
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
echo "Raum abändern:\n";
|
|
|
|
|
|
|
|
|
|
echo "Hier kannst du eintragen, welche und wieviele Engel für den Raum zur Verf<72>gung stehen müssen.";
|
|
|
|
|
|
2005-11-06 02:19:11 +01:00
|
|
|
|
echo "<form action=\"./room.php\" method=\"GET\">\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "<table>\n";
|
|
|
|
|
|
2005-11-06 02:19:11 +01:00
|
|
|
|
$SQL2 = "SELECT * FROM `Room` WHERE `RID`='". $_GET["RID"]. "'";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$ERG = mysql_query($SQL2, $con);
|
|
|
|
|
|
|
|
|
|
for ($Uj = 1; $Uj < mysql_num_fields($ERG); $Uj++)
|
|
|
|
|
{
|
|
|
|
|
//sonderfall fuer Default Engel
|
|
|
|
|
if( substr( mysql_field_name($ERG, $Uj), 0, 12) == "DEFAULT_EID_")
|
2005-10-21 19:39:16 +02:00
|
|
|
|
$FeldName = "Anzahl ". $EngelTypeID[substr( mysql_field_name($ERG, $Uj), 12)];
|
|
|
|
|
else
|
|
|
|
|
$FeldName = mysql_field_name($ERG, $Uj);
|
|
|
|
|
|
|
|
|
|
echo "<tr><td>$FeldName</td>".
|
|
|
|
|
"<td><input type=\"text\" size=\"40\" name=\"e".mysql_field_name($ERG, $Uj)."\" ".
|
|
|
|
|
"value=\"".mysql_result($ERG, 0, $Uj)."\">";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo"</td></tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "</table>\n";
|
2005-11-06 02:19:11 +01:00
|
|
|
|
echo "<input type=\"hidden\" name=\"eRID\" value=\"". $_GET["RID"]. "\">\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"changesave\">\n";
|
|
|
|
|
echo "<input type=\"submit\" value=\"sichern...\">\n";
|
|
|
|
|
echo "</form>";
|
2005-11-06 02:19:11 +01:00
|
|
|
|
echo "<form action=\"./room.php\" method=\"GET\">\n";
|
|
|
|
|
echo "<input type=\"hidden\" name=\"RID\" value=\"". $_GET["RID"]. "\">\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"delete\">\n";
|
|
|
|
|
echo "<input type=\"submit\" value=\"Löschen...\">";
|
|
|
|
|
echo "</form>";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'changesave':
|
|
|
|
|
$sql="";
|
2005-11-06 02:19:11 +01:00
|
|
|
|
$vars = $HTTP_GET_VARS;
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$count = count($vars) - 2;
|
|
|
|
|
$vars = array_splice($vars, 0, $count);
|
|
|
|
|
foreach($vars as $key => $value){
|
|
|
|
|
$keys = substr($key,1);
|
|
|
|
|
$sql .= ", `".$keys."`='".$value."' ";
|
|
|
|
|
|
|
|
|
|
}
|
2005-11-06 02:19:11 +01:00
|
|
|
|
$SQL = "UPDATE `Room` SET ". substr($sql, 2). " WHERE `RID`='". $_GET["eRID"]. "'";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
SetHeaderGo2Back();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'delete':
|
2005-11-06 02:19:11 +01:00
|
|
|
|
if (IsSet($_GET["RID"])) {
|
|
|
|
|
$SQL="DELETE FROM `Room` WHERE `RID`='". $_GET["RID"]. "'";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
} else {
|
|
|
|
|
echo "Fehlerhafter Aufruf";
|
|
|
|
|
}
|
|
|
|
|
SetHeaderGo2Back();
|
|
|
|
|
break;
|
|
|
|
|
|
2005-10-21 19:39:16 +02:00
|
|
|
|
} //switch
|
|
|
|
|
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
|
|
// Update ???
|
|
|
|
|
|
|
|
|
|
if (IsSet($SQL)){
|
|
|
|
|
// echo $SQL;
|
|
|
|
|
// hier muesste das SQL ausgefuehrt werden...
|
|
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
|
if ($Erg == 1) {
|
|
|
|
|
echo "Änderung wurde gesichert...<br>";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Fehler beim speichern... bitte noch ein mal probieren :)";
|
|
|
|
|
echo "<br><br>".mysql_error( $con ). "<br>($SQL)<br>";
|
|
|
|
|
}
|
|
|
|
|
} // Ende Update
|
|
|
|
|
|
2005-10-21 19:39:16 +02:00
|
|
|
|
} //IF IsSet($action)
|
|
|
|
|
|
2005-09-10 19:25:43 +02:00
|
|
|
|
include ("./inc/footer.php");
|
|
|
|
|
?>
|