<?php
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
require("./FCKeditor/fckeditor.php") ;

$user_admin=$_COOKIE["user_admin"];
$jahrgang=$_COOKIE["jahrgang"];
$hs=$_COOKIE["ck_hs"];


if ($jahrgang == ""){ require("jahrgang.php"); exit;} //Wenn man kein Jahrgang ausgew&auml;hlt hat wird die Jahrgangsauswahlseite geladen

// Rechte&uuml;berpr&uuml;fung
$db = dbconnect();
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
$result = $db->query("SELECT 1 FROM stan_admin_rechte, stan_admin_rechte_zuord , stan_admin where stan_admin_rechte.stan_admin_rolle = stan_admin_rechte_zuord.stan_admin_rolle AND stan_admin_rechte_zuord.said = stan_admin.said AND stan_admin.user = '$user_admin' AND stan_admin_rechte_zuord.stan_admin_rolle = 'a_standort'");
$row = $result->fetch_array();
if ($row[0] != 1){ include("kurs/rechte.php"); exit;}
// Rechte&uuml;berpr&uuml;fung ende



if (isset($_GET['action']))
   $action = $_GET['action'];
else
   $action = "";

switch($action){
default:

$db = dbconnect();
include("kurs/sta/stan_soadmonline_write.php");     // F&uuml;r Statistik, wieviele User online sind

echo "

<html>
<head>
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<style type=\"text/css\">
select{
	width:328px;
}



	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:320px;	/* Width of box */
		height:200px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #6487DC;	/* Dark blue border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-family		:	verdana, arial;
		z-index:10000;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;
		padding:1px;
		cursor:pointer;
		font-size:0.9em;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */

	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#D6DFF7;
		color:#002276;
		font-family		:	verdana, arial;
		font-weight		:	bold;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:500;
	}
</style>

<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<title>Ausnahmeregelung</title>
</head>
<body onload=\"if(document.beleg)document.beleg.stud.focus();return false;\">
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"60%\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">Standort erfassen</font><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></font></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>
                    <form action="; echo $_SERVER['PHP_SELF'] . "?action=bearb2"; echo" method=\"POST\" name=\"beleg\">
                      <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"102%\" id=\"AutoNumber1\" height=\"18\">
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Standortname*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"standortname\" name=\"standortname\" value=\"\" size=\"50\">
                          </td>
                        </tr>
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Block*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<select name=\"block\">
				  <option value='1'>1</option>
				  <option value='2'>2</option>
				  <option value='3'>3</option>
                                </select>
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Ab Datum*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"datumab\" name=\"datumab\" value=\"\" size=\"50\">
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Vertiefungsbereich*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>";
			    $db = dbconnect();
			    $query = "SELECT vbid, bezeichnung
			                FROM stan_vertiefungsbereich
			               ORDER BY bezeichnung";
			    $result = $db->query ($query)
			       or die ("Cannot execute query");
			    echo "<select size=\"5\" name=\"vbid\">";
			    while ($row = $result->fetch_array()){
			          echo "<option value=\"".$row['vbid']."\">$row[bezeichnung]</option>\n";
			    }
			    echo "</select>";
			    echo"
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Pendler*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<select name=\"pendler\">
				  <option value='P'>Pendler</option>
				  <option value='V'>Verbleiber</option>
				  <option value='PV'>Pendler oder Verbleiber</option>
                                </select>
                          </td>
                        </tr>
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Max. Teilnehmer*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"maxteil\" name=\"maxteil\" value=\"\" size=\"50\">
                          </td>
                        </tr>
                      </table>
                    <br>
                    <p align = \"center\">*=Pflichtfelder<br><br><input type=\"submit\" value=\"Abschicken\" name=\"B1\"></p>
                    </form>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>
<br>
<br>
<br>

