-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.php
86 lines (63 loc) · 2.15 KB
/
print.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
include 'assets/lib/fpdf.php';
include 'assets/lib/exfpdf.php';
include 'assets/lib/easyTable.php';
global $wpdb;
function printTable($pdf, $lines, $title) {
$pdf->SetFont('lato','',16);
$rowCounter = $lines;
if($lines >= 8) {
//Two column mode
$tblFmt = '{13, 81.8, 0.3, 13, 81.8}';
$colPerLine = 2;
} else {
//Single column mode
$tblFmt = '{13, 177}';
$colPerLine = 1;
}
$rowCounter /= $colPerLine;
$tblHeight = (20.4 + (8.4*($rowCounter-1)));
if($pdf->getY() + $tblHeight > 272) {
//$pdf->Ln(272 - $pdf->getY());
$pdf->AddPage();
}
$pdf->SetFont('lato','',20);
$pdf->Write(10, $title);
$pdf->Ln();
$table=new easyTable($pdf, $tblFmt, 'width:100%; border: 1; split-row:false;');
for ($i = 1; $i <= $lines; $i+=$colPerLine) {
// $table->easyCell('Text 1', 'rowspan:2; valign:T');
// $table->easyCell('Text 2', 'bgcolor:#b3ccff; rowspan:2');
$table->easyCell($i . ".");
//$table->easyCell($pdf->getY());
$table->easyCell("");
$table->easyCell("", "bgcolor: #000000;");
$table->easyCell($i+1 . ".", "min-width: 700;");
//$table->easyCell($pdf->getY());
$table->easyCell("");
$table->printRow();
}
$table->endTable();
}
$pdf=new exFPDF('P','mm','A4');
$pdf->AddFont('lato','','Lato-Regular.php');
$pdf->AddPage();
$pdf->SetFont('lato','',26);
$pdf->Write(10, 'Herbstferien 2022');
$pdf->SetFont('lato','',16);
$pdf->Ln();
foreach( $wpdb->get_results("SELECT `$termin`.*, `$template`.TITLE FROM `$termin` INNER JOIN `$template` ON `$termin`.`TEMPLATE` = `$template`.`ID` WHERE `$termin`.`DATESTART` >= CURDATE() ORDER BY `$termin`.`DATESTART`") as $key => $row) {
printTable($pdf, $row->MAX_PARTICIPANTS, $row->TITLE);
}
/*printTable($pdf, 40, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");
printTable($pdf, 10, "Wanderritt");*/
//-----------------------------------------
$pdf->Output();
?>