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_vber'");
$row = $result->fetch_array();
if ($row[0] != 1){ include("kurs/rechte.php"); exit;}
// Rechteüberprüfung ende
if(isset($_POST['filter'])){
$filter = $_POST['filter'];
}else{
$filter = "alle";
}
$db = dbconnect();
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
switch($action){
default:
echo "
Jahrgangsstatus
Name
|
Matrikelnr.
|
AG
|
Vertiefungsbereich
|
Block
|
Datum
|
";
if($filter == 'filter_wird'){
$query = "SELECT t2.vorname
,t2.nachname
,t2.hs
,t2.ag
,t2.mtknr
,t1.saaid
, t1.vert_bereich
, t1.uid
, date_format(t1.beginn, '%d.%m.%Y') beginn
, date_format(t1.ende, '%d.%m.%Y') ende
,t1.beginn beginn_order
, t1.dst_id
, t1.zuweisung
FROM stan_antrag t1, stud t2, stan_dienststellen_tmp t3
WHERE t1.status = ( SELECT MAX(t2.status)
FROM stan_antrag t2
WHERE t1.aendid = t2.aendid
AND t2.status !='2'
)
AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
AND t1.uid=t2.uid
AND t1.dst_id=t3.dst_id
AND t2.jahrgang = '$jahrgang'
AND t2.hs ='$hs'
AND t2.durchgefallen != 'Y'
AND (upper(t3.bez) LIKE '%WIRD %'
OR upper(t3.bez) LIKE '%OFFEN %'
OR upper(t3.bez) LIKE '%NACHTRAG %'
OR upper(t3.bez) LIKE ''
)
ORDER BY nachname, vorname, beginn_order";
}else{
$query = "SELECT t2.vorname
,t2.nachname
,t2.hs
,t2.ag
,t2.mtknr
,t1.saaid
, t1.vert_bereich
, t1.uid
, date_format(t1.beginn, '%d.%m.%Y') beginn
, date_format(t1.ende, '%d.%m.%Y') ende
,t1.beginn beginn_order
, t1.dst_id
, t1.zuweisung
FROM stan_antrag t1, stud t2
WHERE t1.status = ( SELECT MAX(t2.status)
FROM stan_antrag t2
WHERE t1.aendid = t2.aendid
AND t2.status !='2'
)
AND (t1.zuweisung is NULL OR t1.zuweisung='Z')
AND t1.uid=t2.uid
AND t2.jahrgang = '$jahrgang'
AND t2.hs ='$hs'
AND t2.durchgefallen != 'Y'
ORDER BY nachname, vorname, beginn_order";
}
$result = $db->query($query)
or die ("Cannot execute query1");
while ($row = $result->fetch_array()){
$result5 = $db->query("SELECT concat(bezeichnung, ' ',name) name, ort
FROM stan_dienststellen
WHERE dst_id ='$row[dst_id]'");
$row5 = $result5->fetch_array();
$result6 = $db->query("SELECT bez, ort
FROM stan_dienststellen_tmp
WHERE dst_id ='$row[dst_id]'");
$row6 = $result6->fetch_array();
if($row5['name'] != '' and $row6['bez'] == ''){
$bezeichnung = $row5['name'];
$ort = $row5['ort'];
}
if($row5['name'] == '' and $row6['bez'] != ''){
$bezeichnung = $row6['bez'];
$ort = $row6['ort'];
}
if($row5['name'] == '' and $row6['bez'] == ''){
$bezeichnung = 'Zeitraum vorgemerkt';
$ort = '';
}
if($ort!=''){
$bez_neu= "$bezeichnung in $ort";
}else{
$bez_neu= "$bezeichnung";
}
$block = get_block($row['saaid'], $jahrgang);
$result_zuw0 = $db->query("SELECT 1,wagsid
FROM stan_ag_standort_wunsch
WHERE block ='$block'
AND uid= '$row[uid]'
AND prio='0'");
$row_zuw0 = $result_zuw0->fetch_array();
$result_zuw1 = $db->query("SELECT 1,wagsid
FROM stan_ag_standort_wunsch
WHERE block ='$block'
AND uid= '$row[uid]'
AND prio='1'");
$row_zuw1 = $result_zuw1->fetch_array();
$result_zuw2 = $db->query("SELECT 1,wagsid
FROM stan_ag_standort_wunsch
WHERE block ='$block'
AND uid= '$row[uid]'
AND prio='2'");
$row_zuw2 = $result_zuw2->fetch_array();
if($row_zuw0[0] == '' AND $row_zuw1[0] == ''){
$status='Nicht erfasst';
# $zuw_sperre='X';
# $zuw_alle_sperre='X';
}
if($row_zuw0[0] == '' AND $row_zuw1[0] == '1'){
$result_standort1 = $db->query("SELECT agsid, a.sid, standort, block, abdatum, pendler, c.bezeichnung
FROM stan_ag_standort a, stan_standort b, stan_vertiefungsbereich c
WHERE a.sid=b.sid
AND a.vbid = c.vbid
AND a.agsid ='$row_zuw1[wagsid]'");
$row_s1 = $result_standort1->fetch_array();
$result_standort2 = $db->query("SELECT agsid, a.sid, standort, block, abdatum, pendler, c.bezeichnung
FROM stan_ag_standort a, stan_standort b, stan_vertiefungsbereich c
WHERE a.sid=b.sid
AND a.vbid = c.vbid
AND a.agsid ='$row_zuw2[wagsid]'");
$row_s2 = $result_standort2->fetch_array();
if($row_zuw1[wagsid] == '8888'){
$standort1="Stelle außerhalb BWs";
}else{
$standort1="$row_s1[standort] (Block $row_s1[block]) ab $row_s1[abdatum] ($row_s1[pendler]) ($row_s1[bezeichnung])";
}
if($row_zuw2[wagsid] == '9999'){
$standort2="Stelle außerhalb BWs";
}else{
$standort2="$row_s2[standort] (Block $row_s2[block]) ab $row_s2[abdatum] ($row_s2[pendler]) ($row_s2[bezeichnung])";
}
if($row_zuw2[wagsid] == '9999' OR $row_zuw2[wagsid] == '8888'){
$titel = "Nicht zugewiesen:";
$text = "Priorität 1: $standort1
Priorität 2: $standort2";
}else{
$titel = "Nicht zugewiesen:";
$text = "Priorität 1: $standort1
Priorität 2: $standort2";
}
$status="$titel
$text";
#Wenn Student nicht dem Standort zugewiesen ist, dann darf man nicht zuweisen
# Entfällt für Jahrgang 2008, da in den Zuweisungsschreiben der AG-Standort nicht mitausgegeben wird
# $zuw_sperre='X';
# $zuw_alle_sperre='X';
}
if($row_zuw0[0] == '1' AND $row_zuw1[0] == '1'){
$result_standort0 = $db->query("SELECT agsid, a.sid, standort, block, abdatum, pendler, c.bezeichnung
FROM stan_ag_standort a, stan_standort b, stan_vertiefungsbereich c
WHERE a.sid=b.sid
AND a.vbid = c.vbid
AND a.agsid ='$row_zuw0[wagsid]'");
$row_s0 = $result_standort0->fetch_array();
$status="$row_s0[standort] (Block $row_s0[block]) ab $row_s0[abdatum] ($row_s0[pendler]) ($row_s0[bezeichnung])";
}
$result3art = $db->query("SELECT artid, bezeichnung
FROM stan_antrag a, stan_stellenart b
WHERE a.art= b.artid
AND saaid='$row[saaid]'");
$row3art = $result3art->fetch_array();
# 6 = Ausland
# 7 = Anderes Bundesland
# Wenn Stelle außerhalb BW bzw Ausland, darf kein Standort zugeweisen sein
if (($row3art['artid'] == 6 OR $row3art['artid'] == 7) and ($row_zuw1['wagsid'] != '8888' or $row_zuw2['wagsid'] != '9999') and $status != 'Nicht erfasst'){
$hinweis2 = "Stelle darf keine AG-Zuweisung haben";
}
$resultvert = $db->query("SELECT bezeichnung
FROM stan_vertiefungsbereich
WHERE vbid ='$row[vert_bereich]'");
$rowvert = $resultvert->fetch_array();
echo"
$row[nachname], $row[vorname]
|
$row[mtknr]
|
$row[ag]
|
$rowvert[bezeichnung]
|
$block
|
$row[beginn] - $row[ende]
|
";
$hinweis="";
$hinweis2="";
}
echo"
";
} // Ende Action script
?>