class_mcFPDF.inc.php
2.33 KB
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
<?php
class mcFPDF extends FPDF {
protected static function setCell(FPDF $param_fpdf, $param_value, $param_x, $param_width, $param_align='L') {
$param_fpdf->SetX($param_x);
if($param_width < 0) {
$param_width = 0;
}
$param_fpdf->Cell($param_width, 7, $param_value, 0, 0, $param_align);
}
public static function tab_setHeadLine(FPDF $param_fpdf, array $param_values, array $param_table_parameter=null, $param_left= 10) {
$param_fpdf->SetFont('Arial', 'B', 8);
self::tab_setLine($param_fpdf, $param_values, $param_table_parameter);
// Linienfarbe auf schwarz einstellen
// $param_fpdf->SetDrawColor(0, 0, 0);
// Linienbreite einstellen, 0.2 mm
// $param_fpdf->SetLineWidth(0.2);
// Linien zeichnen
// $param_fpdf->Line($param_left, $param_fpdf->getY(), 186, $param_fpdf->getY());
// $param_fpdf->Line($param_left, $param_fpdf->getY(), 0, $param_fpdf->getY());
$param_fpdf->ncLine(0.2, array(0, 0, 0));
// $param_fpdf->Line(20, 40, 222, 40);
$param_fpdf->Ln(3);
}
private static function tab_getdefaultTableParameter() {
$table_parameter = array();
$table_parameter['leftPostions'] = array();
foreach($param_values as $tmp) {
$table_parameter['leftPostions'][] = array('pos' => 20, 'align' => 'L');
}
$table_parameter['linesize'] = 5;
return $table_parameter;
}
public static function tab_setLine(FPDF $param_fpdf, array $param_values, array $param_table_parameter=null) {
if(is_null($param_table_parameter)) {
$param_table_parameter = self::tab_getdefaultTableParameter();
}
if(count($param_table_parameter['leftPostions']) == count($param_values)) {
foreach($param_values as $id => $value) {
if(array_key_exists($id+1, $param_table_parameter['leftPostions'])) {
self::setCell($param_fpdf, $value, $param_table_parameter['leftPostions'][$id]['pos'], $param_table_parameter['leftPostions'][$id+1]['pos']-$param_table_parameter['leftPostions'][$id]['pos'], $param_table_parameter['leftPostions'][$id]['align']);
} else {
// echo $param_fpdf->lMargin.' | '.$param_fpdf->rMargin.'<br/>';
self::setCell($param_fpdf, $value, $param_table_parameter['leftPostions'][$id]['pos'], $param_fpdf->rMargin-$param_table_parameter['leftPostions'][$id]['pos'], $param_table_parameter['leftPostions'][$id]['align']);
}
}
}
$param_fpdf->Ln($param_table_parameter['linesize']);
}
}
?>