Subversion Repositories wpShopGermany4

Rev

Rev 5382 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1647 daniel 1
<?php
2
 
3
	/**
4
	 * Template für den PDF Gutschein
5
	 */
6
 
3560 daniel 7
	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
8
	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
9
	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
1647 daniel 10
 
1727 daniel 11
	if ($this->get_option('wpsg_voucherproduct_width') > $this->get_option('wpsg_voucherproduct_height'))
12
	{
13
		$pageMode = 'L';
14
	}
15
	else
16
	{
17
		$pageMode = 'P';
18
	}
19
 
20
	$pdf = new wpsg_fpdf($pageMode, 'mm', array($this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height')));
21
 
1647 daniel 22
	$pdf->SetAutoPageBreak(true, 5);
23
	$pdf->AddPage();
24
 
25
	foreach ($this->view['texte'] as $t)
26
	{
27
 
28
		if ($t['bg'] == '1' && $t['aktiv'] == '1')
29
		{
30
 
5160 daniel 31
			$t['text'] = $this->replaceUniversalPlatzhalter($t['text'], $this->view['order_id'], false, false, $this->view['product_id'], $this->view['customReplace'], $this->view['product_index']);
32
 
1647 daniel 33
			if ($t['alpha'] > 0) $pdf->setAlpha($t['alpha']);
34
 
5382 daniel 35
			$pdf->wpsg_SetTextColor($t['color']);
1647 daniel 36
 
1756 daniel 37
			$pdf->SetFont('Arial', '', $t['fontsize']);
1647 daniel 38
	    	$pdf->RotatedText(
39
		    	$t['x'], $t['y'],
40
		    	$t['text'],
41
		    	$t['angle'],
42
		    	$t['align']
43
		    );
44
 
45
			$pdf->setAlpha(1);
46
 
47
		}
48
 
49
	}
50
 
51
	if (isset($this->view['bp_pdf']) && file_exists($this->view['bp_pdf']))
52
	{
53
 
54
		$pagecount = $pdf->setSourceFile($this->view['bp_pdf']);
55
		$tplidx = $pdf->importPage(1, '/MediaBox');
2780 daniel 56
		$pdf->useTemplate($tplidx, 0, 0, $this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height'));
1647 daniel 57
 
58
	}
59
	else if (isset($this->view['bp_jpg']) && file_exists($this->view['bp_jpg']))
60
	{
2780 daniel 61
		$pdf->image($this->view['bp_jpg'], 0, 0, $this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height'), 'jpg');
1647 daniel 62
	}
63
 
64
	foreach ($this->view['texte'] as $t)
65
	{
66
 
67
		if ($t['aktiv'] == '1')
68
		{
69
 
5160 daniel 70
			$t['text'] = $this->replaceUniversalPlatzhalter($t['text'], $this->view['order_id'], false, false, $this->view['product_id'], $this->view['customReplace'], $this->view['product_index']);
71
 
1647 daniel 72
			if ($t['alpha'] > 0) $pdf->setAlpha($t['alpha']);
73
 
1756 daniel 74
			$pdf->SetFont('Arial', '', $t['fontsize']);
5382 daniel 75
			$pdf->wpsg_SetTextColor($t["color"]);
1647 daniel 76
 
77
	    	$pdf->RotatedText(
78
		    	$t['x'], $t['y'],
79
		    	$t['text'],
80
		    	$t['angle'],
81
		    	$t['align']
82
		    );
83
 
84
			$pdf->setAlpha(1);
85
 
86
		}
87
 
88
	}
6901 daniel 89
 
90
    ob_end_clean();
1647 daniel 91
 
6901 daniel 92
	if ($this->view['preview'] !== true) {
1727 daniel 93
 
94
		$pdf->Output($this->view['filename'], 'F');
1647 daniel 95
 
6901 daniel 96
	} else {
1727 daniel 97
 
98
		$pdf->Output($this->view['filename'], 'I');
6901 daniel 99
 
100
		exit;
101
 
1727 daniel 102
	}
103
 
1647 daniel 104
?>