@ -1,22 +1,20 @@
<?php
<?php
require_once ('../bootstrap.php');
$title = "Schichtplan";
$title = "Schichtplan";
$header = "Neue Schichten erfassen";
$header = "Neue Schichten erfassen";
$submenus = 1;
$submenus = 1;
include ("../../../camp2011/ includes/header.php");
include ("includes/header.php");
function executeSQL( $SQL)
function executeSQL($SQL) {
{
global $debug, $con;
global $debug, $con;
$Erg = mysql_query($SQL, $con);
$Erg = mysql_query($SQL, $con);
if ($debug)
if ($debug)
echo "DEBUG SQL: $SQL< br / > \n";
echo "DEBUG SQL: $SQL< br / > \n";
if ($Erg == 1)
if ($Erg == 1) {
{
echo "SQL war erfolgreich";
echo "SQL war erfolgreich";
}
} else {
else
{
echo "SQL Fehler (" . mysql_error($con) . ")";
echo "SQL Fehler (" . mysql_error($con) . ")";
}
}
}
}
@ -38,12 +36,12 @@ echo "<form action=\"".$_SERVER['SCRIPT_NAME']."\" method=\"GET\" >\n";
< / tr >
< / tr >
<?php
<?php
$sql = "SELECT `SID`, `DateS`, `RID`, `Len` FROM `Shifts` " .
$sql = "SELECT `SID`, `DateS`, `RID`, `Len` FROM `Shifts` " .
"ORDER BY `RID`, `DateS` ";
"ORDER BY `RID`, `DateS` ";
$Erg = mysql_query($sql, $con);
$Erg = mysql_query($sql, $con);
$rowcount = mysql_num_rows($Erg);
$rowcount = mysql_num_rows($Erg);
for( $i = 0; $i < $rowcount; $i++)
for ($i = 0; $i < $rowcount; $i++) {
{
echo "\t< tr class = \"content\" > \n";
echo "\t< tr class = \"content\" > \n";
echo "\t\t< td > < input type = \"checkbox\" name = \"SID" . mysql_result ( $ Erg , $ i , " SID " ) . " \ " " .
echo "\t\t< td > < input type = \"checkbox\" name = \"SID" . mysql_result ( $ Erg , $ i , " SID " ) . " \ " " .
"value=\"" . mysql_result($Erg, $i, "SID") . "\">< / td > \n";
"value=\"" . mysql_result($Erg, $i, "SID") . "\">< / td > \n";
@ -66,21 +64,17 @@ echo "<input type=\"hidden\" name=\"action\" value=\"deleteShifs\">\n";
echo "< input type = \"submit\" value = \"Löschen...\" > \n";
echo "< input type = \"submit\" value = \"Löschen...\" > \n";
echo "< / form > \n";
echo "< / form > \n";
} else {
} else {
// aus sicherheitzgründen wegen spä terer genuzung
// aus sicherheitzgr<67> nden wegen sp<73> terer genuzung
UnSet ($chSQL);
UnSet ($chSQL);
switch ($_GET["action"]) {
switch ($_GET["action"]) {
case 'change' :
case 'change' :
if ( !IsSet($_GET["SID"]) )
if (!IsSet ($_GET["SID"])) {
{
echo "Fehlerhafter Aufruf!\n";
echo "Fehlerhafter Aufruf!\n";
}
} else {
else
{
$sql = "SELECT * FROM `Shifts` WHERE (`SID` = '" . $_GET["SID"] . "' )";
$sql = "SELECT * FROM `Shifts` WHERE (`SID` = '" . $_GET["SID"] . "' )";
$Erg = mysql_query($sql, $con);
$Erg = mysql_query($sql, $con);
@ -99,12 +93,10 @@ case 'change':
$Erg2 = mysql_query($sql2, $con);
$Erg2 = mysql_query($sql2, $con);
$rowcount = mysql_num_rows($Erg2);
$rowcount = mysql_num_rows($Erg2);
$FromPentabarf = "N";
$FromPentabarf = "N";
for( $i = 0; $i < $rowcount; $i++ )
for ($i = 0; $i < $rowcount; $i++) {
{
$RID = mysql_result($Erg2, $i, "RID");
$RID = mysql_result($Erg2, $i, "RID");
echo " < option value = \"" . $ RID . " \ " " ;
echo " < option value = \"" . $ RID . " \ " " ;
if( $RID == mysql_result($Erg, 0, "RID") )
if ($RID == mysql_result($Erg, 0, "RID")) {
{
echo " selected";
echo " selected";
$FromPentabarf = mysql_result($Erg2, $i, "FromPentabarf");
$FromPentabarf = mysql_result($Erg2, $i, "FromPentabarf");
}
}
@ -121,8 +113,7 @@ case 'change':
echo " < tr > < td > URL< / td > " .
echo " < tr > < td > URL< / td > " .
"< td > < input value = \"" . mysql_result ( $ Erg , 0 , " URL " ) .
"< td > < input value = \"" . mysql_result ( $ Erg , 0 , " URL " ) .
"\" type=\"text\" size=\"40\" name=\"eURL\">< / td > < / tr > \n";
"\" type=\"text\" size=\"40\" name=\"eURL\">< / td > < / tr > \n";
if( $FromPentabarf == "Y")
if ($FromPentabarf == "Y") {
{
echo " < tr > < td > < / td > " .
echo " < tr > < td > < / td > " .
"< td > < h1 > !!! Imported from Pentabarf !!!< / h1 > < / td > < / tr > \n";
"< td > < h1 > !!! Imported from Pentabarf !!!< / h1 > < / td > < / tr > \n";
}
}
@ -133,7 +124,7 @@ case 'change':
echo "< input type = \"submit\" value = \"sichern...\" > \n";
echo "< input type = \"submit\" value = \"sichern...\" > \n";
echo "< / form > \n\n";
echo "< / form > \n\n";
// Lö schen
// L<> schen
echo "< form action = \"" . $ _SERVER [ ' SCRIPT_NAME ' ] . " \ " method = \"GET\" > \n";
echo "< form action = \"" . $ _SERVER [ ' SCRIPT_NAME ' ] . " \ " method = \"GET\" > \n";
echo "< input type = \"hidden\" name = \"SID\" value = \"" . $ _GET [ " SID " ] . " \ " > \n";
echo "< input type = \"hidden\" name = \"SID\" value = \"" . $ _GET [ " SID " ] . " \ " > \n";
echo "< input type = \"hidden\" name = \"action\" value = \"delete\" > \n";
echo "< input type = \"hidden\" name = \"action\" value = \"delete\" > \n";
@ -152,8 +143,7 @@ case 'change':
echo "Folgende Engelschichten sind noch nicht vergeben.\n";
echo "Folgende Engelschichten sind noch nicht vergeben.\n";
echo "Und koenen, wenn diese nSchicht nicht benoetigt wird geloet werden:< br / > \n";
echo "Und koenen, wenn diese nSchicht nicht benoetigt wird geloet werden:< br / > \n";
for ($j=0; $j < $rowcount; $j++)
for ($j = 0; $j < $rowcount; $j++) {
{
$TID = mysql_result($Erg3, $j, 0);
$TID = mysql_result($Erg3, $j, 0);
echo "< a href = \"./schichtplan.php?action=engelshiftdel&SID=" . $ _GET [ " SID " ] . " & TID = $TID\" > " .
echo "< a href = \"./schichtplan.php?action=engelshiftdel&SID=" . $ _GET [ " SID " ] . " & TID = $TID\" > " .
"freie " . TID2Type($TID) . Get_Text("inc_schicht_Engel") . "schicht loeschen< / a > < br / > \n";
"freie " . TID2Type($TID) . Get_Text("inc_schicht_Engel") . "schicht loeschen< / a > < br / > \n";
@ -175,8 +165,7 @@ case 'change':
"< th > freeloader :-(< / th > " .
"< th > freeloader :-(< / th > " .
"< / tr > ";
"< / tr > ";
for ($j=0; $j < $rowcount; $j++)
for ($j = 0; $j < $rowcount; $j++) {
{
$userUID = mysql_result($Erg3, $j, "UID");
$userUID = mysql_result($Erg3, $j, "UID");
echo "\t< tr > \n";
echo "\t< tr > \n";
echo "\t\t< td > " . UID2Nick($userUID) . "< / td > \n";
echo "\t\t< td > " . UID2Nick($userUID) . "< / td > \n";
@ -196,16 +185,14 @@ case 'change':
// Listet alle Nicks auf
// Listet alle Nicks auf
echo "< select name = \"UIDs\" > \n";
echo "< select name = \"UIDs\" > \n";
if( $FromPentabarf != "Y")
if ($FromPentabarf != "Y") {
{
echo "\t< option value = \"0\" > --neu--< / option > \n";
echo "\t< option value = \"0\" > --neu--< / option > \n";
}
}
$usql = "SELECT * FROM `User` ORDER BY `Nick`";
$usql = "SELECT * FROM `User` ORDER BY `Nick`";
$uErg = mysql_query($usql, $con);
$uErg = mysql_query($usql, $con);
$urowcount = mysql_num_rows($uErg);
$urowcount = mysql_num_rows($uErg);
for ($k=0; $k< $urowcount; $k++)
for ($k = 0; $k < $urowcount; $k++) {
{
echo "\t< option value = \"" . mysql_result ( $ uErg , $ k , " UID " ) . " \ " > " .
echo "\t< option value = \"" . mysql_result ( $ uErg , $ k , " UID " ) . " \ " > " .
mysql_result($uErg, $k, "Nick") .
mysql_result($uErg, $k, "Nick") .
"< / option > \n";
"< / option > \n";
@ -214,23 +201,21 @@ case 'change':
echo " als \n";
echo " als \n";
// holt eine liste der benö tigten Engel zu dieser Schischt
// holt eine liste der ben<65> tigten Engel zu dieser Schischt
$sql3 = "SELECT Count(`TID`) AS `CTID`, `TID` FROM `ShiftEntry` ";
$sql3 = "SELECT Count(`TID`) AS `CTID`, `TID` FROM `ShiftEntry` ";
$sql3 .= "WHERE (`SID`='" . $_GET["SID"] . "' AND `UID`='0') ";
$sql3 .= "WHERE (`SID`='" . $_GET["SID"] . "' AND `UID`='0') ";
$sql3 .= "GROUP BY `SID`, `TID`, `UID` ";
$sql3 .= "GROUP BY `SID`, `TID`, `UID` ";
$Erg3 = mysql_query($sql3, $con);
$Erg3 = mysql_query($sql3, $con);
$i = -1;
$i = -1;
while( ++$i < mysql_num_rows ( $ Erg3 ) )
while (++ $i < mysql_num_rows ( $ Erg3 ) ) {
{
$EngelNeed[mysql_result($Erg3, $i, "TID")] = mysql_result($Erg3, $i, "CTID");
$EngelNeed[mysql_result($Erg3, $i, "TID")] = mysql_result($Erg3, $i, "CTID");
}
}
// Gibt dei möglich Engeltypen aus und zeigt wíefiel noch beö tigt werden
// Gibt dei m<> glich Engeltypen aus und zeigt w<> efiel noch be<62> tigt werden
echo "< select name = \"TID\" > \n";
echo "< select name = \"TID\" > \n";
$SQL2 = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`";
$SQL2 = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`";
$Erg2 = mysql_query($SQL2, $con);
$Erg2 = mysql_query($SQL2, $con);
for ($l = 0; $l < mysql_num_rows ( $ Erg2 ) ; $ l + + )
for ($l = 0; $l < mysql_num_rows ( $ Erg2 ) ; $ l + + ) {
{
$EngelTID = mysql_result($Erg2, $l, "TID");
$EngelTID = mysql_result($Erg2, $l, "TID");
echo "< option value = \"$EngelTID\" > ";
echo "< option value = \"$EngelTID\" > ";
echo mysql_result($Erg2, $l, "Name") . Get_Text("inc_schicht_engel");
echo mysql_result($Erg2, $l, "Name") . Get_Text("inc_schicht_engel");
@ -252,21 +237,17 @@ case 'change':
break;
break;
case 'engeladd' :
case 'engeladd' :
if( $_GET["UIDs"]>0)
if ($_GET["UIDs"] > 0) {
{
$SQL = "SELECT * FROM `ShiftEntry` " .
$SQL = "SELECT * FROM `ShiftEntry` " .
"WHERE (`SID`='" . $_GET["SID"] . "' AND `TID`='" . $_GET["TID"] . "' AND `UID`='0')";
"WHERE (`SID`='" . $_GET["SID"] . "' AND `TID`='" . $_GET["TID"] . "' AND `UID`='0')";
$ERG = mysql_query($SQL, $con);
$ERG = mysql_query($SQL, $con);
if( mysql_num_rows($ERG) != 0 )
if (mysql_num_rows($ERG) != 0) {
{
$chSQL = "UPDATE `ShiftEntry` SET " .
$chSQL = "UPDATE `ShiftEntry` SET " .
"`UID`='" . $_GET["UIDs"] . "', `Comment`='shift added by " . $_SESSION['Nick'] . "' " .
"`UID`='" . $_GET["UIDs"] . "', `Comment`='shift added by " . $_SESSION['Nick'] . "' " .
"WHERE (`SID`='" . $_GET["SID"] . "' AND " .
"WHERE (`SID`='" . $_GET["SID"] . "' AND " .
"`TID`='" . $_GET["TID"] . "' AND `UID`='0' ) LIMIT 1";
"`TID`='" . $_GET["TID"] . "' AND `UID`='0' ) LIMIT 1";
}
} else {
else
{
$chSQL = "INSERT INTO `ShiftEntry` (`SID`, `TID`, `UID`, `Comment`) VALUES (" .
$chSQL = "INSERT INTO `ShiftEntry` (`SID`, `TID`, `UID`, `Comment`) VALUES (" .
"'" . $_GET["SID"] . "', '" . $_GET["TID"] . "', " .
"'" . $_GET["SID"] . "', '" . $_GET["TID"] . "', " .
"'" . $_GET["UIDs"] . "', 'shift added by " . $_SESSION['Nick'] . "')";
"'" . $_GET["UIDs"] . "', 'shift added by " . $_SESSION['Nick'] . "')";
@ -274,24 +255,18 @@ case 'engeladd':
echo "Es wird folgende Schicht zusä tzlich eingetragen:< br / > \n";
echo "Es wird folgende Schicht zusä tzlich eingetragen:< br / > \n";
echo "Engel: " . UID2Nick($_GET["UIDs"]) . "< br / > \n";
echo "Engel: " . UID2Nick($_GET["UIDs"]) . "< br / > \n";
echo "Bemerkung: Schicht eingetragen durch Erzengel " . $_SESSION['Nick'] . "< br / > \n< br / > \n";
echo "Bemerkung: Schicht eingetragen durch Erzengel " . $_SESSION['Nick'] . "< br / > \n< br / > \n";
}
} else {
else
{
echo "Es wird folgende Schicht wurde " . $_GET["eAnzahlNew"] . "x zusä tzlich eingetragen:< br / > \n";
echo "Es wird folgende Schicht wurde " . $_GET["eAnzahlNew"] . "x zusä tzlich eingetragen:< br / > \n";
for( $i=0; $i< $_GET["eAnzahlNew"]; $i++)
for ($i = 0; $i < $_GET["eAnzahlNew"]; $i++) {
{
echo "$i. < br / > \n";
echo "$i. < br / > \n";
$SQL = "INSERT INTO `ShiftEntry` (`SID`, `TID`, `UID`, `Comment`) VALUES (";
$SQL = "INSERT INTO `ShiftEntry` (`SID`, `TID`, `UID`, `Comment`) VALUES (";
$SQL .= "'" . $_GET["SID"] . "', '" . $_GET["TID"] . "', '0', NULL)";
$SQL .= "'" . $_GET["SID"] . "', '" . $_GET["TID"] . "', '0', NULL)";
$ERG = mysql_query($SQL, $con);
$ERG = mysql_query($SQL, $con);
if ($debug)
if ($debug)
echo "DEBUG SQL: $SQL< br / > \n";
echo "DEBUG SQL: $SQL< br / > \n";
if ($ERG == 1)
if ($ERG == 1) {
{
echo "Ä nderung wurde gesichert...< br / > ";
echo "Ä nderung wurde gesichert...< br / > ";
}
} else {
else
{
echo "Fehler beim speichern... bitte noch ein mal probieren :)< br / > ";
echo "Fehler beim speichern... bitte noch ein mal probieren :)< br / > ";
echo mysql_error($con);
echo mysql_error($con);
}
}
@ -303,19 +278,16 @@ case 'engeladd':
case 'engeldel' :
case 'engeldel' :
$chSQL = "UPDATE `ShiftEntry` SET `UID`='0', `Comment`= 'NULL' WHERE (`SID`='" . $_GET["SID"] .
$chSQL = "UPDATE `ShiftEntry` SET `UID`='0', `Comment`= 'NULL' WHERE (`SID`='" . $_GET["SID"] .
"' AND `UID`='" . $_GET["UIDs"] . "') LIMIT 1";
"' AND `UID`='" . $_GET["UIDs"] . "') LIMIT 1";
if( isset($_GET["freeloader"]) & & $_GET["freeloader"]==1)
if (isset ($_GET["freeloader"]) & & $_GET["freeloader"] == 1) {
{
$sql = "SELECT * FROM `Shifts` WHERE (`SID` = '" . $_GET["SID"] . "' )";
$sql = "SELECT * FROM `Shifts` WHERE (`SID` = '" . $_GET["SID"] . "' )";
$Erg = mysql_query($sql, $con);
$Erg = mysql_query($sql, $con);
if( mysql_num_rows( $Erg) == 1)
if (mysql_num_rows($Erg) == 1) {
{
$UID = $_GET["UIDs"];
$UID = $_GET["UIDs"];
$Length = mysql_result($Erg, 0, "Len");
$Length = mysql_result($Erg, 0, "Len");
$Comment = "Start: " . mysql_result($Erg, 0, "DateS") . "; " .
$Comment = "Start: " . mysql_result($Erg, 0, "DateS") . "; " .
"Beschreibung: " . mysql_result($Erg, 0, "Man") . "; " .
"Beschreibung: " . mysql_result($Erg, 0, "Man") . "; " .
"Removed by " . $_SESSION['Nick'];
"Removed by " . $_SESSION['Nick'];
$ch2SQL =
$ch2SQL = "INSERT INTO `ShiftFreeloader` (`Remove_Time`, `UID`, `Length`, `Comment`) " .
"INSERT INTO `ShiftFreeloader` (`Remove_Time`, `UID`, `Length`, `Comment`) ".
"VALUES ( CURRENT_TIMESTAMP, '$UID', '$Length', '$Comment');";
"VALUES ( CURRENT_TIMESTAMP, '$UID', '$Length', '$Comment');";
}
}
}
}
@ -349,12 +321,11 @@ case 'delete':
case 'deleteShifs' :
case 'deleteShifs' :
foreach ($_GET as $k => $v)
foreach ($_GET as $k => $v)
if( strpos( " ".$k, "SID") == 1)
if (strpos(" " . $k, "SID") == 1) {
{
echo "Shifts $v wird gel<65> scht...";
echo "Shifts $v wird gelöscht...";
executeSQL("DELETE FROM `Shifts` WHERE `SID`='$v' LIMIT 1");
executeSQL("DELETE FROM `Shifts` WHERE `SID`='$v' LIMIT 1");
echo "< br / > \n";
echo "< br / > \n";
echo "ShiftEntry $v wird gelö scht...";
echo "ShiftEntry $v wird gel<65> scht...";
executeSQL("DELETE FROM `ShiftEntry` WHERE `SID`='$v'");
executeSQL("DELETE FROM `ShiftEntry` WHERE `SID`='$v'");
echo "< br / > < br / > \n";
echo "< br / > < br / > \n";
}
}
@ -368,21 +339,18 @@ if (IsSet($chSQL)){
$Erg = mysql_query($chSQL, $con);
$Erg = mysql_query($chSQL, $con);
if ($debug)
if ($debug)
echo "DEBUG SQL: $chSQL< br / > \n";
echo "DEBUG SQL: $chSQL< br / > \n";
if ($Erg == 1)
if ($Erg == 1) {
{
echo "Ä nderung wurde gesichert...< br / > ";
echo "Ä nderung wurde gesichert...< br / > ";
if ($debug)
if ($debug)
echo "DEBUG: ergebniss" . $Erg . "< br / > \n";
echo "DEBUG: ergebniss" . $Erg . "< br / > \n";
if (IsSet($ch2SQL))
if (IsSet ($ch2SQL)) {
{
$Erg = mysql_query($ch2SQL, $con);
$Erg = mysql_query($ch2SQL, $con);
if ($debug)
if ($debug)
echo "DEBUG SQL: $ch2SQL< br / > \n";
echo "DEBUG SQL: $ch2SQL< br / > \n";
if( $debug ) echo "DEBUG: ergebniss". $Erg. "< br / > \n";
if ($debug)
}
echo "DEBUG: ergebniss" . $Erg . "< br / > \n";
}
}
else
} else {
{
echo "Fehler beim speichern... bitte noch ein mal probieren :)< br / > ";
echo "Fehler beim speichern... bitte noch ein mal probieren :)< br / > ";
echo mysql_error($con);
echo mysql_error($con);
}
}
@ -390,6 +358,5 @@ if (IsSet($chSQL)){
}
}
include ("includes/footer.php");
include ("../../../camp2011/includes/footer.php");
?>
?>