schwerpunktthemen/stud/detailansicht.php
2023-02-27 11:44:33 +01:00

79 lines
2.8 KiB
PHP
Executable File

<?php
include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
if ($_COOKIE["uid1"] == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
require_once '../htmlpurifier-4.10.0/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$id = $_GET['id'];
$db = dbconnect();
$res = $db->query("SELECT FPRNr, Bezeichnung, Ansprechpart, TN_min, TN_max, Jahr, beschreibung, termine, bemerkung
FROM spt_kurs
WHERE id='$id'");
$row = $res->fetch_array();
$termine = $row['termine'];
$header = "<table width='607' border='0' cellpadding='0' cellspacing='0' border ='1' style='background-color:#CCCCCC;'>
<tr>
<td align='center' width='607'>
Schwerpunktthema $row[FPRNr] - $row[Bezeichnung]
</td>
</tr>
</table>
<br>
<table width='607' border='0' cellpadding='0' cellspacing='0' border ='0'>
<tr>
<td width='150'>
Ansprechpartner:
</td>
<td width='457'>
$row[Ansprechpart]
</td>
</tr>
<tr>
<td width='150'>
Termine:
</td>
<td width='457'>
$termine
</td>
</tr>
</table>
";
$beschreibung = str_replace (array("<ul>", chr(10)), array("</div><div align='justify'><ul type='square'>",""), $row['beschreibung']);
$beschreibung = str_replace (array("<ul>", chr(10), "<ol>"), array("</div><div align='justify'><ul type='square'>","", "</div><div align='justify'><ol>"), $beschreibung);
$beschreibung = str_replace (array("&auml;", "&Auml;", "&uuml;", "&Uuml;", "&ouml;", "&Ouml;", "&szlig;")
, array("ä", "Ä", "ü", "Ü", "ö", "Ö", "ß")
, $beschreibung
);
# Span muss entfernt werden, da sonst font-family:Times kommt, die Schrift findet html2pdf nicht.
$beschreibung = preg_replace("(</?span[^>]*\>)i", "", $beschreibung);
$beschreibung = $purifier->purify($beschreibung);
require_once('../html2pdf_v4.03/html2pdf.class.php');
$inhalt_fin = '<page backtop="0mm" backbottom="10mm" style="font-size: 11pt" style="font-family: freeserif">'.nl2br($inhalt_fin).'</page>';
try
{
// seitenränder (in mm)
$oben=15; //mT
$unten=15; //mB
$links=15; //mL
$rechts=15; //mR
$html2pdf = new HTML2PDF('P', 'A4', 'de', true, 'UTF-8', array($links, $oben, $rechts, $unten));
$html2pdf->pdf->SetDisplayMode('real');
$html2pdf->writeHTML($header.$beschreibung, isset($_GET['vuehtml']));
$html2pdf->Output("spt_$row[FPRNr].pdf",'D');
}
catch(HTML2PDF_exception $e) {
echo $e;
}
?>