This commit is contained in:
Philip Häusler 2011-07-19 20:19:31 +02:00
parent e8c035e166
commit fb15edc605
2 changed files with 0 additions and 377 deletions

View File

@ -1,199 +0,0 @@
<?php
$title = "R&auml;ume";
$header = "Verwaltung der R&auml;ume";
include ("../../includes/header.php");
include ("../../includes/funktion_schichtplan_array.php");
$Sql = "SELECT * FROM `Room` ORDER BY `Number`, `Name`";
$Erg = mysql_query($Sql, $con);
if( !IsSet($_GET["action"]) )
{
echo "Hallo ".$_SESSION['Nick'].
",<br>\nhier hast du die M&ouml;glichkeit, neue R&auml;ume f&uuml;r die Schichtpl&auml;ne einzutragen ".
"oder vorhandene abzu&auml;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++ )
{
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>";
}
echo "\t<td>&Auml;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);
switch ($_GET["action"]) {
case 'new':
echo "Neuen Raum einrichten: <br>";
echo "<form action=\"./room.php\" method=\"GET\">\n";
echo "<table>\n";
for( $Uj = 1; $Uj < mysql_num_fields($Erg); $Uj++ )
{
if( (mysql_field_name($Erg, $Uj) == "show") || (mysql_field_name($Erg, $Uj) == "FromPentabarf") )
{
echo "<tr><td>". mysql_field_name($Erg, $Uj). "</td>".
"<td>".
"<input type=\"radio\" name=\"". mysql_field_name($Erg, $Uj). "\" value=\"Y\">Yes".
"<input type=\"radio\" name=\"". mysql_field_name($Erg, $Uj). "\" value=\"N\">No".
"</td></tr>\n";
}
else
{
//sonderfall fuer Default Engel
if( substr( mysql_field_name($Erg, $Uj), 0, 12) == "DEFAULT_EID_")
$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)."\">";
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':
$vars = $_GET;
$count = count($vars) - 1;
$vars = array_splice($vars, 0, $count);
$Keys = "";
$Values = "";
foreach($vars as $key => $value)
{
$Keys .= ", `$key`";
$Values .= ", '$value'";
}
$SQL = "INSERT INTO `Room` (". substr( $Keys, 2). ") VALUES (". substr( $Values, 2). ")";
SetHeaderGo2Back();
break;
case 'change':
if (! IsSet($_GET["RID"]))
echo "Fehlerhafter Aufruf!";
else
{
$SQL2 = "SELECT * FROM `Room` WHERE `RID`='". $_GET["RID"]. "'";
$ERG = mysql_query($SQL2, $con);
if( mysql_num_rows( $ERG)>0)
{
echo "Raum ab&auml;ndern:\n";
echo "Hier kannst du eintragen, welche und wieviele Engel f&uuml;r den Raum zur Verf?gung stehen m&uuml;ssen.";
echo "<form action=\"./room.php\" method=\"GET\">\n";
echo "<table>\n";
for ($Uj = 1; $Uj < mysql_num_fields($ERG); $Uj++)
{
if( (mysql_field_name($ERG, $Uj) == "show") || (mysql_field_name($ERG, $Uj) == "FromPentabarf") )
{
echo "<tr><td>". mysql_field_name($Erg, $Uj). "</td>".
"<td>".
"<input type=\"radio\" name=\"e". mysql_field_name($ERG, $Uj).
"\" value=\"Y\"". (mysql_result($ERG, 0, $Uj)=='Y'? " checked":""). ">Yes".
"<input type=\"radio\" name=\"e". mysql_field_name($ERG, $Uj).
"\" value=\"N\"". (mysql_result($ERG, 0, $Uj)=='N'? " checked":""). ">No".
"</td></tr>\n";
}
else
{
if( substr( mysql_field_name($ERG, $Uj), 0, 12) == "DEFAULT_EID_")
//sonderfall fuer Default Engel
$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)."\">".
"</td></tr>\n";
}
}
echo "</table>\n";
echo "<input type=\"hidden\" name=\"eRID\" value=\"". $_GET["RID"]. "\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"changesave\">\n";
echo "<input type=\"submit\" value=\"sichern...\">\n";
echo "</form>";
echo "<form action=\"./room.php\" method=\"GET\">\n";
echo "<input type=\"hidden\" name=\"RID\" value=\"". $_GET["RID"]. "\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"delete\">\n";
echo "<input type=\"submit\" value=\"L&ouml;schen...\">";
echo "</form>";
}
else
echo "FEHLER: Room ID ". $_GET["RID"]. " nicht gefunden";
}
break;
case 'changesave':
$sql="";
$vars = $_GET;
$count = count($vars) - 2;
$vars = array_splice($vars, 0, $count);
foreach($vars as $key => $value)
{
$keys = substr($key,1);
$sql .= ", `".$keys."`='".$value."' ";
}
$SQL = "UPDATE `Room` SET ". substr($sql, 2). " WHERE `RID`='". $_GET["eRID"]. "'";
SetHeaderGo2Back();
break;
case 'delete':
if (IsSet($_GET["RID"])) {
$SQL="DELETE FROM `Room` WHERE `RID`='". $_GET["RID"]. "'";
} else {
echo "Fehlerhafter Aufruf";
}
SetHeaderGo2Back();
break;
} //switch
// Update ???
if (IsSet($SQL)){
// echo $SQL;
// hier muesste das SQL ausgefuehrt werden...
$Erg = db_query($SQL, "exec SQL");
if ($Erg == 1)
echo "&Auml;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
} //IF IsSet($action)
include ("../../includes/footer.php");
?>

View File

@ -1,178 +0,0 @@
<?php
// Eigener Schichtplan
require_once ('../bootstrap.php');
$title = "Himmel";
$header = "Mein Schichtplan";
include ("includes/header.php");
include ("includes/funktionen.php");
include ("includes/funktion_schichtplan.php");
include ("includes/funktion_schichtplan_aray.php");
if (!isset ($_GET["action"])) {
echo Get_Text("Hello") . $_SESSION['Nick'] . ", <br />\n";
echo Get_Text("pub_mywake_beschreibung1") . "<br />\n";
echo Get_Text("pub_mywake_beschreibung2") . "<br /><br />\n";
echo Get_Text("pub_mywake_beschreibung3") . ($LETZTES_AUSTRAGEN) .
Get_Text("pub_mywake_beschreibung4") . "<br /><br />\n";
$USER_ID = $_SESSION['UID'];
if ($_SESSION['CVS']["admin/schichtplan.php"] == "Y") {
if (!isset ($_GET["UIDs"]))
$_GET["UIDs"] = $_SESSION['UID'];
else
$USER_ID = $_GET["UIDs"];
echo "<form action=\"" . $_SERVER['SCRIPT_NAME'] . "\" method=\"GET\" >";
echo "Liste von <select name=\"UIDs\">\n";
$usql = "SELECT * FROM `User` ORDER BY `Nick`";
$uErg = mysql_query($usql, $con);
$urowcount = mysql_num_rows($uErg);
for ($k = 0; $k < $urowcount; $k++) {
echo "<option value=\"" . mysql_result($uErg, $k, "UID") . "\" " .
(($_GET["UIDs"] == mysql_result($uErg, $k, "UID")) ? " selected" : "") . ">" .
mysql_result($uErg, $k, "Nick") .
"</option>\n";
}
echo "</select> anzeigen.\n";
echo mysql_error($con);
echo "<input type=\"submit\" value=\"zeigen\">\n";
echo "</form>";
}
$SQL = "SELECT *, `ShiftEntry`.`Comment`, `ShiftEntry`.`TID` FROM `Shifts` " .
"INNER JOIN `ShiftEntry` " .
"ON `Shifts`.`SID`=`ShiftEntry`.`SID` " .
"WHERE `ShiftEntry`.`UID`='$USER_ID' " .
"ORDER BY `DateS`";
$erg = mysql_query($SQL, $con);
?>
<table border="0" class="border" cellpadding="2" cellspacing="1">
<tr>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Datum");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Uhrzeit");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Len");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Name");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Ort");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Bemerkung");?></b></td>
<td class="contenttopic"><b><?php echo Get_Text("pub_mywake_Austragen");?></b></td>
</tr>
<?php
for ($i = 0; $i < mysql_num_rows($erg); $i++) {
echo "<tr class=\"content\">";
echo "<td>" . substr(mysql_result($erg, $i, "DateS"), 0, 10) . "</td>\n";
echo "<td>" . substr(mysql_result($erg, $i, "DateS"), 11) . "</td>\n";
echo "<td>" . mysql_result($erg, $i, "Len") . " h</td>\n";
echo "<td>" . mysql_result($erg, $i, "Man") . "</td>\n";
echo "<td>" . $RoomID[mysql_result($erg, $i, "RID")] . "<br />\n" .
"(" . TID2Type(mysql_result($erg, $i, "TID")) . Get_Text("inc_schicht_engel") . ")" .
"</td>\n";
echo "<td><pre style=\"font-family:Fixedsys,Courier; padding:12x;\">\n" .
mysql_result($erg, $i, "Comment") .
"\n</pre>\n";
echo "<br /><a href=\"./myschichtplan.php?action=edit&SID=\n" .
mysql_result($erg, $i, "SID") . "\"># vi #</a></td>\n";
// bis $LETZTES_AUSTRAGEN (aus dem config-file) soll es moeglich sein, seine Schichten
//// selber noch austragen zu koennen...
$schichtdate = mysql_result($erg, $i, "DateS");
ereg("^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $schichtdate, $res);
$info["year"] = $res[1];
$info["month"] = $res[2];
$info["day"] = $res[3];
$info["hour"] = $res[4];
$info["min"] = $res[5];
$info["sec"] = $res[6];
$schichtdatum = (mktime($info["hour"], $info["min"], $info["sec"], $info["month"], $info["day"], $info["year"]));
$lastAustragen = $LETZTES_AUSTRAGEN * 3600;
$nowdate = time();
// wenn Schichtbeginn > jetziges Datum + $LETZTES_AUSTRAGEN - Stunden soll ein Austragen
// noch m<>glich sein
if ($schichtdatum > ($lastAustragen + $nowdate))
echo "<td> <a href=\"./myschichtplan.php?action=austragen&SID=" .
mysql_result($erg, $i, "SID") . "\">" .
Get_Text("pub_mywake_austragen") . "</a></td>\n";
else
echo "<td>" . Get_Text("pub_mywake_austragen_n_c") . "</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
if ($_SESSION['CVS']["nonpublic/myschichtplan_ical.php"] == "Y") {
echo "<br /><a href=\"./myschichtplan_ical.php\">" . Get_Text("pub_myschichtplan_ical") . "</a>\n";
}
} else {
If ($_GET["action"] == "austragen") {
echo Get_Text("pub_mywake_delate1") . "<br />\n";
$sql = "SELECT * FROM `Shifts` WHERE (`SID` = '" . $_GET["SID"] . "')";
$Erg = mysql_query($sql, $con);
$schichtdate = mysql_result($Erg, 0, "DateS");
ereg("^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $schichtdate, $res);
$info["year"] = $res[1];
$info["month"] = $res[2];
$info["day"] = $res[3];
$info["hour"] = $res[4];
$info["min"] = $res[5];
$info["sec"] = $res[6];
$schichtdatum = (mktime($info["hour"], $info["min"], $info["sec"], $info["month"], $info["day"], $info["year"]));
$lastAustragen = $LETZTES_AUSTRAGEN * 3600;
$nowdate = time();
// wenn Schichtbeginn > jetziges Datum + $LETZTES_AUSTRAGEN - Stunden soll ein Austragen
// noch m<>glich sein
if ($schichtdatum > ($lastAustragen + $nowdate)) {
$sql2 = "UPDATE `ShiftEntry` " .
"SET `UID` = '0', `Comment` = NULL " .
"WHERE `SID` = '" . $_GET["SID"] . "' AND `UID` = '" . $_SESSION['UID'] . "' LIMIT 1;";
$Erg2 = mysql_query($sql2, $con);
if ($Erg2 == 1)
echo Get_Text("pub_mywake_add_ok") . "\n";
else
echo Get_Text("pub_mywake_add_ko") . "\n";
} else
echo Get_Text("pub_mywake_after") . "\n";
}
elseif ($_GET["action"] == "edit") {
echo Get_Text("pub_myshift_Edit_Text1") . "\n";
$sql = "SELECT * FROM `ShiftEntry` WHERE ";
$sql .= "(`SID`='" . $_GET["SID"] . "' AND `UID`='" . $_SESSION['UID'] . "')";
$Erg = mysql_query($sql, $con);
echo "<form action=\"./myschichtplan.php\" method=\"GET\">\n";
echo "<textarea name='newtext' cols='50' rows='10'>" . mysql_result($Erg, 0, "Comment") . "</textarea><br /><br />\n";
echo "<input type=\"submit\" value=\"save\">\n";
echo "<input type=\"hidden\" name=\"SID\" value=\"" . $_GET["SID"] . "\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"editSave\">\n";
echo "</form>";
}
elseif ($_GET["action"] == "editSave") {
echo Get_Text("pub_myshift_EditSave_Text1") . "<br />\n";
$sql = "UPDATE `ShiftEntry` " .
"SET `Comment` = '" . $_GET["newtext"] . "' " .
"WHERE `SID`='" . $_GET["SID"] . "' AND `UID`='" . $_SESSION['UID'] . "' LIMIT 1;";
$Erg = mysql_query($sql, $con);
if ($Erg == 1)
echo " ..." . Get_Text("pub_myshift_EditSave_OK") . "\n";
else
echo " ..." . Get_Text("pub_myshift_EditSave_KO") . "\n";
SetHeaderGo2Back();
}
}
include ("includes/footer.php");
?>