schwerpunktthemen/admin/anwesenheit.php
2023-02-27 11:44:33 +01:00

163 lines
4.7 KiB
PHP
Executable File

<?php
include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
$uid1=$_COOKIE["uid1"];
$id = $_GET['id'];
define('FPDF_FONTPATH','font/');
require('../prints3/as_utf_class.php');
require_once("../prints3/table_def.inc");
$pdf=new utfFPDF();
$pdf->addPage();
$pdf->SetAutoPageBreak(true);
$pos = $pdf->GetY()+4;
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0,0,255);
$pdf->SetY($pos);
$pdf->SetX(21);
$pdf->Cell(0, 3, "Anwesenheitsliste", 0, 0, 'L');
$pos = $pdf->GetY()+4;
$db = dbconnect();
$result_data3 = $db->query("SELECT bezeichnung
FROM spt_kurs
WHERE id =$id");
$rowdata3 = $result_data3->fetch_array();
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetTextColor(0,0,0);
$pdf->SetY($pos);
$pdf->SetX(21);
$pdf->MultiCell(180, 4, "Schwerpunktthema: $rowdata3[bezeichnung]", 0, 'L');
$pos = $pdf->GetY()+8;
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetY($pos);
$pdf->SetX(21);
$pdf->Cell(0, 3, "Datum:__________________________", 0, 0, 'L');
$pos = $pdf->GetY()+10;
$pdf->SetY($pos);
$columns = 4; //five columns
//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'] = 30;
$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'] = "Vorname";
$header_type[1]['WIDTH'] = 30;
$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'] = "Nachname";
$header_type[2]['WIDTH'] = 20;
$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'] = "AG";
$header_type[3]['WIDTH'] = 80;
$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'] = "Unterschrift";
//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 vorname, nachname, ag, jahrgang
FROM spt_wunsch, stud
WHERE id =$id
AND spt_wunsch.uid = stud.uid
AND stud.durchgefallen !='Y'
ORDER BY nachname ASC"; //Nur diesen Datensatz vom aktuellen ausgehend, daher aktuelle saaid
$result = $db->query ($query)
or die ("Cannot execute query1a");
while ($row = $result->fetch_array())
{
$data[0]['TEXT'] = "$row[vorname]";
$data[0]['T_ALIGN'] = "L"; //C=CENTER, L=LEFT, R=RIGHT, J=JUSTIFY
$data[0]['V_ALIGN'] = "M"; //T=TOP, M=MIDDLE, B=BOTTOM
#$data[0]['T_TYPE'] = "BI"; // B=BOLD, I=ITALIC
$data[1]['TEXT'] = "$row[nachname]";
$data[1]['T_ALIGN'] = "L";
$data[1]['V_ALIGN'] = "M";
$data[2]['TEXT'] = "$row[ag]/$row[jahrgang]";
$data[2]['T_ALIGN'] = "L";
$data[2]['V_ALIGN'] = "M";
$data[3]['TEXT'] = "";
$data[3]['T_ALIGN'] = "L";
$data[3]['V_ALIGN'] = "M";
$pos1 = $pdf->GetY();
if($pos1 > 270){
$pdf->addPage();
//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);
}
$pdf->Draw_Data($data,NULL,11); // -->letzter Parameter Höhe der Datenspalte. Neu prgrammiert in prints/class.fpdf_table.php am 15.04.2009
}
$pdf->Output("anwesenheit.pdf","i");
$pdf->closeParsers();
?>