<?php include("kurs/datenbankanbindung.php"); // fügt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php $user_admin=$_COOKIE["user_admin"]; $jahrgang=$_COOKIE["jahrgang"]; $hs=$_COOKIE["ck_hs"]; // Rechteüberprü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_vertbe'"); $row = $result->fetch_array(); if ($row[0] != 1){ include("kurs/rechte.php"); exit;} // Rechteüberprüfung ende if (isset($_GET['action'])) $action = $_GET['action']; else $action = ""; switch($action){ default: 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>Terminverwaltung</title> </head> <body onload=\"if(document.ver_erf)document.ver_erf.beg_tag.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 wählen</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=ubersicht"; echo" method=\"POST\" name=\"ver_erf\"> <p align='center'>"; $db = dbconnect(); if($jahrgang < 10){ $query1 = "SELECT a.sid, standort FROM stan_standort a, stan_ag_standort b WHERE a.sid=b.sid AND b.jahr = '$jahrgang' ORDER BY standort ASC "; }else{ $query1 = "SELECT a.sid, standort, block, abdatum, pendler FROM stan_standort a, stan_ag_standort b WHERE a.sid=b.sid AND b.jahr = '$jahrgang' ORDER BY standort ASC "; } $result1 = $db->query ($query1) or die ("Cannot execute query"); echo "<select size=\"10\" name=\"standort\">"; if($jahrgang < 10){ while ($row1 = $result1->fetch_array()){ echo "<option value='$row1[sid]'>$row1[standort]</option>\n"; } }else{ while ($row1 = $result1->fetch_array()){ echo "<option value='$row1[sid]'>$row1[standort] ($row1[block]) ab $row1[abdatum] ($row1[pendler])</option>\n"; } } echo"</select> <br> <p align = \"center\"><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 "ubersicht": $standort="$_POST[standort]"; setcookie("ck_sid",""); setcookie("ck_sid",$standort); $db = dbconnect(); $result_so = $db->query ("SELECT standort FROM stan_standort WHERE sid = '$standort'"); $row_so = $result_so->fetch_array(); 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>Terminverwaltung</title> </head> <body onload=\"if(document.ver_erf)document.ver_erf.beg_tag.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\">Angebotene Vertiefungsbereiche für den Jahrgang $jahrgang</font><br> <font class=\"sh\">Standort: $row_so[standort]</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=\"ver_erf\"> <p align='center'>"; $db = dbconnect(); $query1 = "SELECT vbid, bezeichnung FROM stan_vertiefungsbereich ORDER BY bezeichnung ASC "; $result1 = $db->query ($query1) or die ("Cannot execute query"); echo "<select class='select_form' size=\"6\" name=\"vert\"> <option value='x' selected>Bitte wählen Sie einen Vertiefungsbereich </option>"; while ($row1 = $result1->fetch_array()){ echo "<option value='$row1[vbid]'";if($row1[vbid] == $vert1){echo " selected ";} echo">$row1[bezeichnung] </option>\n"; } echo"</select> <br> <p align = \"center\"><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>Erfasste Termine</title> </head> <body onload=\"if(document.ver_erf)document.ver_erf.beg_tag.focus();return false;\"> <table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\"id=\"table2\"> <tr> <td> <div align=\"center\"> <table cellspacing=\"0\" cellpadding=\"0\" width=\"80%\" 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\">Erfasste Vertiefungsbereiche</font><br> <font class=\"sh\">Standort: $row_so[standort]</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> <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=\"5%\"> <b>Nr</b> </td> <td width=\"80%\"> <b>Bezeichnung</b> </td> <td width=\"15%\" align=\"center\"> <b>Löschen</b> </td> </tr>"; $db = dbconnect(); $query = "SELECT a.agsid, b.bezeichnung FROM stan_ag_standort a, stan_vertiefungsbereich b WHERE a.vbid = b.vbid AND a.jahr = '$jahrgang' AND a.sid = '$standort'"; $result = $db->query ($query) or die ("Cannot execute query"); $ln_zaehler = 1; // Zähler für Anzahl der Vert.bereiche while ($row = $result->fetch_array()){ echo" <tr> <td width=\"5%\" align='center'> $ln_zaehler </td> <td width=\"80%\"> $row[bezeichnung] </td> <td width=\"15%\" align=\"center\"> <a href=".$_SERVER['PHP_SELF'] ."?action=del&ID=$row[agsid]> <img title = \"Vertiefungsbereich löschen\"border=\"0\" src=\"../images/drop.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": $vertbereich = "$_POST[vert]"; $standort=$_COOKIE["ck_sid"]; $db = dbconnect(); if($vertbereich != 'x'){ $result = $db->query ("SELECT 1 FROM stan_ag_standort WHERE jahr = '$jahrgang' AND sid = '$standort' AND vbid = '$vertbereich'"); $row = $result->fetch_array(); if($row[0] == '1'){ 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>Fehlgeschlagen</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\">Fehlgeschlagen</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>Der Vertiefungsbereich ist für den Jahrgang bereits erfasst!</b> <br><br> <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><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; } // Ende wenn Vertiefungsbereich schon vorhanden $sql = "INSERT INTO stan_ag_standort (sid, jahr, vbid) VALUES ($standort,'$jahrgang','$vertbereich') "; $sql = $db->query($sql); echo"<meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF'] ."?action=default\">"; } // Ende wenn Vertiefungsbereich ausgewählt break; case "del": $agsid=$_GET['ID']; $db = dbconnect(); $result = $db->query ("SELECT count(*) Anz FROM stan_ag_standort_termine WHERE fagsid = '$agsid'"); $row = $result->fetch_array(); if($row[Anz] == 0){ $sql = $db->query ("DELETE FROM stan_ag_standort WHERE agsid=$agsid"); echo "<meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF'] ."?action=default\">"; }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>Erfasste Termine</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\">Erfasste Termine</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 wurden bereits Termine zu diesem Vertiefungsbereich erfasst.<br>Löschen Sie diese zuerst. <p align=\"center\"><a href=".$_SERVER['PHP_SELF'] ."?action=default\"> <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>"; } } //Ende Action Abfrage ?>