gruppen loeschen eingebaut

git-svn-id: svn://svn.cccv.de/engel-system@54 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
cookie 2005-11-15 21:18:06 +00:00
parent 8b145da913
commit a515546b5a
1 changed files with 56 additions and 5 deletions

View File

@ -5,14 +5,33 @@ $submenus = 1;
include ("./inc/header.php"); include ("./inc/header.php");
include ("./inc/funktion_user.php"); include ("./inc/funktion_user.php");
function executeSQL( $SQL)
{
global $DEBUG, $con;
$Erg = mysql_query($SQL, $con);
if( $DEBUG )
echo "DEBUG SQL: $SQL<br>\n";
if ($Erg == 1)
{
echo "SQL war erfolgreich";
}
else
{
echo "SQL Fehler (". mysql_error($con).")" ;
}
}
if (!IsSet($_GET["action"])) { if (!IsSet($_GET["action"])) {
echo "Hallo ".$_SESSION['Nick'].",<br>\n"; echo "Hallo ".$_SESSION['Nick'].",<br>\n";
echo "hier kannst du Schichten anlegen, &auml;ndern oder l&ouml;schen.<br><br>"; echo "hier kannst du Schichten anlegen, &auml;ndern oder l&ouml;schen.<br><br>";
echo "<a href=\"./shiftadd.php\">Neue Schicht einplanen</a><br><br>\n\n"; echo "<a href=\"./shiftadd.php\">Neue Schicht einplanen</a><br><br>\n\n";
echo "<form action=\"".$_SERVER['SCRIPT_NAME']."\" method=\"GET\" >\n";
?> ?>
<table width="100%" class="border" cellpadding="2" cellspacing="1"> <table width="100%" class="border" cellpadding="2" cellspacing="1">
<tr class="contenttopic"> <tr class="contenttopic">
<td></td>
<td>Datum</td> <td>Datum</td>
<td>Raum</td> <td>Raum</td>
<td>Dauer</td> <td>Dauer</td>
@ -27,6 +46,8 @@ $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"). "\" ".
"value=\"". mysql_result($Erg, $i, "SID"). "\"></td>\n";
echo "\t\t<td>".mysql_result($Erg, $i, "DateS")."</td>\n"; echo "\t\t<td>".mysql_result($Erg, $i, "DateS")."</td>\n";
$sql2= "SELECT `Name` FROM `Room` WHERE `RID`=\"".mysql_result($Erg, $i, "RID")."\""; $sql2= "SELECT `Name` FROM `Room` WHERE `RID`=\"".mysql_result($Erg, $i, "RID")."\"";
@ -40,7 +61,11 @@ for( $i = 0; $i < $rowcount; $i++)
mysql_result($Erg, $i, "SID")."\">####</a></td>\n"; mysql_result($Erg, $i, "SID")."\">####</a></td>\n";
echo "\t</tr>\n"; echo "\t</tr>\n";
} }
echo "</table>"; echo "</table>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"deleteShifs\">\n";
echo "<input type=\"submit\" value=\"L&ouml;schen...\">\n";
echo "</form>\n";
} else { } else {
@ -51,7 +76,8 @@ 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
@ -89,6 +115,12 @@ case 'change':
echo " <tr><td>Beschreibung</td>". echo " <tr><td>Beschreibung</td>".
"<td><input value=\"". mysql_result($Erg, 0, "Man"). "<td><input value=\"". mysql_result($Erg, 0, "Man").
"\" type=\"text\" size=\"40\" name=\"eName\"></td></tr>\n"; "\" type=\"text\" size=\"40\" name=\"eName\"></td></tr>\n";
echo " <tr><td>FromPentabarf</td>".
"<td><input value=\"". mysql_result($Erg, 0, "FromPentabarf").
"\" type=\"text\" size=\"40\" name=\"eFromPentabarf\"></td></tr>\n";
echo " <tr><td>URL</td>".
"<td><input value=\"". mysql_result($Erg, 0, "URL").
"\" type=\"text\" size=\"40\" name=\"eURL\"></td></tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "<input type=\"hidden\" name=\"SID\" value=\"". $_GET["SID"]. "\">\n"; echo "<input type=\"hidden\" name=\"SID\" value=\"". $_GET["SID"]. "\">\n";
@ -244,9 +276,15 @@ case 'changesave':
$query = mysql_query("SELECT DATE_ADD('". $_GET["eDate"]. "', INTERVAL '+0 ". $_GET["eDauer"]. "' DAY_HOUR)", $con); $query = mysql_query("SELECT DATE_ADD('". $_GET["eDate"]. "', INTERVAL '+0 ". $_GET["eDauer"]. "' DAY_HOUR)", $con);
$enddate = mysql_fetch_row($query); $enddate = mysql_fetch_row($query);
$chSQL = "UPDATE `Shifts` SET `DateS`='". $_GET["eDate"]. "', `DateE`='".$enddate[0]. $chSQL = "UPDATE `Shifts` SET ".
"', `RID`='". $_GET["eRID"]. "', `Len`='". $_GET["eDauer"]. "', ". "`DateS`='". $_GET["eDate"]. "', ".
"`Man`='". $_GET["eName"]. "' WHERE `SID`=". $_GET["SID"]; "`DateE`='".$enddate[0]. "', ".
"`RID`='". $_GET["eRID"]. "', ".
"`Len`='". $_GET["eDauer"]. "', ".
"`Man`='". $_GET["eName"]. "', ".
"`FromPentabarf`='". $_GET["eFromPentabarf"]. "', ".
"`URL`='". $_GET["eURL"]. "' ".
"WHERE `SID`=". $_GET["SID"];
SetHeaderGo2Back(); SetHeaderGo2Back();
break; break;
@ -256,6 +294,19 @@ case 'delete':
SetHeaderGo2Back(); SetHeaderGo2Back();
break; break;
case 'deleteShifs':
foreach ($_GET as $k => $v)
if( strpos( " ".$k, "SID") == 1)
{
echo "Shifts $v wird gelöscht...";
executeSQL( "DELETE FROM `Shifts` WHERE `SID`=$v LIMIT 1");
echo "<br>\n";
echo "ShiftEntry $v wird gelöscht...";
executeSQL( "DELETE FROM `ShiftEntry` WHERE `SID`= $v");
echo "<br><br>\n";
}
break;
} // end switch } // end switch
if (IsSet($chSQL)){ if (IsSet($chSQL)){