307 lines
14 KiB
PHP
Executable File
307 lines
14 KiB
PHP
Executable File
<?php
|
|
$user_admin=$_COOKIE["user_admin"];
|
|
$jahrgang=$_COOKIE["jahrgang"];
|
|
# Änderungen für März Jahrgänge
|
|
$semester=$_COOKIE["semester"];
|
|
if($semester == 30){
|
|
$sem_klartext = 'Frühjahr';
|
|
}else{
|
|
$sem_klartext = 'Herbst';
|
|
}
|
|
|
|
if ($jahrgang == ""){ require("jahrgang.php"); exit;} //Wenn man kein Jahrgang ausgewählt hat wird die Jahrgangsauswahlseite geladen
|
|
include("kurs/datenbankanbindung.php"); // fü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 spt_admin_rechte, spt_admin_rechte_zuord , spt_admin where spt_admin_rechte.spt_admin_rolle = spt_admin_rechte_zuord.spt_admin_rolle AND spt_admin_rechte_zuord.faid = spt_admin.faid AND spt_admin.user = '$user_admin' AND spt_admin_rechte_zuord.spt_admin_rolle = 'a_prsbesch'");
|
|
$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\">
|
|
</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\">Bescheinigung verschicken - $sem_klartext JG $jahrgang</font>
|
|
<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=ausgabe"; echo" method=\"POST\" name=\"PSN_bearb\">
|
|
<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" ausgabe=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\">
|
|
<tr>";
|
|
|
|
|
|
if ( $res=$db->query("SELECT COUNT(distinct a.uid)
|
|
FROM spt_wunsch a, stud b
|
|
WHERE a.uid=.b.uid
|
|
AND jahrgang='$jahrgang'
|
|
and b.durchgefallen!='Y'") ){
|
|
if ( $row1=$res->fetch_array() ) {
|
|
$result_ist=$row1[0];
|
|
} else $result_ist=0;
|
|
} else $result_ist=0;
|
|
|
|
if ( $res2=$db->query("SELECT COUNT(*)
|
|
FROM spt_mail a, stud b
|
|
WHERE a.uid=b.uid
|
|
and b.durchgefallen!='Y'
|
|
and b.jahrgang='$jahrgang'") ){
|
|
if ( $row2=$res2->fetch_array() ) {
|
|
$result_neu=$row2[0];
|
|
} else $result_neu=0;
|
|
} else $result_neu=0;
|
|
#echo $result_ist.'-'.$result_neu;
|
|
$offen=$result_ist-$result_neu;
|
|
|
|
echo "
|
|
<td width=\"5%\" 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\">
|
|
<br><p align='center'>
|
|
Hier können Sie die Bescheinigungen des Jahrgangs $jahrgang an die Studenten per Mail verschicken.<br>
|
|
Mails werden nur einmal verschickt. Sie können die Seite beliebig oft öffnen, um eine Übersicht zu erhalten.<br>
|
|
<br>
|
|
<b>Nicht verschickte Bescheinigungen: $offen</b>
|
|
</td>
|
|
|
|
</tr>";
|
|
|
|
echo "
|
|
</table>
|
|
<br>
|
|
<p align='center'><input type=\"submit\" value=\"Bescheinigung verschicken / anzeigen\" 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 "ausgabe":
|
|
|
|
|
|
$db = dbconnect();
|
|
|
|
$result_abs = $db->query("SELECT wert1, wert2 FROM parameter WHERE pid=2");
|
|
$row_abs = $result_abs->fetch_array();
|
|
|
|
|
|
$abfrage = "SELECT distinct a.uid, vorname, nachname, ag, jahrgang, mail
|
|
FROM stud a, spt_wunsch b
|
|
WHERE a.uid = b.uid
|
|
AND a.durchgefallen!='Y'
|
|
AND a.jahrgang='$jahrgang'
|
|
AND a.hs='L'
|
|
";
|
|
$result = $db->query($abfrage); //
|
|
|
|
$betreff = 'Bescheinigung Schwerpunktthemen';
|
|
$sender = $row_abs['wert1'];
|
|
$sendermail = $row_abs['wert2'];
|
|
$headers = "MIME-Version: 1.0\n";
|
|
$headers .= "Content-type: text/html; charset=utf-8\n";
|
|
$headers .= "From: Hochschule Ludwigsburg <$sendermail>\n";
|
|
$tbl_data = '';
|
|
|
|
|
|
while ($row = $result->fetch_array()){
|
|
$result_versendet = $db->query("SELECT count(*) Anz
|
|
FROM spt_mail
|
|
WHERE uid='$row[uid]'");
|
|
$row_versendet = $result_versendet->fetch_array();
|
|
|
|
|
|
if($row_versendet['Anz']>= 1){
|
|
# Wenn Mail bereits versendet wurde, dann Gesendetdatum herausfinden...
|
|
$result_senddat = $db->query("SELECT date_format(datum, '%d.%m.%Y %H:%i') datum, date_format(stud_runtergeladen, '%d.%m.%Y %H:%i') stud_runtergeladen, unique_id
|
|
FROM spt_mail
|
|
WHERE uid='$row[uid]'");
|
|
$row_senddat = $result_senddat->fetch_array();
|
|
$datum = $row_senddat['datum'];
|
|
if($row_senddat['stud_runtergeladen'] == '00.00.0000 00:00'){
|
|
$download_dat = '';
|
|
}else{
|
|
$download_dat = $row_senddat['stud_runtergeladen'];
|
|
}
|
|
|
|
}else{
|
|
#, sonst senden und in mailqueue eintragen
|
|
|
|
$uniqid = md5(uniqid(rand(), TRUE));
|
|
|
|
$empfaenger = $row['mail'];
|
|
$headers .= "Bcc: $empfaenger\n";
|
|
|
|
$text = "
|
|
<html>
|
|
<head>
|
|
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
|
|
<title>Mailversand</title>
|
|
</head>
|
|
<body>
|
|
Sehr geehrte/r $row[vorname] $row[nachname],
|
|
<br>
|
|
<br>
|
|
für Ihre Schwerpunktthemen steht Ihnen die Bescheinigung zum Downlaod bereit.
|
|
<br>
|
|
Bitte drucken Sie Datei für für Ihre Unterlagen aus: <br>
|
|
<br>
|
|
<a href='https://www.hs-ludwigsburg.de/kurs/schwerpunktthemen/stud/bescheinigung/seminarscheine.php?id=$uniqid'>Bescheinigung drucken (hier klicken)</a>
|
|
<br>
|
|
<br>
|
|
Diese Mail wurde automatisch erzeugt. Bitte antworten Sie nicht auf die Mail.
|
|
<br>
|
|
<br>
|
|
Mit freundlichen Grüßen<br>
|
|
Elfriede Fuchs
|
|
";
|
|
$return = @mail(NULL, $betreff, $text, $headers);
|
|
if($return){
|
|
$datum_db = date("Y-m-d H:i:s",time());
|
|
$sql = $db->query ("INSERT INTO spt_mail (uid, datum, unique_id) VALUES ('$row[uid]', '$datum_db', '$uniqid')");
|
|
$datum = date("d.m.Y H:i",time());
|
|
}else{
|
|
$datum = 'Fehler';
|
|
}
|
|
}
|
|
if(isset($row_senddat['unique_id'])){
|
|
$uniid = $row_senddat['unique_id'];
|
|
}else{
|
|
$uniid = $uniqid;
|
|
}
|
|
$tbl_data .="
|
|
<tr>
|
|
</td>
|
|
<td width=\"40%\" 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[vorname] $row[nachname]
|
|
</td>
|
|
<td align='right' valign=\"middle\" width=\"27%\" 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\">
|
|
$datum
|
|
</td>
|
|
<td width=\"27%\" 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='right' style=\"margin-top: 4; margin-bottom: 4\">
|
|
$download_dat
|
|
</td>
|
|
<td width=\"6%\" 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='right' style=\"margin-top: 4; margin-bottom: 4\">
|
|
<a target='_top' href='../stud/bescheinigung/seminarscheine.php?id=$uniid&down=1'><img src=\"../images/ico_pdf.gif\" border=\"0\"></a>
|
|
</td>
|
|
</tr>";
|
|
|
|
} #Ende While
|
|
|
|
|
|
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>Übersicht über die Schwerpunktthemen des Studienjahrgangs $stud_jahr[Jahrgang]</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 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\">Übersicht über die Schwerpunktthemen des Studienjahrgangs $jahrgang</font><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>
|
|
|
|
<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\" id=\"AutoNumber1\">
|
|
<td width=\"40%\">
|
|
<b>Name</b>
|
|
</td>
|
|
<td width=\"27%\" align='right'>
|
|
<b>Versanddatum</b>
|
|
</td>
|
|
<td width=\"27%\" align='right'>
|
|
<b>Bescheinigung durch<br>Student runtergeladen</b>
|
|
</td>
|
|
<td width=\"6%\" align='right'>
|
|
<b>PDF</b>
|
|
</td>
|
|
</tr>
|
|
$tbl_data
|
|
</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>";
|
|
|
|
} //Ende Action Abfrage
|
|
?>
|