Browse code

Update

Benjamin Roth authored on20/03/2023 16:19:16
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,124 @@
1
+<?php
2
+
3
+/**
4
+ * viabook platform for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2012-2014 eSalesMedia
7
+ *
8
+ * @package    eSM_viabook
9
+ * @link       http://www.esales-media.de
10
+ * @license    commercial
11
+ *
12
+ * @author     Benjamin Roth <benjamin@esales-media.de>
13
+ */
14
+
15
+
16
+/**
17
+ * Namespace
18
+ */
19
+namespace eSM_isotope_custom\Pdf;
20
+use eSM_isotope_custom\Pdf\ESMPDF;
21
+
22
+/**
23
+ * Class DocumentOffer
24
+ *
25
+ * Generates pdf documents
26
+ * @copyright  eSales Media 2014
27
+ * @author     Benjamin Roth <benjamin@esales-media.de> 
28
+ * @package    eSM_viabook
29
+ * @property ESMPDF $pdf
30
+ */
31
+class ExpertisePdf extends Document
32
+{
33
+
34
+	/**
35
+	 * Document filename
36
+	 * @var string
37
+	 */
38
+	public $documentFilename;
39
+
40
+	/**
41
+	 * User Object
42
+	 * @var \FrontendUser object|null
43
+	 */
44
+	protected $User = null;
45
+
46
+	/**
47
+	 * Document directory
48
+	 * @var string
49
+	 */
50
+	public $documentDir;
51
+
52
+	public function __construct($strTcpdfClass = '\eSM_isotope_custom\Pdf\ESMPDF')
53
+	{
54
+		parent::__construct($strTcpdfClass);
55
+
56
+		if (FE_USER_LOGGED_IN)
57
+		{
58
+			$this->User = \FrontendUser::getInstance();
59
+		}
60
+
61
+		$this->init();
62
+	}
63
+
64
+	function __call($name, $arguments)
65
+	{
66
+		return call_user_func_array(array($this->objPdf,$name),$arguments);
67
+	}
68
+
69
+	/**
70
+	 * @param string $name
71
+	 * @return mixed|null|void
72
+	 */
73
+	function __get($name)
74
+	{
75
+		if ($name == 'pdf')
76
+		{
77
+			return $this->pdf();
78
+		}
79
+	}
80
+
81
+
82
+	protected function init()
83
+	{
84
+		// Add pdf object reference
85
+		$PDF = &$this->objPdf;
86
+
87
+		// Remove default header/footer
88
+    $beUserLoggedIn = false;
89
+    /*if(sha1(session_id().(!\Config::get('disableIpCheck') ? \Environment::get('ip') : '').'BE_USER_AUTH') == \Input::cookie('BE_USER_AUTH'))
90
+    {
91
+      $beUserLoggedIn = true;
92
+    }*/
93
+    if (!$beUserLoggedIn)
94
+		{
95
+			$PDF->setPrintHeader(true);
96
+			$PDF->setPrintFooter(true);
97
+		}
98
+
99
+		// Initialize document and add a page
100
+		$PDF->AddPage();
101
+
102
+		// Set font
103
+		$PDF->setCellHeightRatio(1.5);
104
+		$PDF->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA,'','false');
105
+		$PDF->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN,'','false');
106
+	}
107
+
108
+	public function generate()
109
+	{
110
+		// Add pdf object reference
111
+		$PDF = &$this->objPdf;
112
+
113
+		// Close and output PDF document
114
+		$PDF->lastPage();
115
+		if ($this->documentDir)
116
+		{
117
+			$PDF->Output($this->documentDir.'/'.$this->documentFilename, 'F');
118
+		}
119
+
120
+		$PDF->Output($this->documentFilename, 'I');
121
+//		$PDF->Output($this->documentFilename, 'D');
122
+	}
123
+
124
+}
0 125
\ No newline at end of file