<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>AG Standorte</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\"id=\"table2\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"95%\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">AG Standorte</font>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></font></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>
                      <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\" height=\"18\">
                        <tr>
                          <td width=\"5%\">
                          <b>Nr</b>
                          </td>
                          <td width=\"55%\" align=\"left\">
                           <b>Standortbezeichnung</b>
                          </td>
                          <td width=\"20%\" align=\"left\">
                           <b>Vertiefungsbereich</b>
                          </td>
                          <td width=\"10%\" align=\"center\">
                           <b>Löschen</b>
                          </td>
                          <td width=\"10%\" align=\"center\">
                           <b>Bearbeiten</b>
                          </td>
                        </tr>";
                          $db = dbconnect();
                        $ln_zaehler = 1; // Z&auml;hler f&uuml;r Anzahl der Termine
                        
                        
                         $query = "SELECT a.agsid, standort, a.sid, block, abdatum, pendler, bezeichnung
                                     FROM stan_ag_standort a, stan_standort b, stan_vertiefungsbereich c
                                    WHERE a.sid=b.sid
                                      AND a.vbid=c.vbid
                                      AND a.jahr='$jahrgang'
                                     ORDER BY block ASC, abdatum ASC";

                          $result = $db->query ($query)
                                    or die ("Cannot execute query");
                         

                        while ($row = $result->fetch_array()){
                        
                          

                        echo"
                        <tr>
                          <td width=\"5%\">
                          <b>$ln_zaehler</b>
                          </td>
                          <td width=\"55%\">
                          $row[standort] (Block $row[block]) ab $row[abdatum] ($row[pendler])
                          </td>
                          <td width=\"20%\">
                          $row[bezeichnung]
                          </td>
                          <td width=\"10%\" align=\"center\">";
                          $result_tg = $db->query("SELECT count(*) Anz 
                                                      FROM stan_ag_standort_termine
                                                     WHERE fagsid='$row[agsid]'");
                          $row_tg = $result_tg->fetch_array();
                          if($row_tg[Anz] > 0){
                            echo "<img title = \"Termine bereits erfasset\"border=\"0\" src=\"../images/drop_grey.png\">";
                          }else{
                           echo"<a href=".$_SERVER['PHP_SELF'] ."?action=del&agsid=$row[agsid]&sid=$row[sid]>
                           <img title = \"Standort löschen\"border=\"0\" src=\"../images/drop.png\"></a>";                         
                          }

                           
                           
                           
                           echo"
                          </td>
                          <td width=\"10%\" align=\"center\">
                          <a href=".$_SERVER['PHP_SELF'] ."?action=edit&agsid=$row[agsid]&sid=$row[sid]>
                           <img title = \"Standort bearbeiten\"border=\"0\" src=\"../images/edit.png\"></a>
                          </td>
                        </tr>";
                        $ln_zaehler = $ln_zaehler+1;
                       }
                       echo"
                      </table>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>

";


break;
case "bearb2":

$standortname = $_POST[standortname];
$block = $_POST[block];
$datumab = $_POST[datumab];
$vbid = $_POST[vbid];
$pendler = $_POST[pendler];
$maxteil = $_POST[maxteil];


#setcookie("ck_beg_std","");


if($standortname == '' OR $block == '' OR $datumab == '' OR $vbid == '' OR $pendler == '' OR $pendler == ''){
  echo "
  <html>
  <head>
  <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
  <link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
  <title>Falsches Datum</title>
  </head>
  <body>
  <table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Pflichtfelder ausfüllen</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Bitte füllen Sie alle Pflichtfelder aus!</p></b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>
  </body>
  </html>";
  exit;
}


#echo "INSERT INTO stan_standort (standort, block, abdatum, pendler,maxteil) VALUES ('$standortname', '$block', '$datumab', '$pendler', '$maxteil')<br>
#INSERT INTO stan_ag_standort (sid, jahr, vbid) VALUES ('$sid', '$jahrgang', '$vbid')";
#exit;
  $sql = $db->query ("INSERT INTO stan_standort (standort, block, abdatum, pendler,maxteil) VALUES ('$standortname', '$block', '$datumab', '$pendler', '$maxteil')");
  $sid = $db->insert_id;
  $sql = $db->query ("INSERT INTO stan_ag_standort (sid, jahr, vbid) VALUES ('$sid', '$jahrgang', '$vbid')");

  echo "<meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF'] ."?action=default\">";

break;
case "del":


$agsid=$_GET['agsid'];
$sid=$_GET['sid'];


$db = dbconnect();
$sql = $db->query ("DELETE FROM stan_ag_standort WHERE agsid='$agsid'");
$sql = $db->query ("DELETE FROM stan_standort WHERE sid='$sid'");
if ($sql)  // Best&auml;tigungsseite bei Erfolg sonst Nichterfolgsmeldung
  {
    echo "
      <meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF'] ."?action=bearb&erfassen=$VerID\">
    ";
  }else{
    echo "
    <html>
    <head>
    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
    <link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
    <title>unerwarteter Fehler</title>
    </head>
    <body>
    <table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
      <tr>
          <td>
          <div align=\"center\">
              <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                  <tr>
                      <td width=\"10\" background=\"../images/box_e1.gif\">
                      <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                      <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                      <td width=\"95%\" background=\"../images/box_top.gif\">
                      <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                      <span class=\"sh\">unerwarteter Fehler</span><br>
                      <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                      <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                      <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                  </tr>
                  <tr>
                      <td width=\"1%\" background=\"../images/box_l.gif\">
                      <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                      <td colspan=\"2\"><br>
                      <p align=\"center\"><b>Es ist ein interner Fehler aufgetreten!</b>
                      </p>
                      <p align=\"center\"><a href=\"hauptframe_jahr.php\">
                      <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                      </p>
                      <p></p>
                      <p></p>
                      <p></p>
                      <p></p>
                      <p><br>
                      </p>
                      </td>
                      <td width=\"1%\" background=\"../images/box_r.gif\">
                      <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                  </tr>
                  <tr>
                      <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                      <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                      <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                      <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                      <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                      <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                  </tr>
              </table>
          </div>
          </td>
      </tr>
    </table>
    </body>
    </html>";
  }
break;
case "edit":
$sid = $_GET['sid'];

setcookie("ck_sid_ed","");
setcookie("ck_sid_ed","$sid");

$result_ed = $db->query("SELECT standort, block, abdatum, pendler, maxteil FROM stan_standort WHERE sid = '$sid'");
$row_ed = $result_ed->fetch_array();

$result_ed1 = $db->query("SELECT vbid FROM stan_ag_standort WHERE sid = '$sid'");
$row_ed1 = $result_ed1->fetch_array();


echo "

<html>
<head>
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<style type=\"text/css\">
select{
	width:328px;
}



	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:320px;	/* Width of box */
		height:200px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #6487DC;	/* Dark blue border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-family		:	verdana, arial;
		z-index:10000;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;
		padding:1px;
		cursor:pointer;
		font-size:0.9em;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */

	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#D6DFF7;
		color:#002276;
		font-family		:	verdana, arial;
		font-weight		:	bold;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:500;
	}
