2023-03-14 08:08:06 +01:00

193 lines
4.9 KiB
PHP
Executable File

<?php
ini_set('memory_limit','128M');
include("../config/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
$output = $_GET['output'];
require('../config.inc.php');
require('as_utf_class.php');
require_once("sitzung_pdf.inc");
define('FPDF_FONTPATH','font/');
require_once("table_def.inc");
class pdf extends fpdf_table
{
//Fusszeile
function Footer()
{
$aend_dat = date("d.m.Y (H:i:s)");
$this->SetY(-10);
$this->SetFont('Arial','I',9);
$this->Cell(0,10,'Generiert: '.$aend_dat,0,0,'C');
}
}
$pdf=new utfFPDF();
// Seitenabstand definieren
$pagecount = $pdf->setSourceFile("idee_blanko.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->SetMargins(24, 40, 20);
$pdf->SetAutoPageBreak(true,21);
$pdf->AcceptPageBreak(true);
$pdf->AddPage();
$pdf->useTemplate($tplidx,0,0,0);
$db = dbconnect();
#$pdf->SetFont('Arial', 'I', 14);
#$pdf->MultiCell(160, 5,"Ideenbriefkasten der Hochschule Ludwigsburg\nVeröffentlichung von Ideen", 0, 'C');
$columns = 4; //five columns
$pdf->SetY(80.8);
//we initialize the table class
$pdf->Table_Init($columns, true, true);
$table_subtype = $table_default_table_type;
$pdf->Set_Table_Type($table_subtype);
//TABLE HEADER SETTINGS
$header_subtype = $table_default_header_type;
for($i=0; $i<$columns; $i++) $header_type[$i] = $table_default_header_type;
$header_type[0]['WIDTH'] = 10;
#$header_type[0]['BG_COLOR'] = array(255,0,0);
$header_type[0]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$header_type[0]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
$header_type[0]['TEXT'] = "ID";
$header_type[1]['WIDTH'] = 70;
#$header_type[1]['BG_COLOR'] = array(0,0,0);
$header_type[1]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$header_type[1]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
$header_type[1]['TEXT'] = "Betreff";
$header_type[2]['WIDTH'] = 65;
#$header_type[2]['BG_COLOR'] = array(0,0,0);
$header_type[2]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$header_type[2]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
$header_type[2]['TEXT'] = "Maßnahmen";
$header_type[3]['WIDTH'] = 30;
#$header_type[3]['BG_COLOR'] = array(0,0,0);
$header_type[3]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$header_type[3]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
$header_type[3]['TEXT'] = "Höhe Prämie";
#$header_type[1]['COLSPAN'] = "2";
//set the header type
$pdf->Set_Header_Type($header_type);
$pdf->Draw_Header();
//TABLE DATA SETTINGS
$data_subtype = $table_default_data_type;
$data_type = Array();//reset the array
for ($i=0; $i<$columns; $i++) $data_type[$i] = $data_subtype;
$pdf->Set_Data_Type($data_type);
# $fsize = 10;
# $colspan = 1;
# $rr = 255;
$db = dbconnect();
$query = "SELECT a.vid, betreff, massnahme, praemie_gutschein
FROM imt_vorschlag a, imt_vorschlag_ende b
WHERE a.vid=b.vid
AND a.public ='Y'
AND b.annahme='J'
ORDER BY b.erfass_dat desc";
$result = $db->query ($query)
or die ("Cannot execute query1");
$seite = 1;
while ($row = $result->fetch_array())
{
if($seite != 1){
$pdf->AddPage();
$pdf->SetAutoPageBreak(true,20);
$seite =$seite+1;
$pdf->SetY(20);
}else{
$seite =$seite+1;
$pdf->SetY(80.8);
}
#$pos=$pdf->GetY()+10;
$betreff = html_entity_decode($row['betreff']);
$massnahme = html_entity_decode($row['massnahme']);
$data[0]['TEXT'] = "$row[vid]";
$data[0]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$data[0]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
if($zaehler == 1){
$data[0]['BG_COLOR'] = array(255,255,255);
}else{
$data[0]['BG_COLOR'] = array(211,223,238);
}
#$data[0]['T_TYPE'] = "BI"; // B=BOLD, I=ITALIC
$data[1]['TEXT'] = "$betreff";
$data[1]['T_ALIGN'] = "L";
$data[1]['V_ALIGN'] = "M";
if($zaehler == 1){
$data[1]['BG_COLOR'] = array(255,255,255);
}else{
$data[1]['BG_COLOR'] = array(211,223,238);
}
$data[2]['TEXT'] = "$massnahme";
$data[2]['T_ALIGN'] = "L";
$data[2]['V_ALIGN'] = "M";
if($zaehler == 1){
$data[2]['BG_COLOR'] = array(255,255,255);
}else{
$data[2]['BG_COLOR'] = array(211,223,238);
}
$data[3]['TEXT'] = "$row[praemie_gutschein],00 ".chr(128);
$data[3]['T_ALIGN'] = "R";
$data[3]['V_ALIGN'] = "M";
if($zaehler == 1){
$data[3]['BG_COLOR'] = array(255,255,255);
}else{
$data[3]['BG_COLOR'] = array(211,223,238);
}
if($zaehler == 1){
$zaehler = 0;
}else{
$zaehler = 1;
}
$pdf->Draw_Data($data);
}
$pdf->Output("veroeffentlichung_ideen.pdf","$output");
$pdf->closeParsers();
?>