stellenantrag_neu/admin/#puzuweisung.php
2022-11-28 09:17:05 +01:00

424 lines
24 KiB
PHP
Executable File

<?php
$user_admin=$_COOKIE["user_admin"];
$jahrgang=$_COOKIE["jahrgang"];
if ($jahrgang == ""){ require("jahrgang.php"); exit;} //Wenn man kein Jahrgang ausgew&auml;hlt hat wird die Jahrgangsauswahlseite geladen
include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
// 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_puzuw'");
$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:
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>Priorit&auml;ten bearbeiten</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=\"100%\" border=\"0\">
<tr>
<td align=\"left\" width=\"1%\" width=\"10\" background=\"../images/box_e1.gif\">
<img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
<td align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\" colspan=\"2\">
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
<font class=\"hd\">PU Priorit&auml;ten bearbeiten</font><br>
<img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
<td 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\">
<form action="; echo $_SERVER['PHP_SELF'] . "?action=bearbeiten"; echo" method=\"POST\" name=\"Wpf_bearb\">
<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\">
<tr>
<td align='left' width=\"64%\"style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Bezeichnung</b>
</td>
<td width=\"24%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Teilnehmer (Ist)</b>
</td>
<td width=\"12%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Auswahl</b>
</td>
</tr>";
$db = dbconnect();
$query = "SELECT a.pusoid, a.bezeichnung
FROM stan_pu_standorte a
WHERE a.jahrgang='$jahrgang'
ORDER BY a.bezeichnung";
$result = $db->query($query)
or die ("Cannot execute query");
while ($row = $result->fetch_array()){
$result1 = $db->query("SELECT count(*) anzahl
FROM stan_pu_wunsch a, stud b
WHERE a.uid = b.uid
AND b.jahrgang = '$jahrgang'
AND a.ort = '$row[pusoid]'
AND a.prioritaet = '0'
");
$row1 = $result1->fetch_array();
echo "
<tr>
<td width=\"64%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<p align=\"left\">$row[bezeichnung]</p>
</td>
<td width=\"24%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<p align=\"center\">$row1[anzahl]</p>
</td>
<td width=\"12%\" align=\"center\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<p>
<input type=\"radio\" value=\"$row[pusoid]\" name=\"aus_bearb\" size=\"20\">
</td>
</tr>";
}
echo "
</table>
<br>
<input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\"></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\" 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 "bearbeiten":
$db = dbconnect();
$sel_pu = $db->query("SELECT bezeichnung FROM stan_pu_standorte WHERE pusoid=\"". $_POST['aus_bearb']."\"");
$bez_pu = $sel_pu->fetch_array();
setcookie("ck_bearbeiten",$_POST['aus_bearb']);
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>PU Priorit&auml;ten bearbeiten</title>
<style type='text/css'>
select{
width:200px;
}
</style>
</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=\"100%\" border=\"0\">
<tr>
<td align=\"left\" width=\"1%\" width=\"10\" background=\"../images/box_e1.gif\">
<img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
<td align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\" colspan=\"2\">
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
<font class=\"hd\">Zuordnung der Studenten zu den PU-Standorten</font><br>
<span class=\"sh\">Standort: $bez_pu[bezeichnung]</span>
<td 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\">
<form action="; echo $_SERVER['PHP_SELF'] . "?action=bearbeiten2"; echo" method=\"POST\" name=\"PU_bearb\">
<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\">
<tr>
<td width=\"30%\" rowspan=\"2\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Name</b>
</td>
<td width=\"18%\" align=right rowspan=\"2\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<p align=\"center\"><b>Verschieben</b></p>
</td>
<td width=\"18%\" align=center rowspan=\"2\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Prio. 1</b></td>
<td width=\"18%\" align=center rowspan=\"2\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Prio. 2</b></td>
<td width=\"16%\" align=center colspan=\"4\" style=\"border-style: none; border-width: medium\">
<b>Anz. Alternativen</b></td>
</tr>
<tr>
<td width=\"8%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Prio. 1</b></td>
<td width=\"8%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<b>Prio. 2</b></td>
</tr>";
$db = dbconnect();
$result = $db->query("SELECT stud.uid, vorname, nachname, ag, jahrgang, ort, prioritaet
FROM stan_pu_wunsch, stud
WHERE ort='$_POST[aus_bearb]'
AND prioritaet='0'
AND stan_pu_wunsch.uid = stud.uid
AND stud.durchgefallen != 'Y'
AND stud.jahrgang = '$jahrgang'
ORDER BY stud.uid");
while ($row = $result->fetch_array()){
echo "
<td width=\"30%\" valign=\"middle\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
$row[nachname], $row[vorname]&nbsp;&nbsp;&nbsp;($row[ag]/$row[jahrgang])
</td>
<td width=\"18%\" align='left' valign=\"middle\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
<select size=1 name=$row[uid]>";
$db = dbconnect();
$result0 = $db->query("SELECT a.pusoid, bezeichnung
FROM stan_pu_standorte a, stan_pu_wunsch b
WHERE a.pusoid = b.ort
AND b.uid = '$row[uid]'
AND b.prioritaet = '0'");
$row0 = $result0->fetch_array();
$result1 = $db->query("SELECT a.pusoid, bezeichnung
FROM stan_pu_standorte a, stan_pu_wunsch b
WHERE a.pusoid = b.ort
AND b.uid = '$row[uid]'
AND b.prioritaet = '1'");
$row1 = $result1->fetch_array();
$result2 = $db->query("SELECT a.pusoid, bezeichnung
FROM stan_pu_standorte a, stan_pu_wunsch b
WHERE a.pusoid = b.ort
AND b.uid = '$row[uid]'
AND b.prioritaet = '2'");
$row2 = $result2->fetch_array();
$query3 = "SELECT a.pusoid, bezeichnung
FROM stan_pu_standorte a
WHERE a.jahrgang = '$jahrgang'";
$result3 = $db->query($query3);
echo"
<option value=$row0[pusoid]>Admin: $row0[bezeichnung]</option>
<option value=$row1[pusoid]>Erstwahl: $row1[bezeichnung]</option>
<option value=$row2[pusoid]>Zweitwahl: $row2[bezeichnung]</option>
";
while ($row3 = $result3->fetch_array()){
echo"<option value=$row3[pusoid]>$row3[bezeichnung]</option>";
}
echo"
</select>
</td>
<td width=\"18%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
$row1[bezeichnung]
</td>
<td width=\"18%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
$row2[bezeichnung]
</td>
<td width=\"8%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">";
$db = dbconnect();
$result1a = $db->query("SELECT count(*) anzahl
FROM stan_pu_wunsch a, stud b
WHERE a.uid = b.uid
AND b.jahrgang = '$jahrgang'
AND a.ort = '$row1[pusoid]'
AND a.prioritaet = '0'");
$row1a = $result1a->fetch_array();
echo "
$row1a[anzahl]
</td>
<td width=\"8%\" align=center style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">";
$db = dbconnect();
$result2a = $db->query("SELECT count(*) anzahl
FROM stan_pu_wunsch a, stud b
WHERE a.uid = b.uid
AND b.jahrgang = '$jahrgang'
AND a.ort = '$row2[pusoid]'
AND a.prioritaet = '0'");
$row2a = $result2a->fetch_array();
echo "
$row2a[anzahl]
</td>
</tr>";
}
echo "
</table>
<br>
<input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\"></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\" 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 "bearbeiten2":
$ck_bearbeiten=$_COOKIE["ck_bearbeiten"];
$db = dbconnect();
$result8 = $db->query("SELECT uid, prioritaet FROM stan_pu_wunsch WHERE ort='$ck_bearbeiten' and prioritaet='0'");
while ($row8 = mysql_fetch_array($result8, MYSQL_NUM)){
$stud="$row8[0]";
$sql = $db->query ("UPDATE stan_pu_wunsch SET ort=\"". $_POST[$stud]."\" WHERE uid='$row8[0]' and prioritaet='0'"); // hier entspricht die uid den namen des Dropdownfeldes in der der neue Ort des PU steht
}
if($sql){
echo "
<meta http-equiv=\"refresh\" content=\"1; URL=puzuweisung.php\">
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Aktualisierung</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\">Aktualisierung</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>Standorte wurde aktualisiert!</b>
</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>
";
}else{
echo "
<meta http-equiv=\"refresh\" content=\"5; URL=puzuweisung.php\">
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Aktualisierung</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\">Aktualisierung</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 trat ein Fehler auf!<br>Keine Aktualisierung</b>
</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 Wenn update fehlgeschlagne
} //Ende Action Abfrage
?>