</style>

<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<title>Ausnahmeregelung</title>
</head>
<body onload=\"if(document.beleg)document.beleg.stud.focus();return false;\">
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"60%\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">Standort bearbeiten</font><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></font></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>
                    <form action="; echo $_SERVER['PHP_SELF'] . "?action=edit2"; echo" method=\"POST\" name=\"beleg\">
                      <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"102%\" id=\"AutoNumber1\" height=\"18\">
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Standortname*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"standortname\" name=\"standortname\" value=\"$row_ed[standort]\" size=\"50\">
                          </td>
                        </tr>
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Block*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<select name=\"block\">
				  <option value='1'"; if($row_ed['block'] ==1){echo " selected ";} echo">1</option>
				  <option value='2'"; if($row_ed['block'] ==2){echo " selected ";} echo">2</option>
				  <option value='3'"; if($row_ed['block'] ==3){echo " selected ";} echo">3</option>
                                </select>
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Ab Datum*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"datumab\" name=\"datumab\" value=\"$row_ed[abdatum]\" size=\"50\">
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Vertiefungsbereich*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>";
			    $db = dbconnect();
			    $query = "SELECT vbid, bezeichnung
			                FROM stan_vertiefungsbereich
			               ORDER BY bezeichnung";
			    $result = $db->query ($query)
			       or die ("Cannot execute query");
			    echo "<select size=\"5\" name=\"vbid\">";
			    while ($row = $result->fetch_array()){
			          echo "<option value=\"".$row[vbid]."\"";if($row_ed1[vbid] == $row[vbid]){ echo " selected ";} echo">$row[bezeichnung]</option>\n";
			    }
			    echo "</select>";
			    
			    echo"
                          </td>
                        </tr>
                        
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Pendler*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<select name=\"pendler\">
				  <option value='P'"; if($row_ed['pendler'] == 'P'){ echo " selected";} echo">Pendler</option>
				  <option value='V'"; if($row_ed['pendler'] == 'V'){ echo " selected";} echo">Verbleiber</option>
				  <option value='PV'"; if($row_ed['pendler'] == 'PV'){ echo " selected";} echo">Pendler oder Verbleiber</option>
                                </select>
                          </td>
                        </tr>
                        <tr>
                          <td width='30%' style='border-style: none; border-width: medium' height='0'>
                            <b>Max. Teilnehmer*:</b>
                          </td>
                          <td width='70%' style='border-style: none; border-width: medium' height='0'>
				<input type=\"text\" id=\"maxteil\" name=\"maxteil\" value=\"$row_ed[maxteil]\" size=\"50\">
                          </td>
                        </tr>
                      </table>
                    <br>
                    <p align = \"center\">*=Pflichtfelder<br><br><input type=\"submit\" value=\"Abschicken\" name=\"B1\"></p>
                    </form>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
break;
case "edit2":

$sid=$_COOKIE["ck_sid_ed"];
$standortname = $_POST[standortname];
$block = $_POST[block];
$datumab = $_POST[datumab];
$vbid = $_POST[vbid];
$pendler = $_POST[pendler];
$maxteil = $_POST[maxteil];


#setcookie("ck_beg_std","");


if($standortname == '' OR $block == '' OR $datumab == '' OR $vbid == '' OR $pendler == '' OR $pendler == ''){
  echo "
  <html>
  <head>
  <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
  <link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
  <title>Falsches Datum</title>
  </head>
  <body>
  <table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Pflichtfelder ausfüllen</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Bitte füllen Sie alle Pflichtfelder aus!</p></b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
  </table>
  </body>
  </html>";
  exit;
}



  $sql = $db->query ("UPDATE stan_standort
                          SET standort = '$standortname'
                             ,block = '$block'
                             ,abdatum = '$datumab'
                             ,pendler = '$pendler'
                             ,maxteil = '$maxteil'
                        WHERE sid = '$sid'");
  $sql = $db->query ("UPDATE stan_ag_standort 
                          SET vbid = '$vbid'
                         WHERE sid = '$sid'");

  echo "<meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF'] ."?action=default\">";

} //Ende Action Abfrage
?>
