Browse code

Update

Benjamin Roth authored on20/03/2023 16:19:16
Showing31 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,229 @@
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
+
21
+/**
22
+ * Include required tcpdf config files
23
+ */
24
+
25
+require_once(TL_ROOT . '/system/modules/eSM_isotope_custom/config/bb_tcpdf.php');
26
+require_once(TL_ROOT . '/vendor/tecnickcom/tcpdf/tcpdf.php');
27
+
28
+class BBPDF extends \TCPDF {
29
+
30
+    public function Header()
31
+    {
32
+        // Header
33
+        // get the current page break margin
34
+        $bMargin = $this->getBreakMargin();
35
+        // get current auto-page-break mode
36
+        $auto_page_break = $this->getAutoPageBreak();
37
+        // disable auto-page-break
38
+        $this->SetAutoPageBreak(false, 0);
39
+        // set bacground image
40
+        // restore auto-page-break status
41
+        $this->SetAutoPageBreak($auto_page_break, $bMargin);
42
+        $this->SetMargins(0,0,0);
43
+        $this->SetFooterMargin(0);
44
+        $this->Image(TL_ROOT . '/files/base/layout/img/expertise_header.jpg', 15, 10,180,0,'','','T',true,300);
45
+        //$this->Image(TL_ROOT . '/files/themes/affentaler_2017/assets/images/base/affentaler_logo.png', 75, 15,60,0,'PNG','','T',true,300);
46
+        $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
47
+        $this->SetFooterMargin(PDF_MARGIN_FOOTER);
48
+    }
49
+
50
+
51
+    // Page footer
52
+    public function Footer()
53
+    {
54
+        // Footer
55
+        // get the current page break margin
56
+        $bMargin = $this->getBreakMargin();
57
+        // get current auto-page-break mode
58
+        $auto_page_break = $this->getAutoPageBreak();
59
+        // disable auto-page-break
60
+        $this->SetAutoPageBreak(false, 0);
61
+        // set bacground image
62
+        // restore auto-page-break status
63
+        $this->SetAutoPageBreak($auto_page_break, $bMargin);
64
+        $this->SetMargins(0,0,0);
65
+        $this->SetFooterMargin(0);
66
+
67
+
68
+        $this->Rect(15, 277, 180, 10, 'F', array('all'=>array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 1, 'color' => array(35, 52, 75, 13))), array(95,102,106));
69
+
70
+
71
+        $this->SetTextColor(255,255,255);
72
+        $this->SetXY(15, 277);
73
+        $this->CreateCell(180, 10, 'www.baden-badener-weinhaus.de', 0, 15, '', 'C', PDF_FONT_NAME_DATA);
74
+
75
+//        $this->Image(TL_ROOT . '/files/themes/gengenbach_v1/assets/images/pdf/expertise_papier_footer.jpg', 0, 278,210,0,'JPG','','T',true,300);
76
+        $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
77
+        $this->SetFooterMargin(PDF_MARGIN_FOOTER);
78
+    }
79
+
80
+    public function CreateTextBox($textval, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
81
+    {
82
+        $margins = $this->getMargins();
83
+        $this->SetFont($font, $fontstyle, $fontsize);
84
+
85
+        if (!strlen($y))
86
+        {
87
+            $this->SetX($x+$margins['left']);
88
+        } else {
89
+            $this->SetXY($x+$margins['left'], $y);
90
+        }
91
+
92
+        // Start clipping.
93
+        $this->StartTransform();
94
+
95
+        if (!strlen($y))
96
+        {
97
+            $x = $x+$margins['left'];
98
+            $y = $y+$margins['top'];
99
+            $this->SetXY($x, $y);
100
+        } else {
101
+            $x = $x+$margins['left'];
102
+            $this->SetX($x);
103
+        }
104
+
105
+        if (!$height)
106
+        {
107
+            $pdf2 = clone $this;
108
+            $pdf2->setPrintHeader(false);
109
+            $pdf2->setPrintFooter(false);
110
+            $pdf2->AddPage();
111
+            $pdf2->Cell($width, $height, $textval, 0, false, $align);
112
+            $height = $pdf2->GetY();
113
+            unset($pdf2);
114
+        }
115
+
116
+        // Draw clipping rectangle to match cell.
117
+        $this->Rect($x, $y, $width, $height, 'CNZ');
118
+
119
+        $this->Cell($width, $height, $textval, 0, false, $align);
120
+
121
+        // Stop clipping.
122
+        $this->StopTransform();
123
+    }
124
+
125
+    public function lbr($fltNo=1)
126
+    {
127
+        $this->SetY($this->GetY()+(($this->getFontSize()*$this->getCellHeightRatio())*floatval($fltNo)));
128
+    }
129
+
130
+    public function CreateHTMLBox($htmlVal, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
131
+    {
132
+        $margins = $this->getMargins();
133
+        $this->SetFont($font, $fontstyle, $fontsize);
134
+
135
+        // Start clipping.
136
+        $this->StartTransform();
137
+
138
+        if (!strlen($y))
139
+        {
140
+            $x = $x+$margins['left'];
141
+            $y = $y+$margins['top'];
142
+        } else {
143
+            $x = $x+$margins['left'];
144
+        }
145
+
146
+        if (!$height)
147
+        {
148
+            $pdf2 = clone $this;
149
+            $pdf2->setPrintHeader(false);
150
+            $pdf2->setPrintFooter(false);
151
+            $pdf2->AddPage();
152
+            $pdf2->writeHTMLCell($width, $height, 0, 0, $htmlVal, 0, 1, false, true, $align);
153
+            $height = $pdf2->GetY();
154
+            unset($pdf2);
155
+        }
156
+
157
+        // Draw clipping rectangle to match html cell.
158
+        $this->Rect($x, $y, $width, $height, 'CNZ');
159
+
160
+        // Output html.
161
+        $this->writeHTMLCell($width, $height, $x, $y, $htmlVal, 0, 0, false, true, $align);
162
+
163
+        // Stop clipping.
164
+        $this->StopTransform();
165
+    }
166
+
167
+
168
+    public function CreateCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
169
+    {
170
+        $margins = $this->getMargins();
171
+        $currFontsize = $this->getFontSize();
172
+        $currFontfamily = $this->getFontFamily();
173
+        $currFontstyle = $this->getFontStyle();
174
+
175
+        $x = $this->GetX();
176
+        $y = $this->GetY();
177
+
178
+        $this->SetFont($font, $fontstyle, $fontsize);
179
+
180
+        // Start clipping.
181
+        $this->StartTransform();
182
+
183
+        if (!$h)
184
+        {
185
+            $h = ($this->getFontSize()*$this->getCellHeightRatio());
186
+        }
187
+
188
+        // Draw clipping rectangle to match html cell.
189
+        $this->Rect($x, $y, $w, $h, 'CNZ');
190
+
191
+        $this->Cell($w,$h,$txt,0,$ln,$align);
192
+        $this->SetFont($currFontfamily, $currFontstyle, $currFontsize);
193
+
194
+        // Stop clipping.
195
+        $this->StopTransform();
196
+
197
+        if (!$ln)
198
+        {
199
+            $this->SetY($this->GetY());
200
+        }
201
+    }
202
+
203
+    public function CreateMultiCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
204
+    {
205
+        $currFontsize = $this->getFontSize();
206
+        $currFontfamily = $this->getFontFamily();
207
+        $currFontstyle = $this->getFontStyle();
208
+
209
+        $this->SetFont($font, $fontstyle, $fontsize);
210
+
211
+        if (!$h)
212
+        {
213
+            $pdf2 = clone $this;
214
+            $pdf2->setPrintHeader(false);
215
+            $pdf2->setPrintFooter(false);
216
+            $pdf2->AddPage();
217
+            $pdf2->MultiCell($w,$h,$txt,0,$align,false,1,0,0);
218
+            $h = $pdf2->GetY();
219
+            unset($pdf2);
220
+        }
221
+
222
+        $this->MultiCell($w,$h,$txt,0,$align,false,$ln);
223
+        if (!$ln)
224
+        {
225
+            $this->SetY($this->GetY()+$h-($this->getFontSize()*$this->getCellHeightRatio()));
226
+        }
227
+//        $this->SetFont($currFontfamily, $currFontstyle, $currFontsize);
228
+    }
229
+}
0 230
\ No newline at end of file
1 231
new file mode 100644
... ...
@@ -0,0 +1,107 @@
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
+
21
+
22
+/**
23
+ * Class ViabookDocuments
24
+ *
25
+ * Generates pdf documents
26
+ * @copyright  eSales Media 2014
27
+ * @author     Benjamin Roth <benjamin@esales-media.de> 
28
+ * @package    eSM_viabook
29
+ */
30
+abstract class Document extends \Controller
31
+{
32
+
33
+	/**
34
+	 * ESMPDF
35
+	 * @var ESMPDF
36
+	 */
37
+	protected $objPdf;
38
+
39
+	public function __construct($strTcpdfClass='\eSM_isotope_custom\Pdf\ESMPDF')
40
+	{
41
+		parent::__construct();
42
+		if (!class_exists($strTcpdfClass))
43
+		{
44
+			throw new \Exception('Class "'.$strTcpdfClass.'" does not exist');
45
+		}
46
+		$this->objPdf = $this->pdfInit($strTcpdfClass);
47
+	}
48
+
49
+
50
+	protected function pdfInit($strTcpdfClass)
51
+	{
52
+		// TCPDF configuration
53
+		$l['a_meta_dir'] = 'ltr';
54
+		$l['a_meta_charset'] = $GLOBALS['TL_CONFIG']['characterSet'];
55
+		$l['a_meta_language'] = $GLOBALS['TL_LANGUAGE'];
56
+		$l['w_page'] = 'page';
57
+
58
+		// Create new PDF document
59
+		$pdf = new $strTcpdfClass(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
60
+
61
+		// Set document information
62
+		$pdf->SetCreator(PDF_CREATOR);
63
+		$pdf->SetAuthor(PDF_AUTHOR);
64
+		$pdf->SetTitle("Expertise");
65
+		$pdf->SetSubject("Produkt-Expertise - Baden-Badener Weinhaus GmbH");
66
+		$pdf->SetKeywords("Expertise, Wein, Baden-Baden");
67
+		$pdf->setViewerPreferences(array('PrintScaling'=>'None'));
68
+
69
+		// Prevent font subsetting (huge speed improvement)
70
+		$pdf->setFontSubsetting(false);
71
+
72
+		// Remove default header/footer
73
+		$pdf->setPrintHeader(false);
74
+		$pdf->setPrintFooter(false);
75
+
76
+		// Set margins
77
+		$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
78
+		$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
79
+
80
+		// Reset cell padding
81
+		$pdf->setCellPaddings(0,0,0,0);
82
+
83
+		// Set auto page breaks
84
+		$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
85
+
86
+		// Set image scale factor
87
+		$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
88
+
89
+		// Set some language-dependent strings
90
+		$pdf->setLanguageArray($l);
91
+
92
+		return $pdf;
93
+	}
94
+
95
+	private function &pdfObj()
96
+	{
97
+		return $this->objPdf;
98
+	}
99
+
100
+	public function pdf()
101
+	{
102
+		return $this->pdfObj();
103
+	}
104
+
105
+	abstract public function generate();
106
+
107
+}
0 108
\ No newline at end of file
1 109
new file mode 100644
... ...
@@ -0,0 +1,229 @@
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
+
21
+/**
22
+ * Include required tcpdf config files
23
+ */
24
+
25
+require_once(TL_ROOT . '/system/modules/eSM_isotope_custom/config/tcpdf.php');
26
+require_once(TL_ROOT . '/vendor/tecnickcom/tcpdf/tcpdf.php');
27
+
28
+class ESMPDF extends \TCPDF {
29
+
30
+    public function Header()
31
+    {
32
+        // Header
33
+        // get the current page break margin
34
+        $bMargin = $this->getBreakMargin();
35
+        // get current auto-page-break mode
36
+        $auto_page_break = $this->getAutoPageBreak();
37
+        // disable auto-page-break
38
+        $this->SetAutoPageBreak(false, 0);
39
+        // set bacground image
40
+        // restore auto-page-break status
41
+        $this->SetAutoPageBreak($auto_page_break, $bMargin);
42
+        $this->SetMargins(0,0,0);
43
+        $this->SetFooterMargin(0);
44
+        $this->Image(TL_ROOT . '/files/themes/affentaler_2017/assets/images/base/pdf_header.png', 15, 10,180,0,'','','T',true,300);
45
+        //$this->Image(TL_ROOT . '/files/themes/affentaler_2017/assets/images/base/affentaler_logo.png', 75, 15,60,0,'PNG','','T',true,300);
46
+        $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
47
+        $this->SetFooterMargin(PDF_MARGIN_FOOTER);
48
+    }
49
+
50
+
51
+    // Page footer
52
+    public function Footer()
53
+    {
54
+        // Footer
55
+        // get the current page break margin
56
+        $bMargin = $this->getBreakMargin();
57
+        // get current auto-page-break mode
58
+        $auto_page_break = $this->getAutoPageBreak();
59
+        // disable auto-page-break
60
+        $this->SetAutoPageBreak(false, 0);
61
+        // set bacground image
62
+        // restore auto-page-break status
63
+        $this->SetAutoPageBreak($auto_page_break, $bMargin);
64
+        $this->SetMargins(0,0,0);
65
+        $this->SetFooterMargin(0);
66
+
67
+
68
+        $this->RoundedRect(15, 277, 180, 10, 4.0, '0101', 'F', array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 1, 'color' => array(35, 52, 75, 13)), array(13,25,52,0));
69
+
70
+
71
+        $this->SetTextColor(80,38,100,32);
72
+        $this->SetXY(15, 277);
73
+        $this->CreateCell(180, 10, 'www.affentaler.de', 0, 15, '', 'C', PDF_FONT_NAME_DATA);
74
+
75
+//        $this->Image(TL_ROOT . '/files/themes/gengenbach_v1/assets/images/pdf/expertise_papier_footer.jpg', 0, 278,210,0,'JPG','','T',true,300);
76
+        $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
77
+        $this->SetFooterMargin(PDF_MARGIN_FOOTER);
78
+    }
79
+
80
+    public function CreateTextBox($textval, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
81
+    {
82
+        $margins = $this->getMargins();
83
+        $this->SetFont($font, $fontstyle, $fontsize);
84
+
85
+        if (!strlen($y))
86
+        {
87
+            $this->SetX($x+$margins['left']);
88
+        } else {
89
+            $this->SetXY($x+$margins['left'], $y);
90
+        }
91
+
92
+        // Start clipping.
93
+        $this->StartTransform();
94
+
95
+        if (!strlen($y))
96
+        {
97
+            $x = $x+$margins['left'];
98
+            $y = $y+$margins['top'];
99
+            $this->SetXY($x, $y);
100
+        } else {
101
+            $x = $x+$margins['left'];
102
+            $this->SetX($x);
103
+        }
104
+
105
+        if (!$height)
106
+        {
107
+            $pdf2 = clone $this;
108
+            $pdf2->setPrintHeader(false);
109
+            $pdf2->setPrintFooter(false);
110
+            $pdf2->AddPage();
111
+            $pdf2->Cell($width, $height, $textval, 0, false, $align);
112
+            $height = $pdf2->GetY();
113
+            unset($pdf2);
114
+        }
115
+
116
+        // Draw clipping rectangle to match cell.
117
+        $this->Rect($x, $y, $width, $height, 'CNZ');
118
+
119
+        $this->Cell($width, $height, $textval, 0, false, $align);
120
+
121
+        // Stop clipping.
122
+        $this->StopTransform();
123
+    }
124
+
125
+    public function lbr($fltNo=1)
126
+    {
127
+        $this->SetY($this->GetY()+(($this->getFontSize()*$this->getCellHeightRatio())*floatval($fltNo)));
128
+    }
129
+
130
+    public function CreateHTMLBox($htmlVal, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
131
+    {
132
+        $margins = $this->getMargins();
133
+        $this->SetFont($font, $fontstyle, $fontsize);
134
+
135
+        // Start clipping.
136
+        $this->StartTransform();
137
+
138
+        if (!strlen($y))
139
+        {
140
+            $x = $x+$margins['left'];
141
+            $y = $y+$margins['top'];
142
+        } else {
143
+            $x = $x+$margins['left'];
144
+        }
145
+
146
+        if (!$height)
147
+        {
148
+            $pdf2 = clone $this;
149
+            $pdf2->setPrintHeader(false);
150
+            $pdf2->setPrintFooter(false);
151
+            $pdf2->AddPage();
152
+            $pdf2->writeHTMLCell($width, $height, 0, 0, $htmlVal, 0, 1, false, true, $align);
153
+            $height = $pdf2->GetY();
154
+            unset($pdf2);
155
+        }
156
+
157
+        // Draw clipping rectangle to match html cell.
158
+        $this->Rect($x, $y, $width, $height, 'CNZ');
159
+
160
+        // Output html.
161
+        $this->writeHTMLCell($width, $height, $x, $y, $htmlVal, 0, 0, false, true, $align);
162
+
163
+        // Stop clipping.
164
+        $this->StopTransform();
165
+    }
166
+
167
+
168
+    public function CreateCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
169
+    {
170
+        $margins = $this->getMargins();
171
+        $currFontsize = $this->getFontSize();
172
+        $currFontfamily = $this->getFontFamily();
173
+        $currFontstyle = $this->getFontStyle();
174
+
175
+        $x = $this->GetX();
176
+        $y = $this->GetY();
177
+
178
+        $this->SetFont($font, $fontstyle, $fontsize);
179
+
180
+        // Start clipping.
181
+        $this->StartTransform();
182
+
183
+        if (!$h)
184
+        {
185
+            $h = ($this->getFontSize()*$this->getCellHeightRatio());
186
+        }
187
+
188
+        // Draw clipping rectangle to match html cell.
189
+        $this->Rect($x, $y, $w, $h, 'CNZ');
190
+
191
+        $this->Cell($w,$h,$txt,0,$ln,$align);
192
+        $this->SetFont($currFontfamily, $currFontstyle, $currFontsize);
193
+
194
+        // Stop clipping.
195
+        $this->StopTransform();
196
+
197
+        if (!$ln)
198
+        {
199
+            $this->SetY($this->GetY());
200
+        }
201
+    }
202
+
203
+    public function CreateMultiCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN)
204
+    {
205
+        $currFontsize = $this->getFontSize();
206
+        $currFontfamily = $this->getFontFamily();
207
+        $currFontstyle = $this->getFontStyle();
208
+
209
+        $this->SetFont($font, $fontstyle, $fontsize);
210
+
211
+        if (!$h)
212
+        {
213
+            $pdf2 = clone $this;
214
+            $pdf2->setPrintHeader(false);
215
+            $pdf2->setPrintFooter(false);
216
+            $pdf2->AddPage();
217
+            $pdf2->MultiCell($w,$h,$txt,0,$align,false,1,0,0);
218
+            $h = $pdf2->GetY();
219
+            unset($pdf2);
220
+        }
221
+
222
+        $this->MultiCell($w,$h,$txt,0,$align,false,$ln);
223
+        if (!$ln)
224
+        {
225
+            $this->SetY($this->GetY()+$h-($this->getFontSize()*$this->getCellHeightRatio()));
226
+        }
227
+//        $this->SetFont($currFontfamily, $currFontstyle, $currFontsize);
228
+    }
229
+}
0 230
\ No newline at end of file
1 231
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
1 126
new file mode 100644
... ...
@@ -0,0 +1,250 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+namespace eSM_isotope_custom;
14
+
15
+
16
+use Haste\Util\Format;
17
+use Isotope\Interfaces\IsotopeAttribute;
18
+use Isotope\Model\Product;
19
+use Isotope\Model\ProductPrice;
20
+use Isotope\Model\ProductType;
21
+
22
+class tl_iso_product extends \Backend
23
+{
24
+  public function injectIntoPalettes(\DataContainer $dc)
25
+  {
26
+    foreach ($GLOBALS['TL_DCA']['tl_iso_product']['palettes'] as $key => $palette)
27
+    {
28
+      if ($key == '__selector__' || in_array($palette, array('not_buyable', 'price_rrp', 'product_of_month','search_keywords')))
29
+      {
30
+        continue;
31
+      }
32
+//      $GLOBALS['TL_DCA']['tl_iso_product']['palettes'][$key] = str_replace('published', 'not_buyable,published', $GLOBALS['TL_DCA']['tl_iso_product']['palettes'][$key]);
33
+    }
34
+  }
35
+
36
+  public function generateLabel($row, $label, $dc, $args)
37
+  {
38
+    $objProduct = Product::findByPk($row['id']);
39
+
40
+    foreach ($GLOBALS['TL_DCA'][$dc->table]['list']['label']['fields'] as $i => $field) {
41
+      switch ($field) {
42
+        case 'images':
43
+          $args[$i] = static::generateIsoImage($objProduct);
44
+          break;
45
+
46
+        case 'name':
47
+          $args[$i] = $this->generateName($row, $objProduct, $dc);
48
+          break;
49
+
50
+        case 'price':
51
+          $args[$i] = $this->generatePrice($row);
52
+          break;
53
+
54
+        case 'variantFields':
55
+          $args[$i] = $this->generateVariantFields($args[$i], $objProduct, $dc);
56
+          break;
57
+
58
+        default:
59
+          $args[$i] = ($this->generateAttribute($field,$objProduct) ?: '');
60
+          break;
61
+      }
62
+    }
63
+
64
+    return $args;
65
+  }
66
+
67
+  /**
68
+   * Generate image label for product.
69
+   *
70
+   * @param \Isotope\Model\Product $objProduct
71
+   *
72
+   * @return string
73
+   */
74
+  public static function generateIsoImage($objProduct)
75
+  {
76
+    $arrImages = deserialize($objProduct->images);
77
+
78
+    if (!empty($arrImages) && is_array($arrImages)) {
79
+      foreach ($arrImages as $image) {
80
+        $strImage = 'isotope/' . strtolower(substr($image['src'], 0, 1)) . '/' . $image['src'];
81
+
82
+        if (is_file(TL_ROOT . '/' . $strImage)) {
83
+          $size = @getimagesize(TL_ROOT . '/' . $strImage);
84
+
85
+          $script = sprintf(
86
+            "Backend.openModalImage({'width':%s,'title':'%s','url':'%s'});return false",
87
+            $size[0],
88
+            str_replace("'", "\\'", $objProduct->name),
89
+            TL_FILES_URL . $strImage
90
+          );
91
+
92
+          /** @noinspection BadExpressionStatementJS */
93
+          /** @noinspection HtmlUnknownTarget */
94
+          return sprintf(
95
+            '<a href="%s" onclick="%s"><img src="%s" alt="%s" align="left"></a>',
96
+            TL_FILES_URL . $strImage,
97
+            $script,
98
+            TL_ASSETS_URL . \Image::get($strImage, 50, 50, 'proportional'),
99
+            $image['alt']
100
+          );
101
+        }
102
+      }
103
+    }
104
+
105
+    return '&nbsp;';
106
+  }
107
+
108
+  /**
109
+   * Generate name label for product with link to variants if enabled.
110
+   *
111
+   * @param array          $row
112
+   * @param \Isotope\Model\Product        $objProduct
113
+   * @param \DataContainer $dc
114
+   *
115
+   * @return string
116
+   */
117
+  private function generateName($row, $objProduct, $dc)
118
+  {
119
+    // Add a variants link
120
+    if ($row['pid'] == 0
121
+      && ($objProductType = ProductType::findByPk($row['type'])) !== null
122
+      && $objProductType->hasVariants()
123
+    ) {
124
+      /** @noinspection HtmlUnknownTarget */
125
+      return sprintf(
126
+        '<a href="%s" title="%s">%s</a>',
127
+        ampersand(\Environment::get('request')) . '&amp;id=' . $row['id'],
128
+        specialchars($GLOBALS['TL_LANG'][$dc->table]['showVariants']),
129
+        $objProduct->name
130
+      );
131
+    }
132
+
133
+    return ($this->generateAttribute('lage',$objProduct) ?: '').' '.$objProduct->name.' '.$objProduct->zusatz.' '.($this->generateAttribute('qualitaet',$objProduct) ?: '').' '.($this->generateAttribute('geschmack',$objProduct) ?: '');
134
+  }
135
+
136
+  /**
137
+   * Generate price label for product.
138
+   *
139
+   * @param array $row
140
+   *
141
+   * @return string
142
+   */
143
+  private function generatePrice($row)
144
+  {
145
+    $objPrice = ProductPrice::findPrimaryByProductId($row['id']);
146
+
147
+    if (null !== $objPrice) {
148
+      try {
149
+        /** @var \Isotope\Model\TaxClass $objTax */
150
+        $objTax = $objPrice->getRelated('tax_class');
151
+        $strTax = (null === $objTax ? '' : ' (' . $objTax->getName() . ')');
152
+
153
+        return $objPrice->getValueForTier(1) . $strTax;
154
+      } catch (\Exception $e) {
155
+        return '';
156
+      }
157
+    }
158
+
159
+    return '';
160
+  }
161
+
162
+  /**
163
+   * Generate variant fields for product.
164
+   *
165
+   * @param string         $label
166
+   * @param Product        $objProduct
167
+   * @param \DataContainer $dc
168
+   *
169
+   * @return string
170
+   */
171
+  private function generateVariantFields($label, $objProduct, $dc)
172
+  {
173
+    $attributes = [];
174
+
175
+    foreach ($GLOBALS['TL_DCA'][$dc->table]['list']['label']['variantFields'] as $variantField) {
176
+      $attributes[] = sprintf(
177
+        '<strong>%s:</strong>&nbsp;%s',
178
+        Format::dcaLabel($dc->table, $variantField),
179
+        Format::dcaValue($dc->table, $variantField, $objProduct->$variantField)
180
+      );
181
+    }
182
+
183
+    return ($label ? $label . '<br>' : '') . implode(', ', $attributes);
184
+  }
185
+
186
+  protected function generateAttribute($strAttribute, $objProduct, $blnStripTags = false, array $arrOptions = array()) {
187
+
188
+    $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strAttribute];
189
+
190
+    if (!($objAttribute instanceof IsotopeAttribute)) {
191
+      return '';
192
+    }
193
+
194
+    $strBuffer = $objAttribute->generate($objProduct, $arrOptions);
195
+
196
+    if ($blnStripTags)
197
+    {
198
+      $strBuffer = strip_tags($strBuffer,'<br><br /><br/></p></ p>');
199
+      $strBuffer = str_ireplace(array('<br />','<br>','<br/>'),"\n",$strBuffer);
200
+      $strBuffer = str_ireplace(array('</p>','</ p>'),"\n",$strBuffer);
201
+      $strBuffer = preg_replace('/(\r\n|\n)$/','',$strBuffer);
202
+    }
203
+
204
+    return $strBuffer;
205
+  }
206
+
207
+  public function generateSearchKeywords(\DataContainer $dc)
208
+  {
209
+    $objProduct = Product::findByPk($dc->id);
210
+
211
+    $arrKeywords = array();
212
+
213
+    foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields'] as $field => $arrData) {
214
+      if ($arrData['attributes']['fe_filter'] && !$arrData['attributes']['fe_search'] && $arrData['attributes']['type'] == 'select') {
215
+        if (($varValue = $this->generateAttribute($field,$objProduct)))
216
+        {
217
+          $arrKeywords[] = $varValue;
218
+        }
219
+      }
220
+    }
221
+
222
+    $objProduct->search_keywords = implode(', ',$arrKeywords);
223
+    $objProduct->save();
224
+  }
225
+
226
+  /**
227
+   * Reset fallback checkbox for other variants of a product.
228
+   *
229
+   * @param mixed          $varValue
230
+   * @param \DataContainer $dc
231
+   *
232
+   * @return mixed
233
+   */
234
+  public function reset($varValue, \DataContainer $dc)
235
+  {
236
+    if (!$dc->activeRecord->pid) {
237
+      return $varValue;
238
+    }
239
+
240
+    if ($varValue)
241
+    {
242
+      \Database::getInstance()
243
+        ->prepare("UPDATE tl_iso_product SET fallback='' WHERE pid=? AND id!=?")
244
+        ->execute($dc->activeRecord->pid, $dc->activeRecord->id);
245
+    }
246
+
247
+    return $varValue;
248
+  }
249
+
250
+}
0 251
\ No newline at end of file
1 252
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+;;
2
+; List modules which are required to be loaded beforehand
3
+;;
4
+requires[] = "isotope"
5
+requires[] = "calendar"
6
+requires[] = "isotope_rules"
7
+
8
+;;
9
+; Configure what you want the autoload creator to register
10
+;;
11
+register_namespaces = true
12
+register_classes    = true
13
+register_templates  = true
0 14
\ No newline at end of file
1 15
new file mode 100644
... ...
@@ -0,0 +1,56 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ *
6
+ * Copyright (c) 2005-2015 Leo Feyer
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+
12
+/**
13
+ * Register the namespaces
14
+ */
15
+ClassLoader::addNamespaces(array
16
+(
17
+	'eSM_isotope_custom',
18
+));
19
+
20
+
21
+/**
22
+ * Register the classes
23
+ */
24
+ClassLoader::addClasses(array
25
+(
26
+  // Classes
27
+  'eSM_isotope_custom\Pdf\Document'           => 'system/modules/eSM_isotope_custom/classes/Document.php',
28
+  'eSM_isotope_custom\Pdf\ESMPDF'              => 'system/modules/eSM_isotope_custom/classes/ESMPDF.php',
29
+  'eSM_isotope_custom\Pdf\BBPDF'              => 'system/modules/eSM_isotope_custom/classes/BBPDF.php',
30
+  'eSM_isotope_custom\Pdf\ExpertisePdf'         => 'system/modules/eSM_isotope_custom/classes/ExpertisePdf.php',
31
+  'eSM_isotope_custom\tl_iso_product'  => 'system/modules/eSM_isotope_custom/classes/tl_iso_product.php',
32
+
33
+  // Elements
34
+  'eSM_isotope_custom\ContentElement'   => 'system/modules/eSM_isotope_custom/elements/ContentElement.php',
35
+
36
+  // Models
37
+  'eSM_isotope_custom\Model\Standard'  => 'system/modules/eSM_isotope_custom/models/Standard.php',
38
+  'eSM_isotope_custom\Model\AffentalerRule'  => 'system/modules/eSM_isotope_custom/models/AffentalerRule.php',
39
+  'eSM_isotope_custom\Model\ProductCollectionSurcharge\AffentalerRule'  => 'system/modules/eSM_isotope_custom/models/ProductCollectionSurcharge/AffentalerRule.php',
40
+
41
+  // Modules
42
+  'eSM_isotope_custom\Pdf\ModuleExpertisePdf'  => 'system/modules/eSM_isotope_custom/modules/ModuleExpertisePdf.php',
43
+  'eSM_isotope_custom\Module\CumulativeFilter'  => 'system/modules/eSM_isotope_custom/modules/CumulativeFilter.php',
44
+
45
+  // Hooks
46
+  'eSM_isotope_custom\InsertTag'    => 'system/modules/eSM_isotope_custom/hooks/InsertTag.php',
47
+  'eSM_isotope_custom\IsotopeHooks' => 'system/modules/eSM_isotope_custom/hooks/IsotopeHooks.php',
48
+));
49
+
50
+/**
51
+ * Register the templates
52
+ */
53
+TemplateLoader::addFiles(array
54
+(
55
+  'iso_payment_sparkasse'                => 'system/modules/isotope/templates/payment',
56
+));
0 57
\ No newline at end of file
1 58
new file mode 100644
... ...
@@ -0,0 +1,56 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ * 
6
+ * Copyright (C) 2005-2013 Leo Feyer
7
+ * 
8
+ * @package Core
9
+ * @link    https://contao.org
10
+ * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
+ */
12
+
13
+
14
+/**
15
+ * This is the TCPDF (PDF generator) configuration file. See
16
+ * system/vendor/tcpdf for more information.
17
+ */
18
+define('K_TCPDF_EXTERNAL_CONFIG', true);
19
+define('K_PATH_MAIN', TL_ROOT . '/vendor/tecnickcom/tcpdf/');
20
+define('K_PATH_URL', Environment::get('base') . 'vendor/tecnickcom/tcpdf/');
21
+define('K_PATH_FONTS', TL_ROOT . '/contao/fonts/');
22
+define('K_PATH_CACHE', TL_ROOT . '/system/tmp/');
23
+define('K_PATH_URL_CACHE', TL_ROOT . '/system/tmp/');
24
+define('K_PATH_IMAGES', K_PATH_MAIN . 'images/');
25
+define('K_BLANK_IMAGE', K_PATH_IMAGES . '_blank.png');
26
+define('PDF_PAGE_FORMAT', 'A4');
27
+define('PDF_PAGE_ORIENTATION', 'P');
28
+define('PDF_CREATOR', 'Expertisen für Isotope [by eSales Media]');
29
+define('PDF_AUTHOR', Environment::get('url'));
30
+define('PDF_HEADER_TITLE', $GLOBALS['TL_CONFIG']['websiteTitle']);
31
+define('PDF_HEADER_STRING', '');
32
+define('PDF_HEADER_LOGO', '');
33
+define('PDF_HEADER_LOGO_WIDTH', 30);
34
+define('PDF_UNIT', 'mm');
35
+define('PDF_MARGIN_HEADER', 0);
36
+define('PDF_MARGIN_FOOTER', 25);
37
+define('PDF_MARGIN_TOP', 75); // original 35
38
+define('PDF_MARGIN_BOTTOM', 30);
39
+define('PDF_MARGIN_LEFT', 15);
40
+define('PDF_MARGIN_RIGHT', 15);
41
+//define('PDF_FONT_NAME_MAIN', 'sourcesanspro');
42
+define('PDF_FONT_NAME_MAIN', 'ebgaramond');
43
+define('PDF_FONT_SIZE_MAIN', 10);
44
+define('PDF_FONT_NAME_DATA', 'sourcesanspro');
45
+define('PDF_FONT_SIZE_DATA', 10);
46
+define('PDF_FONT_NAME_ICON', 'icomoon');
47
+define('PDF_FONT_SIZE_ICON', 10);
48
+define('PDF_FONT_MONOSPACED', 'courier');
49
+define('PDF_FONT_SIZE_MONOSPACED', 10); // PATCH
50
+define('PDF_IMAGE_SCALE_RATIO', 1.25);
51
+define('HEAD_MAGNIFICATION', 1.1);
52
+define('K_CELL_HEIGHT_RATIO', 1.25);
53
+define('K_TITLE_MAGNIFICATION', 1.3);
54
+define('K_SMALL_RATIO', 2/3);
55
+define('K_THAI_TOPCHARS', false);
56
+define('K_TCPDF_CALLS_IN_HTML', false);
0 57
new file mode 100644
... ...
@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['FE_MOD']['isotope']['expertisePDF'] = 'eSM_isotope_custom\\Pdf\\ModuleExpertisePdf';
14
+$GLOBALS['FE_MOD']['isotope']['iso_cumulativefilter'] = 'eSM_isotope_custom\\Module\\CumulativeFilter';
15
+
16
+$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('eSM_isotope_custom\\InsertTag', 'eSMReplaceInsertTags');
17
+$GLOBALS['TL_HOOKS']['addCustomRegexp'][] = array('eSM_isotope_custom\\IsotopeHooks', 'addCustomRegexp');
18
+$GLOBALS['TL_HOOKS']['getAttributesFromDca'][] = array('eSM_isotope_custom\\IsotopeHooks', 'getAttributesFromDca');
19
+$GLOBALS['ISO_HOOKS']['addProductToCollection'][] = array('eSM_isotope_custom\\IsotopeHooks', 'addProductToCollection');
20
+$GLOBALS['ISO_HOOKS']['calculatePrice'][] = array('eSM_isotope_custom\\IsotopeHooks', 'calculatePrice');
21
+$GLOBALS['ISO_HOOKS']['addAssetImportRegexp'][] = array('eSM_isotope_custom\\IsotopeHooks', 'addAssetImportRegexp');
22
+$GLOBALS['ISO_HOOKS']['modifyAddressFields'][] = array('eSM_isotope_custom\\IsotopeHooks', 'modifyAddressFields');
23
+$GLOBALS['ISO_HOOKS']['findSurchargesForCollection'][]  = array('eSM_isotope_custom\\IsotopeHooks', 'findSurcharges');
24
+
25
+
26
+\Isotope\Model\Product::registerModelType('standard', 'eSM_isotope_custom\Model\Standard');
27
+\Isotope\Model\ProductCollectionSurcharge::registerModelType('affentalerRule', 'eSM_isotope_custom\Model\ProductCollectionSurcharge\AffentalerRule');
0 28
new file mode 100644
... ...
@@ -0,0 +1,56 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ * 
6
+ * Copyright (C) 2005-2013 Leo Feyer
7
+ * 
8
+ * @package Core
9
+ * @link    https://contao.org
10
+ * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
+ */
12
+
13
+
14
+/**
15
+ * This is the TCPDF (PDF generator) configuration file. See
16
+ * system/vendor/tcpdf for more information.
17
+ */
18
+define('K_TCPDF_EXTERNAL_CONFIG', true);
19
+define('K_PATH_MAIN', TL_ROOT . '/vendor/tecnickcom/tcpdf/');
20
+define('K_PATH_URL', Environment::get('base') . 'vendor/tecnickcom/tcpdf/');
21
+define('K_PATH_FONTS', K_PATH_MAIN . 'fonts/');
22
+define('K_PATH_CACHE', TL_ROOT . '/system/tmp/');
23
+define('K_PATH_URL_CACHE', TL_ROOT . '/system/tmp/');
24
+define('K_PATH_IMAGES', K_PATH_MAIN . 'images/');
25
+define('K_BLANK_IMAGE', K_PATH_IMAGES . '_blank.png');
26
+define('PDF_PAGE_FORMAT', 'A4');
27
+define('PDF_PAGE_ORIENTATION', 'P');
28
+define('PDF_CREATOR', 'Expertisen für Isotope [by eSales Media]');
29
+define('PDF_AUTHOR', Environment::get('url'));
30
+define('PDF_HEADER_TITLE', $GLOBALS['TL_CONFIG']['websiteTitle']);
31
+define('PDF_HEADER_STRING', '');
32
+define('PDF_HEADER_LOGO', '');
33
+define('PDF_HEADER_LOGO_WIDTH', 30);
34
+define('PDF_UNIT', 'mm');
35
+define('PDF_MARGIN_HEADER', 0);
36
+define('PDF_MARGIN_FOOTER', 25);
37
+define('PDF_MARGIN_TOP', 55); // original 35
38
+define('PDF_MARGIN_BOTTOM', 30);
39
+define('PDF_MARGIN_LEFT', 15);
40
+define('PDF_MARGIN_RIGHT', 15);
41
+//define('PDF_FONT_NAME_MAIN', 'sourcesanspro');
42
+define('PDF_FONT_NAME_MAIN', 'exo2');
43
+define('PDF_FONT_SIZE_MAIN', 10);
44
+define('PDF_FONT_NAME_DATA', 'exo2');
45
+define('PDF_FONT_SIZE_DATA', 10);
46
+define('PDF_FONT_NAME_ICON', 'icomoon');
47
+define('PDF_FONT_SIZE_ICON', 10);
48
+define('PDF_FONT_MONOSPACED', 'courier');
49
+define('PDF_FONT_SIZE_MONOSPACED', 10); // PATCH
50
+define('PDF_IMAGE_SCALE_RATIO', 1.25);
51
+define('HEAD_MAGNIFICATION', 1.1);
52
+define('K_CELL_HEIGHT_RATIO', 1.25);
53
+define('K_TITLE_MAGNIFICATION', 1.3);
54
+define('K_SMALL_RATIO', 2/3);
55
+define('K_THAI_TOPCHARS', false);
56
+define('K_TCPDF_CALLS_IN_HTML', false);
0 57
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+
14
+foreach ($GLOBALS['TL_DCA']['tl_content']['palettes'] as $key => $palette)
15
+{
16
+  $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] = str_replace(';{invisible_legend', ',es_iso_hide_list;{invisible_legend', $palette);
17
+}
18
+
19
+/**
20
+ * Add fields to tl_content
21
+ */
22
+
23
+$GLOBALS['TL_DCA']['tl_content']['fields']['es_iso_hide_list'] = array
24
+(
25
+    'label'                   => &$GLOBALS['TL_LANG']['tl_content']['es_iso_hide_list'],
26
+    'exclude'                 => true,
27
+    'inputType'               => 'checkbox',
28
+    'eval'                    => array('tl_class'=>'w50 m12'),
29
+    'sql'                     => "char(1) NOT NULL default ''"
30
+);
31
+
0 32
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['TL_DCA']['tl_iso_address']['palettes']['default'] = str_replace('vat_no','cust_no_erp,vat_no',$GLOBALS['TL_DCA']['tl_iso_address']['palettes']['default']);
14
+
15
+
16
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['firstname']['eval']['eSM_fl_width'] = '50';
17
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['lastname']['eval']['eSM_fl_width'] = '50';
18
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['company']['eval']['eSM_fl_width'] = '50';
19
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['street_1']['eval']['eSM_fl_width'] = '50';
20
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['postal']['eval']['eSM_fl_width'] = '15';
21
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['city']['eval']['eSM_fl_width'] = '35';
22
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['country']['eval']['eSM_fl_width'] = '50';
23
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['phone']['eval']['eSM_fl_width'] = '50';
24
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['email']['eval']['eSM_fl_width'] = '100';
25
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['dateOfBirth']['eval']['eSM_fl_width'] = '50';
26
+$GLOBALS['TL_DCA']['tl_iso_address']['fields']['dateOfBirth']['eval']['eSM_fl_fieldClass'] = 'picker-date';
27
+
28
+/*$GLOBALS['TL_DCA']['tl_iso_address']['fields']['cust_no_erp'] = array
29
+(
30
+  'label'                 => &$GLOBALS['TL_LANG']['tl_iso_address']['cust_no_erp'],
31
+  'exclude'               => true,
32
+  'search'                => true,
33
+  'inputType'             => 'text',
34
+  'eval'                  => array('maxlength'=>255, 'feEditable'=>true, 'feGroup'=>'address', 'tl_class'=>'w50', 'eSM_fl_width' => '50'),
35
+  'sql'                   => "varchar(255) NOT NULL default ''",
36
+);*/
0 37
\ No newline at end of file
1 38
new file mode 100644
... ...
@@ -0,0 +1,64 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['TL_DCA']['tl_iso_product']['config']['onload_callback'][] = array('eSM_isotope_custom\tl_iso_product','injectIntoPalettes');
14
+$GLOBALS['TL_DCA']['tl_iso_product']['config']['onsubmit_callback'][] = array('eSM_isotope_custom\tl_iso_product','generateSearchKeywords');
15
+
16
+$GLOBALS['TL_DCA']['tl_iso_product']['list']['label']['label_callback'] = array('eSM_isotope_custom\tl_iso_product','generateLabel');
17
+$GLOBALS['TL_DCA']['tl_iso_product']['list']['label']['fields'] = array('images', 'name', 'sku', 'price', 'jahrgang', 'qualitaet','geschmack','weinlinie');
18
+
19
+
20
+$GLOBALS['TL_DCA']['tl_iso_product']['fields']['fallback']['save_callback'] = array
21
+(
22
+  array('eSM_isotope_custom\tl_iso_product','reset')
23
+);
24
+$GLOBALS['TL_DCA']['tl_iso_product']['fields']['search_keywords'] = array
25
+(
26
+  'label'                 => &$GLOBALS['TL_LANG']['tl_iso_product']['search_keywords'],
27
+  'exclude'               => true,
28
+  'inputType'             => 'text',
29
+  'eval'                  => array('mandatory'=>false, 'tl_class'=>'w50','readonly'=>true),
30
+  'attributes'            => array('legend'=>'meta_legend', 'fe_search'=>true, 'fixed'=>true, 'variant_fixed'=>true, 'systemColumn'=>true),
31
+  'sql'                   => "varchar(1055) NOT NULL default ''"
32
+);
33
+
34
+$GLOBALS['TL_DCA']['tl_iso_product']['fields']['not_buyable'] = array
35
+(
36
+  'label'                 => &$GLOBALS['TL_LANG']['tl_iso_product']['not_buyable'],
37
+  'exclude'               => true,
38
+  'filter'                => true,
39
+  'inputType'             => 'checkbox',
40
+  'attributes'            => array('legend'=>'publish_legend', 'fixed'=>true, 'inherit'=>true, 'systemColumn'=>true),
41
+  'eval'                  => array('tl_class'=>'w50 m12 clr','doNotCopy'=>true),
42
+  'sql'                   => "char(1) NOT NULL default ''",
43
+);
44
+
45
+$GLOBALS['TL_DCA']['tl_iso_product']['fields']['not_buyable_text'] = array
46
+(
47
+  'label'                 => &$GLOBALS['TL_LANG']['tl_iso_product']['not_buyable_text'],
48
+  'exclude'               => true,
49
+  'inputType'             => 'text',
50
+  'eval'                  => array('maxlength'=>255,'tl_class'=>'w50'),
51
+  'attributes'            => array('legend'=>'publish_legend', 'fixed'=>true, 'inherit'=>true, 'systemColumn'=>true),
52
+  'sql'                   => "varchar(255) NOT NULL default ''",
53
+);
54
+
55
+$GLOBALS['TL_DCA']['tl_iso_product']['fields']['product_of_month'] = array
56
+(
57
+  'label'                 => &$GLOBALS['TL_LANG']['tl_iso_product']['product_of_month'],
58
+  'exclude'               => true,
59
+  'filter'                => true,
60
+  'inputType'             => 'checkbox',
61
+  'eval'                  => array('unique'=>true,'tl_class'=>''),
62
+  'attributes'            => array('legend'=>'options_legend', 'fixed'=>true, 'variant_fixed'=>true, 'systemColumn'=>true),
63
+  'sql'                   => "char(1) NOT NULL default ''",
64
+);
0 65
\ No newline at end of file
1 66
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+array_insert($GLOBALS['TL_DCA']['tl_iso_product_collection']['list']['label']['fields'],1,array('id'));
0 14
new file mode 100644
... ...
@@ -0,0 +1,21 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+
14
+$GLOBALS['TL_DCA']['tl_iso_rule']['fields']['type']['options'][] = 'affentaler';
15
+$GLOBALS['TL_DCA']['tl_iso_rule']['fields']['type']['options'][] = 'special';
16
+$GLOBALS['TL_DCA']['tl_iso_rule']['palettes']['affentaler'] = '{basic_legend},type,name,discount,rounding;{limit_legend:hide},limitPerMember,limitPerConfig,minItemQuantity,maxItemQuantity,quantityMode;{datim_legend:hide},startDate,endDate,startTime,endTime;{advanced_legend:hide},configRestrictions,memberRestrictions,productRestrictions;{enabled_legend},enabled';
17
+$GLOBALS['TL_DCA']['tl_iso_rule']['palettes']['special'] = '{basic_legend},type,applyTo,name,label,discount,rounding;{coupon_legend:hide},enableCode;{limit_legend:hide},limitPerMember,limitPerConfig,minSubtotal,maxSubtotal,minWeight,maxWeight,minItemQuantity,maxItemQuantity,quantityMode;{datim_legend:hide},startDate,endDate,startTime,endTime;{advanced_legend:hide},configRestrictions,memberRestrictions,productRestrictions;{enabled_legend},enabled';
18
+
19
+
20
+$GLOBALS['TL_DCA']['tl_iso_rule']['fields']['label']['sql'] = "varchar(1055) NOT NULL default ''";
21
+$GLOBALS['TL_DCA']['tl_iso_rule']['fields']['label']['eval']['maxlength'] = 1055;
0 22
\ No newline at end of file
1 23
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['TL_DCA']['tl_member']['fields']['dateOfBirth']['eval']['eSM_fl_fieldClass'] = 'picker-date';
0 14
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+/**
14
+ * Extend default palette
15
+ */
16
+$GLOBALS['TL_DCA']['tl_module']['palettes']['expertisePDF'] = '{title_legend},name,headline,type;{expertise_legend},classname;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
17
+
18
+$GLOBALS['TL_DCA']['tl_module']['fields']['classname'] = array
19
+(
20
+  'label'                 => &$GLOBALS['TL_LANG']['tl_module']['classname'],
21
+  'exclude'               => true,
22
+  'inputType'             => 'text',
23
+  'eval'                  => array('mandatory'=>false, 'tl_class'=>'w50','decodeEntities'=>true),
24
+  'sql'                   => "varchar(255) NOT NULL default ''"
25
+);
0 26
\ No newline at end of file
1 27
new file mode 100644
... ...
@@ -0,0 +1,120 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ *
6
+ * Copyright (c) 2005-2015 Leo Feyer
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+namespace eSM_isotope_custom;
12
+use Haste\Input\Input;
13
+
14
+
15
+/**
16
+ * Parent class for content elements.
17
+ *
18
+ * @property integer $id
19
+ * @property integer $pid
20
+ * @property string  $ptable
21
+ * @property integer $sorting
22
+ * @property integer $tstamp
23
+ * @property string  $type
24
+ * @property string  $headline
25
+ * @property string  $text
26
+ * @property boolean $addImage
27
+ * @property string  $singleSRC
28
+ * @property string  $alt
29
+ * @property string  $title
30
+ * @property string  $size
31
+ * @property string  $imagemargin
32
+ * @property string  $imageUrl
33
+ * @property boolean $fullsize
34
+ * @property string  $caption
35
+ * @property string  $floating
36
+ * @property string  $html
37
+ * @property string  $listtype
38
+ * @property string  $listitems
39
+ * @property string  $tableitems
40
+ * @property string  $summary
41
+ * @property boolean $thead
42
+ * @property boolean $tfoot
43
+ * @property boolean $tleft
44
+ * @property boolean $sortable
45
+ * @property integer $sortIndex
46
+ * @property string  $sortOrder
47
+ * @property string  $mooHeadline
48
+ * @property string  $mooStyle
49
+ * @property string  $mooClasses
50
+ * @property string  $highlight
51
+ * @property string  $shClass
52
+ * @property string  $code
53
+ * @property string  $url
54
+ * @property boolean $target
55
+ * @property string  $titleText
56
+ * @property string  $linkTitle
57
+ * @property string  $embed
58
+ * @property string  $rel
59
+ * @property boolean $useImage
60
+ * @property string  $multiSRC
61
+ * @property string  $orderSRC
62
+ * @property boolean $useHomeDir
63
+ * @property integer $perRow
64
+ * @property integer $perPage
65
+ * @property integer $numberOfItems
66
+ * @property string  $sortBy
67
+ * @property boolean $metaIgnore
68
+ * @property string  $galleryTpl
69
+ * @property string  $customTpl
70
+ * @property string  $playerSRC
71
+ * @property string  $youtube
72
+ * @property string  $posterSRC
73
+ * @property string  $playerSize
74
+ * @property boolean $autoplay
75
+ * @property integer $sliderDelay
76
+ * @property integer $sliderSpeed
77
+ * @property integer $sliderStartSlide
78
+ * @property boolean $sliderContinuous
79
+ * @property integer $cteAlias
80
+ * @property integer $articleAlias
81
+ * @property integer $article
82
+ * @property integer $form
83
+ * @property integer $module
84
+ * @property boolean $protected
85
+ * @property string  $groups
86
+ * @property boolean $guests
87
+ * @property string  $cssID
88
+ * @property string  $space
89
+ * @property boolean $invisible
90
+ * @property string  $start
91
+ * @property string  $stop
92
+ * @property string  $com_order
93
+ * @property integer $com_perPage
94
+ * @property boolean $com_moderate
95
+ * @property boolean $com_bbcode
96
+ * @property boolean $com_disableCaptcha
97
+ * @property boolean $com_requireLogin
98
+ * @property string  $com_template
99
+ * @property string  $classes
100
+ * @property string  $typePrefix
101
+ * @property integer $origId
102
+ * @property string  $origSpace
103
+ * @property string  $origCssID
104
+ *
105
+ * @author Leo Feyer <https://github.com/leofeyer>
106
+ */
107
+abstract class ContentElement extends \Contao\ContentElement
108
+{
109
+  public function generate()
110
+  {
111
+    // Hide element in reader mode if the respective setting is enabled
112
+    if ($this->es_iso_hide_list && Input::getAutoItem('product', false, true) != '') {
113
+      return '';
114
+    }
115
+
116
+    return parent::generate();
117
+  }
118
+
119
+
120
+}
0 121
new file mode 100644
... ...
@@ -0,0 +1,154 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ *
6
+ * Copyright (c) 2005-2015 Leo Feyer
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+namespace eSM_isotope_custom;
12
+use Haste\Input\Input;
13
+
14
+
15
+/**
16
+ * Parent class for front end modules.
17
+ *
18
+ * @property integer $id
19
+ * @property integer $pid
20
+ * @property integer $tstamp
21
+ * @property string  $name
22
+ * @property string  $headline
23
+ * @property string  $type
24
+ * @property integer $levelOffset
25
+ * @property integer $showLevel
26
+ * @property boolean $hardLimit
27
+ * @property boolean $showProtected
28
+ * @property boolean $defineRoot
29
+ * @property integer $rootPage
30
+ * @property string  $navigationTpl
31
+ * @property string  $customTpl
32
+ * @property string  $pages
33
+ * @property string  $orderPages
34
+ * @property boolean $showHidden
35
+ * @property string  $customLabel
36
+ * @property boolean $autologin
37
+ * @property integer $jumpTo
38
+ * @property boolean $redirectBack
39
+ * @property string  $cols
40
+ * @property array   $editable
41
+ * @property string  $memberTpl
42
+ * @property boolean $tableless
43
+ * @property integer $form
44
+ * @property string  $queryType
45
+ * @property boolean $fuzzy
46
+ * @property integer $contextLength
47
+ * @property integer $totalLength
48
+ * @property integer $perPage
49
+ * @property string  $searchType
50
+ * @property string  $searchTpl
51
+ * @property string  $inColumn
52
+ * @property integer $skipFirst
53
+ * @property boolean $loadFirst
54
+ * @property string  $size
55
+ * @property boolean $transparent
56
+ * @property string  $flashvars
57
+ * @property string  $altContent
58
+ * @property string  $source
59
+ * @property string  $singleSRC
60
+ * @property string  $url
61
+ * @property boolean $interactive
62
+ * @property string  $flashID
63
+ * @property string  $flashJS
64
+ * @property string  $imgSize
65
+ * @property boolean $useCaption
66
+ * @property boolean $fullsize
67
+ * @property string  $multiSRC
68
+ * @property string  $orderSRC
69
+ * @property string  $html
70
+ * @property integer $rss_cache
71
+ * @property string  $rss_feed
72
+ * @property string  $rss_template
73
+ * @property integer $numberOfItems
74
+ * @property boolean $disableCaptcha
75
+ * @property string  $reg_groups
76
+ * @property boolean $reg_allowLogin
77
+ * @property boolean $reg_skipName
78
+ * @property string  $reg_close
79
+ * @property boolean $reg_assignDir
80
+ * @property string  $reg_homeDir
81
+ * @property boolean $reg_activate
82
+ * @property integer $reg_jumpTo
83
+ * @property string  $reg_text
84
+ * @property string  $reg_password
85
+ * @property boolean $protected
86
+ * @property string  $groups
87
+ * @property boolean $guests
88
+ * @property string  $cssID
89
+ * @property string  $space
90
+ * @property string  $cal_calendar
91
+ * @property boolean $cal_noSpan
92
+ * @property integer $cal_startDay
93
+ * @property string  $cal_format
94
+ * @property boolean $cal_ignoreDynamic
95
+ * @property string  $cal_order
96
+ * @property integer $cal_readerModule
97
+ * @property integer $cal_limit
98
+ * @property string  $cal_template
99
+ * @property string  $cal_ctemplate
100
+ * @property boolean $cal_showQuantity
101
+ * @property string  $com_order
102
+ * @property boolean $com_moderate
103
+ * @property boolean $com_bbcode
104
+ * @property boolean $com_requireLogin
105
+ * @property boolean $com_disableCaptcha
106
+ * @property string  $com_template
107
+ * @property string  $faq_categories
108
+ * @property integer $faq_readerModule
109
+ * @property string  $list_table
110
+ * @property string  $list_fields
111
+ * @property string  $list_where
112
+ * @property string  $list_search
113
+ * @property string  $list_sort
114
+ * @property string  $list_info
115
+ * @property string  $list_info_where
116
+ * @property string  $list_layout
117
+ * @property string  $list_info_layout
118
+ * @property string  $news_archives
119
+ * @property string  $news_featured
120
+ * @property string  $news_jumpToCurrent
121
+ * @property integer $news_readerModule
122
+ * @property string  $news_metaFields
123
+ * @property string  $news_template
124
+ * @property string  $news_format
125
+ * @property integer $news_startDay
126
+ * @property string  $news_order
127
+ * @property boolean $news_showQuantity
128
+ * @property string  $newsletters
129
+ * @property string  $nl_channels
130
+ * @property boolean $nl_hideChannels
131
+ * @property string  $nl_subscribe
132
+ * @property string  $nl_unsubscribe
133
+ * @property string  $nl_template
134
+ * @property string  $origSpace
135
+ * @property string  $origCssID
136
+ * @property string  $hl
137
+ *
138
+ *
139
+ * @author Leo Feyer <https://github.com/leofeyer>
140
+ */
141
+abstract class Module extends \Contao\Module
142
+{
143
+  public function generate()
144
+  {
145
+    // Hide element in reader mode if the respective setting is enabled
146
+    if ($this->es_iso_hide_list && Input::getAutoItem('product', false, true) != '') {
147
+      return '';
148
+    }
149
+
150
+    return parent::generate();
151
+  }
152
+
153
+
154
+}
0 155
new file mode 100644
... ...
@@ -0,0 +1,53 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+namespace eSM_isotope_custom;
14
+
15
+use Haste\Input\Input;
16
+use Isotope\Model\Product;
17
+use Isotope\Interfaces\IsotopeAttribute;
18
+
19
+class InsertTag extends \Controller
20
+{
21
+    public function eSMReplaceInsertTags($strTag)
22
+    {
23
+        $elements = explode('::', $strTag);
24
+        if ($elements[0] == 'iso_custom_product')
25
+        {
26
+            $fragments = explode(':', $elements[1]);
27
+
28
+            if ($fragments[0] && ($objProduct = $this->findCurrentProduct($fragments[1])) !== null)
29
+            {
30
+                $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$fragments[0]];
31
+
32
+                if (!($objAttribute instanceof IsotopeAttribute)) {
33
+                    throw new \InvalidArgumentException($fragments[0] . ' is not a valid attribute');
34
+                }
35
+
36
+                return $objAttribute->generate($objProduct, array());
37
+            }
38
+        }
39
+
40
+        return false;
41
+    }
42
+
43
+    private function findCurrentProduct($id = null)
44
+    {
45
+        if (null !== $id) {
46
+            return Product::findPublishedByPk($id);
47
+        } elseif (Product::getActive() !== null) {
48
+            return Product::getActive();
49
+        } else {
50
+            return Product::findAvailableByIdOrAlias(Input::getAutoItem('product', false, true));
51
+        }
52
+    }
53
+}
0 54
\ No newline at end of file
1 55
new file mode 100644
... ...
@@ -0,0 +1,231 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+namespace eSM_isotope_custom;
14
+
15
+use Isotope\Interfaces\IsotopePrice;
16
+use Isotope\Interfaces\IsotopeProductCollection;
17
+use Isotope\Model\ProductCollection\Order;
18
+use eSM_isotope_custom\Model\AffentalerRule as Rule;
19
+use Isotope\Isotope;
20
+use Isotope\Model\ProductCollection\Cart;
21
+//use Isotope\Module\Cart;
22
+use eSM_isotope_custom\Model\ProductCollectionSurcharge\AffentalerRule as RuleSurcharge;
23
+
24
+
25
+class IsotopeHooks extends \Controller
26
+{
27
+    public function addProductToCollection($objProduct, $intQuantity, $ProductCollection)
28
+    {
29
+        if ($objProduct->not_buyable)
30
+        {
31
+          return 0;
32
+        }
33
+        return $intQuantity;
34
+    }
35
+
36
+  /**
37
+   * Calculate the price for a product, applying rules and coupons
38
+   *
39
+   * @param    float
40
+   * @param    object
41
+   * @param    string
42
+   * @param    int
43
+   * @return float
44
+   */
45
+  public function calculatePrice($fltPrice, $objSource, $strField, $intTaxClass)
46
+  {
47
+    // RRP
48
+    if ($strField === 'original_price' && ($objProduct = $objSource->getRelated('pid')) !== null)
49
+    {
50
+      if ($objProduct->price_rrp > $fltPrice)
51
+      {
52
+        return $objProduct->price_rrp;
53
+      }
54
+    }
55
+
56
+    if ($objSource instanceof IsotopePrice && ('price' === $strField || 'low_price' === $strField || 'net_price' === $strField || 'gross_price' === $strField)) {
57
+
58
+      // @todo try not to use getRelated() because it loads variants
59
+      $objRules = Rule::findByProduct($objSource->getRelated('pid'), $strField, $fltPrice);
60
+
61
+      if (null !== $objRules) {
62
+        while ($objRules->next()) {
63
+          // Check cart quantity
64
+          if ($objRules->minItemQuantity > 0 || $objRules->maxItemQuantity >= 0) {
65
+            if ('cart_products' === $objRules->quantityMode) {
66
+              $intTotal = Isotope::getCart()->countItems();
67
+            } elseif ('cart_items' === $objRules->quantityMode) {
68
+              $intTotal = Isotope::getCart()->sumItemsQuantity();
69
+            } else {
70
+              $objItem = Isotope::getCart()->getItemForProduct($objSource->getRelated('pid'));
71
+              $intTotal = (null === $objItem) ? 0 : $objItem->quantity;
72
+            }
73
+
74
+            if (($objRules->minItemQuantity > 0 && $objRules->minItemQuantity > $intTotal) || $objRules->maxItemQuantity < $intTotal) {
75
+              continue;
76
+            }
77
+          }
78
+
79
+          // We're unable to apply variant price rules to low_price (see #3189)
80
+          if ('low_price' === $strField && 'variants' === $objRules->productRestrictions) {
81
+            continue;
82
+          }
83
+
84
+          if ($objRules->current()->isPercentage()) {
85
+            $fltDiscount = 100 + $objRules->current()->getPercentage();
86
+            $fltDiscount = round($fltPrice - ($fltPrice / 100 * $fltDiscount), 10);
87
+
88
+            $precision = Isotope::getConfig()->priceRoundPrecision;
89
+            $factor    = pow(10, 2);
90
+            $up        = $fltDiscount > 0 ? 'ceil' : 'floor';
91
+            $down      = $fltDiscount > 0 ? 'floor' : 'ceil';
92
+
93
+            switch ($objRules->rounding) {
94
+              case Rule::ROUND_NORMAL:
95
+                $fltDiscount = round($fltDiscount, $precision);
96
+                break;
97
+
98
+              case Rule::ROUND_UP:
99
+                $fltDiscount = $up($fltDiscount * $factor) / $factor;
100
+                break;
101
+
102
+              case Rule::ROUND_DOWN:
103
+              default:
104
+                $fltDiscount = $down($fltDiscount * $factor) / $factor;
105
+                break;
106
+            }
107
+
108
+            $fltPrice = $fltPrice - $fltDiscount;
109
+          } else {
110
+            $fltPrice = $fltPrice + $objRules->discount;
111
+          }
112
+        }
113
+      }
114
+    }
115
+
116
+    return $fltPrice;
117
+  }
118
+
119
+  /**
120
+   * Pattern for bulk image file import
121
+   *
122
+   * @param $arrPattern
123
+   * @param $objProducts
124
+   * @return array
125
+   */
126
+  public function addAssetImportRegexp($arrPattern, $objProducts)
127
+  {
128
+    $arrPattern[] = $objProducts->sku ? '[0]*'.$objProducts->sku : null;
129
+
130
+    return $arrPattern;
131
+  }
132
+
133
+  public function modifyAddressFields($arrFields, $objAddress, $objStep)
134
+  {
135
+    foreach ($arrFields as $fieldName=>$field)
136
+    {
137
+      if ($fieldName == 'dateOfBirth')
138
+      {
139
+        $arrFields[$fieldName]['dca']['eval']['rgxp'] = 'date_age16';
140
+      }
141
+    }
142
+    return $arrFields;
143
+  }
144
+
145
+  public function addCustomRegexp($strRegexp, &$varInput, \Widget $objWidget)
146
+  {
147
+    switch ($strRegexp)
148
+    {
149
+      case 'date_age16':
150
+        if (!\Validator::isDate($varInput))
151
+        {
152
+          $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], \Date::getInputFormat(\Date::getNumericDateFormat())));
153
+          return true;
154
+        }
155
+        else
156
+        {
157
+          // Validate the date (see #5086)
158
+          try
159
+          {
160
+            new \Date($varInput, \Date::getNumericDateFormat());
161
+          }
162
+          catch (\OutOfBoundsException $e)
163
+          {
164
+            $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varInput));
165
+          }
166
+
167
+          // Age >= 16
168
+          $Date = new \Date($varInput, \Date::getNumericDateFormat());
169
+          $MinDate = new \Date(mktime(0,0,0,idate('m'),idate('d'),(idate('Y')-16)));
170
+
171
+          if ($Date->tstamp > $MinDate->tstamp)
172
+          {
173
+            $objWidget->addError($GLOBALS['TL_LANG']['ERR']['date_age16']);
174
+            return true;
175
+          }
176
+
177
+        }
178
+        break;
179
+    }
180
+
181
+    return false;
182
+  }
183
+
184
+  public function getAttributesFromDca($arrAttributes, $objDca)
185
+  {
186
+    // modify $arrAttributes as needed
187
+    // Convert timestamps
188
+    if ($arrAttributes['value'] != '' && in_array($arrAttributes['rgxp'], array('date_age16')))
189
+    {
190
+      $objDate = new \Date($arrAttributes['value'], \Date::getFormatFromRgxp('date'));
191
+      $arrAttributes['value'] = $objDate->date;
192
+    }
193
+
194
+    return $arrAttributes;
195
+  }
196
+
197
+  /**
198
+   * Add cart rules to surcharges
199
+   */
200
+  public function findSurcharges(IsotopeProductCollection $objCollection)
201
+  {
202
+    $objCart = $objCollection;
203
+
204
+    // The checkout review pages shows an order, but we need the cart
205
+    // Only the cart contains coupons etc.
206
+    if ($objCollection instanceof Order) {
207
+      $objCart = $objCollection->getRelated('source_collection_id');
208
+    }
209
+
210
+    // Rules should only be applied to Cart, not any other product collection
211
+    if (!($objCart instanceof Cart)) {
212
+      return array();
213
+    }
214
+
215
+    $arrSurcharges = array();
216
+    $objRules = Rule::findForCart();
217
+
218
+    if (null !== $objRules) {
219
+      while ($objRules->next()) {
220
+        $objSurcharge = RuleSurcharge::createForRuleInCollection($objRules->current(), $objCollection);
221
+
222
+        if (null !== $objSurcharge) {
223
+          $arrSurcharges[] = $objSurcharge;
224
+        }
225
+      }
226
+    }
227
+
228
+    return $arrSurcharges;
229
+  }
230
+
231
+}
0 232
\ No newline at end of file
1 233
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['TL_LANG']['MSC']['cartNCheckout'] = 'Warenkorb &amp; Bestellen';
14
+$GLOBALS['TL_LANG']['MSC']['not_buyable_text'] = 'Dieses Produkt ist derzeit leider nicht bestellbar.';
15
+$GLOBALS['TL_LANG']['MSC']['not_buyable'] = 'derzeit leider ausgetrunken';
16
+
17
+
18
+$GLOBALS['TL_LANG']['ERR']['date_age16'] = 'Aus Jugendschutzgründen müssen Sie mindestens 16 Jahre alt sein.';
0 19
\ No newline at end of file
1 20
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+/**
4
+ * Tweaks for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_tweaks
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+/**
14
+ * Fields
15
+ */
16
+$GLOBALS['TL_LANG']['tl_content']['es_iso_hide_list'][0] = 'Ausblenden bei Produktansicht';
17
+$GLOBALS['TL_LANG']['tl_content']['es_iso_hide_list'][1] = 'Blendet das Element aus, wenn ein Isotope Produkt-Alias in der URL gefunden wird.';
0 18
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+<?php
2
+
3
+/**
4
+ * Custom extension for Isotope for Contao
5
+ *
6
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
7
+ *
8
+ * @package eSM_isotope_custom
9
+ * @link    http://www.esales-media.de
10
+ * @license commercial
11
+ */
12
+
13
+$GLOBALS['TL_LANG']['tl_iso_address']['postal'] = 'PLZ';
0 14
\ No newline at end of file
1 15
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * TeamList for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+$GLOBALS['TL_LANG']['tl_iso_product']['not_buyable'] = array('Nicht bestellbar','Der Artikel wird angezeigt, kann aber nicht bestellt werden.');
12
+$GLOBALS['TL_LANG']['tl_iso_product']['not_buyable_text'] = array('Nicht bestellbar Hinweistext','Ein optionaler Hinweistext, um den Kunden den Grund mitzuteilen, warum das Produkt nicht bestellbar ist.');
13
+$GLOBALS['TL_LANG']['tl_iso_product']['price_rrp'] = array('Preis UVP','Die UVP des Herstellers (Wird als Streichpreis angezeigt).');
14
+$GLOBALS['TL_LANG']['tl_iso_product']['product_of_month'] = array('Produkt des Monats','Wird als Produkt des Monats auf der Shop-Startseite angezeigt.');
15
+$GLOBALS['TL_LANG']['tl_iso_product']['search_keywords'] = array('Suche-Keywords','Automatisiert erstellte Keywords für die Suche nach diesem Produkt.');
0 16
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+<?php
2
+
3
+/**
4
+ * TeamList for Contao
5
+ *
6
+ * Copyright (c) 2016 Benjamin Roth
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+$GLOBALS['TL_LANG']['tl_iso_rule']['type']['affentaler'] = 'Affentaler';
12
+$GLOBALS['TL_LANG']['tl_iso_rule']['type']['special'] = 'Affentaler Handlingkosten';
0 13
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+<?php
2
+
3
+/**
4
+ * Isotope eCommerce for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2009-2016 terminal42 gmbh & Isotope eCommerce Workgroup
7
+ *
8
+ * @link       https://isotopeecommerce.org
9
+ * @license    https://opensource.org/licenses/lgpl-3.0.html
10
+ */
11
+
12
+namespace eSM_isotope_custom\Model;
13
+
14
+use Isotope\Interfaces\IsotopeProduct;
15
+use Isotope\Model\Rule;
16
+
17
+/**
18
+ * @property int    $id
19
+ * @property int    $tstamp
20
+ * @property string $type
21
+ * @property string $name
22
+ * @property string $label
23
+ * @property string $discount
24
+ * @property int    $tax_class
25
+ * @property string $applyTo
26
+ * @property string $rounding
27
+ * @property bool   $enableCode
28
+ * @property string $code
29
+ * @property int    $limitPerMember
30
+ * @property int    $limitPerConfig
31
+ * @property int    $minSubtotal
32
+ * @property int    $maxSubtotal
33
+ * @property string $minWeight
34
+ * @property string $maxWeight
35
+ * @property int    $minItemQuantity
36
+ * @property int    $maxItemQuantity
37
+ * @property string $quantityMode
38
+ * @property int    $startDate
39
+ * @property int    $endDate
40
+ * @property int    $startTime
41
+ * @property int    $endTime
42
+ * @property string $configRestrictions
43
+ * @property bool   $configCondition
44
+ * @property string $memberRestrictions
45
+ * @property bool   $memberCondition
46
+ * @property string $productRestrictions
47
+ * @property bool   $productCondition
48
+ * @property string $attributeName
49
+ * @property string $attributeCondition
50
+ * @property string $attributeValue
51
+ * @property bool   $enabled
52
+ */
53
+class AffentalerRule extends Rule
54
+{
55
+  public static function findByProduct(IsotopeProduct $objProduct, $strField, $fltPrice)
56
+  {
57
+      return static::findByConditions(array("type='affentaler'"), array(), array($objProduct), ($strField == 'low_price' ? true : false), array($strField => $fltPrice));
58
+  }
59
+
60
+  public static function findForCart($intId = null)
61
+  {
62
+    $arrProcedures = array("type='special'", "enableCode=''");
63
+
64
+    if (null === $intId) {
65
+      $arrProcedures[] = "groupOnly=''";
66
+    } else {
67
+      $arrProcedures[] = 'id='.(int)$intId;
68
+    }
69
+
70
+    return static::findByConditions($arrProcedures);
71
+  }
72
+}
0 73
new file mode 100644
... ...
@@ -0,0 +1,254 @@
1
+<?php
2
+
3
+/**
4
+ * Isotope eCommerce for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2009-2016 terminal42 gmbh & Isotope eCommerce Workgroup
7
+ *
8
+ * @link       https://isotopeecommerce.org
9
+ * @license    https://opensource.org/licenses/lgpl-3.0.html
10
+ */
11
+
12
+namespace eSM_isotope_custom\Model\ProductCollectionSurcharge;
13
+
14
+use Haste\Units\Mass\Weight;
15
+use Isotope\Interfaces\IsotopeProductCollection;
16
+use Isotope\Interfaces\IsotopeProductCollectionSurcharge;
17
+use Isotope\Isotope;
18
+use Isotope\Model\ProductCollectionSurcharge;
19
+use Isotope\Model\Rule as RuleModel;
20
+use Isotope\Model\ProductCollectionSurcharge\Rule;
21
+
22
+/**
23
+ * Class Payment
24
+ *
25
+ * Implements payment surcharge in product collection
26
+ * @copyright  Isotope eCommerce Workgroup 2009-2012
27
+ * @author     Andreas Schempp <andreas.schempp@terminal42.ch>
28
+ */
29
+class AffentalerRule extends ProductCollectionSurcharge implements IsotopeProductCollectionSurcharge
30
+{
31
+
32
+    public static function createForRuleInCollection(RuleModel $objRule, IsotopeProductCollection $objCollection)
33
+    {
34
+        // Cart subtotal
35
+        if (($objRule->minSubtotal > 0 && $objCollection->getSubtotal() < $objRule->minSubtotal) || ($objRule->maxSubtotal > 0 && $objCollection->getSubtotal() > $objRule->maxSubtotal)) {
36
+            return null;
37
+        }
38
+
39
+        // Cart weight
40
+        $objScale = Isotope::getCart()->addToScale();
41
+
42
+        if (($minWeight = Weight::createFromTimePeriod($objRule->minWeight)) !== null
43
+            && $objScale->isLessThan($minWeight)
44
+        ) {
45
+            return null;
46
+        }
47
+
48
+        if (($maxWeight = Weight::createFromTimePeriod($objRule->maxWeight)) !== null
49
+            && $objScale->isMoreThan($maxWeight)
50
+        ) {
51
+            return null;
52
+        }
53
+
54
+        $arrCollectionItems = $objCollection->getItems();
55
+
56
+        $blnMatch      = false;
57
+        $blnPercentage = $objRule->isPercentage();
58
+        $fltDiscount   = $blnPercentage ? $objRule->getPercentage() : 0;
59
+        $fltTotal      = 0;
60
+        $arrSubtract   = array();
61
+
62
+        $objSurcharge = new static();
63
+        $objSurcharge->label = $objRule->getLabel();
64
+        $objSurcharge->price = $objRule->getPercentageLabel();
65
+        $objSurcharge->total_price = 0;
66
+        $objSurcharge->tax_class = 0;
67
+        $objSurcharge->before_tax = true;
68
+        $objSurcharge->addToTotal = true;
69
+
70
+        // Product or producttype restrictions
71
+        if ($objRule->productRestrictions != '' && $objRule->productRestrictions != 'none') {
72
+            $arrLimit = \Database::getInstance()->execute("SELECT object_id FROM tl_iso_rule_restriction WHERE pid={$objRule->id} AND type='{$objRule->productRestrictions}'")->fetchEach('object_id');
73
+
74
+            if ($objRule->productRestrictions == 'pages' && !empty($arrLimit)) {
75
+                $arrLimit = \Database::getInstance()->execute("SELECT pid FROM " . \Isotope\Model\ProductCategory::getTable() . " WHERE page_id IN (" . implode(',', $arrLimit) . ")")->fetchEach('pid');
76
+            }
77
+
78
+            if ($objRule->quantityMode == 'cart_products' || $objRule->quantityMode == 'cart_items') {
79
+                $intTotal = 0;
80
+                foreach ($arrCollectionItems as $objItem) {
81
+                    if (!$objItem->hasProduct()) {
82
+                        continue;
83
+                    }
84
+
85
+                    $objProduct = $objItem->getProduct();
86
+
87
+                    if ((($objRule->productRestrictions == 'products' || $objRule->productRestrictions == 'variants' || $objRule->productRestrictions == 'pages')
88
+                            && (in_array($objProduct->id, $arrLimit) || ($objProduct->pid > 0 && in_array($objProduct->pid, $arrLimit))))
89
+                        || ($objRule->productRestrictions == 'producttypes' && in_array($objProduct->type, $arrLimit))
90
+                    ) {
91
+                        $intTotal += $objRule->quantityMode == 'cart_items' ? $objItem->quantity : 1;
92
+                    }
93
+                }
94
+            }
95
+        } else {
96
+            switch ($objRule->quantityMode) {
97
+                case 'cart_products':
98
+                    $intTotal = $objCollection->countItems();
99
+                    break;
100
+
101
+                case 'cart_items':
102
+                    $intTotal = $objCollection->sumItemsQuantity();
103
+                    break;
104
+            }
105
+        }
106
+
107
+        $intSubstitute = (($objRule->minItemQuantity-1) > 0 ? ($objRule->minItemQuantity-1) : 0);
108
+        foreach ($arrCollectionItems as $objItem) {
109
+            if (!$objItem->hasProduct()) {
110
+                continue;
111
+            }
112
+
113
+            $objProduct = $objItem->getProduct();
114
+
115
+            // Product restrictions
116
+            if ((($objRule->productRestrictions == 'products' || $objRule->productRestrictions == 'variants' || $objRule->productRestrictions == 'pages')
117
+                    && (!in_array($objProduct->id, $arrLimit) && ($objProduct->pid == 0 || !in_array($objProduct->pid, $arrLimit))))
118
+                || ($objRule->productRestrictions == 'producttypes' && !in_array($objProduct->type, $arrLimit))
119
+            ) {
120
+                continue;
121
+            } elseif ($objRule->productRestrictions == 'attribute') {
122
+                switch ($objRule->attributeCondition) {
123
+                    case 'eq':
124
+                        if (!($objProduct->{$objRule->attributeName} == $objRule->attributeValue)) {
125
+                            continue(2);
126
+                        }
127
+                        break;
128
+
129
+                    case 'neq':
130
+                        if (!($objProduct->{$objRule->attributeName} != $objRule->attributeValue)) {
131
+                            continue(2);
132
+                        }
133
+                        break;
134
+
135
+                    case 'lt':
136
+                        if (!($objProduct->{$objRule->attributeName} < $objRule->attributeValue)) {
137
+                            continue(2);
138
+                        }
139
+                        break;
140
+
141
+                    case 'gt':
142
+                        if (!($objProduct->{$objRule->attributeName} > $objRule->attributeValue)) {
143
+                            continue(2);
144
+                        }
145
+                        break;
146
+
147
+                    case 'elt':
148
+                        if (!($objProduct->{$objRule->attributeName} <= $objRule->attributeValue)) {
149
+                            continue(2);
150
+                        }
151
+                        break;
152
+
153
+                    case 'egt':
154
+                        if (!($objProduct->{$objRule->attributeName} >= $objRule->attributeValue)) {
155
+                            continue(2);
156
+                        }
157
+                        break;
158
+
159
+                    case 'starts':
160
+                        if (stripos($objProduct->{$objRule->attributeName}, $objRule->attributeValue) !== 0) {
161
+                            continue(2);
162
+                        }
163
+                        break;
164
+
165
+                    case 'ends':
166
+                        if (strripos($objProduct->{$objRule->attributeName}, $objRule->attributeValue) !== (strlen($objProduct->{$objRule->attributeName}) - strlen($objRule->attributeValue))) {
167
+                            continue(2);
168
+                        }
169
+                        break;
170
+
171
+                    case 'contains':
172
+                        if (stripos($objProduct->{$objRule->attributeName}, $objRule->attributeValue) === false) {
173
+                            continue(2);
174
+                        }
175
+                        break;
176
+
177
+                    default:
178
+                        throw new \Exception('Unknown rule condition "' . $objRule->attributeCondition . '"');
179
+                }
180
+            }
181
+
182
+            // Because we apply to the quantity of only this product, we override $intTotal in every foreach loop
183
+            // This matches tl_iso_rules.quantityMode="product_quantity"
184
+            if ($objRule->quantityMode != 'cart_products' && $objRule->quantityMode != 'cart_items') {
185
+                $intTotal = $objItem->quantity;
186
+            }
187
+
188
+            // Quantity does not match, do not apply to this product
189
+            if (($objRule->minItemQuantity > 0 && $objRule->minItemQuantity > $intTotal) || ($objRule->maxItemQuantity > 0 && $objRule->maxItemQuantity < $intTotal)) {
190
+                continue;
191
+            }
192
+
193
+            // Apply To
194
+            switch ($objRule->applyTo) {
195
+                case 'products':
196
+                    $fltPrice = $blnPercentage ? ($objItem->getTotalPrice() / 100 * $fltDiscount) : $objRule->discount;
197
+                    $fltPrice = $fltPrice > 0 ? (floor($fltPrice * 100) / 100) : (ceil($fltPrice * 100) / 100);
198
+                    $objSurcharge->total_price += $fltPrice;
199
+                    $objSurcharge->setAmountForCollectionItem($fltPrice, $objItem);
200
+                    break;
201
+
202
+                case 'items':
203
+                    if ($intSubstitute - $objItem->quantity > 0)
204
+                    {
205
+                      $intItemSubstitute = $objItem->quantity;
206
+                    } else if ($intSubstitute > 0) {
207
+                      $intItemSubstitute = $intSubstitute;
208
+                    } else {
209
+                      $intItemSubstitute = 0;
210
+                    }
211
+                    $intSubstitute = $intSubstitute - $objItem->quantity;
212
+
213
+                    $fltPrice = ($blnPercentage ? ($objItem->getPrice() / 100 * $fltDiscount) : $objRule->discount) * ($objItem->quantity-$intItemSubstitute);
214
+                    $fltPrice = $fltPrice > 0 ? (floor($fltPrice * 100) / 100) : (ceil($fltPrice * 100) / 100);
215
+                    $objSurcharge->total_price += $fltPrice;
216
+                    $objSurcharge->setAmountForCollectionItem($fltPrice, $objItem);
217
+                    break;
218
+
219
+                case 'subtotal':
220
+                    $blnMatch = true;
221
+                    $objSurcharge->total_price += $objItem->getTotalPrice();
222
+
223
+                    if ($objRule->tax_class == -1) {
224
+                        if ($blnPercentage) {
225
+                            $fltPrice = $objItem->getTotalPrice() / 100 * $fltDiscount;
226
+                            $objSurcharge->setAmountForCollectionItem($fltPrice, $objItem);
227
+                        } else {
228
+                            $arrSubtract[] = $objItem;
229
+                            $fltTotal += (float) $objItem->getTaxFreeTotalPrice();
230
+                        }
231
+                    }
232
+                    break;
233
+            }
234
+        }
235
+
236
+        if ($objRule->applyTo == 'subtotal' && $blnMatch) {
237
+            // discount total! not related to tax subtraction
238
+            $fltPrice = $blnPercentage ? ($objSurcharge->total_price / 100 * $fltDiscount) : $objRule->discount;
239
+            $objSurcharge->total_price = $fltPrice > 0 ? (floor(round($fltPrice * 100, 4)) / 100) : (ceil(round($fltPrice * 100, 4)) / 100);
240
+            $objSurcharge->before_tax = ($objRule->tax_class != 0 ? true : false);
241
+            $objSurcharge->tax_class = ($objRule->tax_class > 0 ? $objRule->tax_class : 0);
242
+
243
+            // If fixed price discount with splitted taxes, calculate total amount of discount per taxed product
244
+            if ($objRule->tax_class == -1 && !$blnPercentage) {
245
+                foreach ($arrSubtract as $objItem) {
246
+                    $fltPrice = $objRule->discount / 100 * (100 / $fltTotal * $objItem->getTaxFreeTotalPrice());
247
+                    $objSurcharge->setAmountForCollectionItem($fltPrice, $objItem);
248
+                }
249
+            }
250
+        }
251
+
252
+        return $objSurcharge->total_price == 0 ? null : $objSurcharge;
253
+    }
254
+}
0 255
new file mode 100644
... ...
@@ -0,0 +1,63 @@
1
+<?php
2
+
3
+/**
4
+ * Isotope eCommerce for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
7
+ *
8
+ * @package    Isotope
9
+ * @link       http://isotopeecommerce.org
10
+ * @license    http://opensource.org/licenses/lgpl-3.0.html
11
+ */
12
+
13
+namespace eSM_isotope_custom\Model;
14
+
15
+use Haste\Util\Url;
16
+
17
+/**
18
+ * Standard implementation of an Isotope product.
19
+ */
20
+class Standard extends \Isotope\Model\Product\Standard
21
+{
22
+  /**
23
+   * Generate url
24
+   *
25
+   * @param \PageModel $objJumpTo A PageModel instance
26
+   *
27
+   * @return string
28
+   *
29
+   * @throws \InvalidArgumentException
30
+   */
31
+  public function generateUrl(\PageModel $objJumpTo = null)
32
+  {
33
+    $strUrl = parent::generateUrl($objJumpTo);
34
+
35
+    if (\Input::get('isorc') !== null)
36
+    {
37
+      $strUrl = Url::addQueryString(
38
+        http_build_query(array('isorc' => \Input::get('isorc'))),
39
+        $strUrl
40
+      );
41
+    }
42
+    return $strUrl;
43
+  }
44
+
45
+  public function generate(array $arrConfig)
46
+  {
47
+
48
+    $arrButtons = array();
49
+    foreach ($arrConfig['buttons'] as $button)
50
+    {
51
+      if ($button == 'add_to_cart' && $this->not_buyable)
52
+      {
53
+        continue;
54
+      }
55
+      $arrButtons[] = $button;
56
+    }
57
+    $arrConfig['buttons'] = $arrButtons;
58
+
59
+    return parent::generate($arrConfig);
60
+  }
61
+
62
+
63
+}
0 64
new file mode 100644
... ...
@@ -0,0 +1,37 @@
1
+<?php
2
+
3
+/**
4
+ * viabook platform for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2012-2013 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
+namespace eSM_isotope_custom\Module;
16
+
17
+use Isotope\Isotope;
18
+
19
+class CumulativeFilter extends \Isotope\Module\CumulativeFilter
20
+{
21
+  protected function compile()
22
+  {
23
+    parent::compile();
24
+    $objCache = Isotope::getRequestCache();
25
+    $this->Template->iso_rc_id = $objCache->id;
26
+  }
27
+
28
+  protected function generateOptionItem($attribute, $label, $value, $matchCount, $isActive, array $option = [])
29
+  {
30
+    $arrOption = parent::generateOptionItem($attribute, $label, $value, $matchCount, $isActive);
31
+    $arrOption['value'] = base64_encode($this->id . ';' . ($isActive ? 'del' : 'add') . ';' . $attribute . ';' . $value);
32
+    $arrOption['attribute'] = $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$attribute]['label'][0];
33
+    return $arrOption;
34
+  }
35
+
36
+
37
+}
0 38
\ No newline at end of file
1 39
new file mode 100644
... ...
@@ -0,0 +1,436 @@
1
+<?php
2
+
3
+/**
4
+ * viabook platform for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2012-2013 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
+namespace eSM_isotope_custom\Pdf;
16
+
17
+use Isotope\Model\Product;
18
+use Isotope\Interfaces\IsotopeProduct;
19
+use Isotope\Interfaces\IsotopeAttribute;
20
+use Isotope\Model\Gallery;
21
+
22
+
23
+class ModuleExpertisePdf extends \Module
24
+{
25
+
26
+    /**
27
+     * Template
28
+     * @var String
29
+     */
30
+    protected $strTemplate = '';
31
+
32
+    /**
33
+     * Product model
34
+     * @var IsotopeProduct|null
35
+     */
36
+    protected $objProduct = null;
37
+
38
+    /**
39
+     * @return string
40
+     */
41
+    public function generate()
42
+    {
43
+        global $objPage;
44
+
45
+        if (TL_MODE == 'BE')
46
+        {
47
+            /** @var \BackendTemplate|object $objTemplate */
48
+            $objTemplate = new \BackendTemplate('be_wildcard');
49
+
50
+            $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['expertisePDF'][0]) . ' ###';
51
+            $objTemplate->title = $this->headline;
52
+            $objTemplate->id = $this->id;
53
+            $objTemplate->link = $this->name;
54
+            $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
55
+
56
+            return $objTemplate->parse();
57
+        }
58
+
59
+        $strBuffer = parent::generate();
60
+
61
+        if (empty($strBuffer))
62
+        {
63
+            return '';
64
+        }
65
+
66
+
67
+        return $strBuffer;
68
+    }
69
+
70
+    /**
71
+     * Compile the current element
72
+     */
73
+    protected function compile()
74
+    {
75
+        global $objPage;
76
+
77
+        // Set the item from the auto_item parameter
78
+        if ($GLOBALS['TL_CONFIG']['useAutoItem'] && in_array('product', $GLOBALS['TL_AUTO_ITEM']))
79
+        {
80
+            \Input::setGet('product', \Input::get('auto_item'));
81
+        }
82
+
83
+
84
+        // Stop if no expertise should be generated
85
+        if (!isset($_GET['expertisePdf']) || !\Input::get('product'))
86
+        {
87
+            return;
88
+        }
89
+
90
+
91
+        // Load product model
92
+        $objProduct = Product::findAvailableByIdOrAlias(\Input::get('product'));
93
+
94
+        if (null === $objProduct)
95
+        {
96
+            return;
97
+        }
98
+
99
+        $this->objProduct = $objProduct;
100
+
101
+        $this->createPdf();
102
+
103
+    }
104
+
105
+    protected function createPdf()
106
+    {
107
+        // Load language file
108
+        \System::loadLanguageFile('ExpertisePdf');
109
+
110
+        // Print date
111
+        $objTime = new \Date();
112
+
113
+        // Instantiate PDF
114
+        if (!empty($this->classname))
115
+        {
116
+          $PDF = new ExpertisePdf($this->classname);
117
+        } else {
118
+          $PDF = new ExpertisePdf();
119
+        }
120
+
121
+        // Baseprice
122
+        $Baseprice = deserialize($this->objProduct->baseprice,true);
123
+
124
+        // Gallery
125
+        $GalleryFiles = Gallery::createForProductAttribute($this->objProduct,'images',array('gallery'=>1))->getFiles();
126
+
127
+        /*** Page 1 ***/
128
+        // Datum
129
+        $intLabelLength = 35;
130
+        $intValOffset = 40;
131
+        $intValLength = 70;
132
+        $intBoxContentLength = $intValOffset+$intValLength;
133
+        $intContentLength = 115;
134
+        $intLabelFontSize = 10;
135
+        $intValueFontSize = 11;
136
+        $intContentFontSize = 12;
137
+        $intHeadlineFontSize = 14;
138
+        $margins = $PDF->pdf->getMargins();
139
+
140
+
141
+        $PDF->pdf->SetFont(PDF_FONT_NAME_MAIN);
142
+        $PDF->pdf->SetTextColor(86,85,79,100);
143
+
144
+        switch($this->objProduct->type)
145
+        {
146
+            case 1:
147
+            case 2:
148
+
149
+                if (is_array($GalleryFiles) && count($GalleryFiles))
150
+                {
151
+                    $strFile = $GalleryFiles[0]['src'];
152
+                    if (strpos($strFile, '/') === false) {
153
+                        $strFile = 'isotope/' . strtolower(substr($strFile, 0, 1)) . '/' . $strFile;
154
+                    }
155
+//                    $PDF->pdf->Image(TL_ROOT . '/'.$strFile, $margins['left'], $margins['top'],40,185,'PNG','','T',true,300,'',false,false,0,true);
156
+                    $PDF->pdf->Image(TL_ROOT . '/'.$strFile, $margins['left'], $margins['top']+5,40,160,'','','T',true,150,'',false,false,0,true);
157
+                }
158
+
159
+                $PDF->pdf->SetTextColor(17,40,70,0);
160
+                $PDF->pdf->SetTextColor(193,102,21);
161
+                $PDF->pdf->SetCellHeightRatio(1.25);
162
+                $PDF->pdf->SetXY($margins['left']+65,$margins['top']);
163
+                /*$PDF->pdf->CreateCell(8,0,'',0,25,'','L',PDF_FONT_NAME_ICON);
164
+                $PDF->pdf->setX($margins['left']+65+8);*/
165
+                $PDF->pdf->CreateMultiCell($intContentLength,0,$this->generateAttribute('name').($this->generateAttribute('jahrgang') ? " ".$this->generateAttribute('jahrgang') : ''),0,25,'','L',PDF_FONT_NAME_MAIN);
166
+                if ($this->generateAttribute('qualitaet') || $this->generateAttribute('geschmack') || $this->generateAttribute('flascheninhalt'))
167
+                {
168
+                  $PDF->pdf->lbr(1);
169
+//                  $PDF->pdf->SetX($margins['left']+65+8);
170
+                  $PDF->pdf->SetX($margins['left']+65);
171
+                  $PDF->pdf->CreateMultiCell($intContentLength,0,($this->generateAttribute('qualitaet') ? $this->generateAttribute('qualitaet')." " : '').($this->generateAttribute('geschmack') ? $this->generateAttribute('geschmack')." " : '').rtrim(rtrim(\System::getFormattedNumber($this->generateAttribute('flascheninhalt'),3),'0'),',').' l',0,17,'','L',PDF_FONT_NAME_MAIN);
172
+                }
173
+                if ($this->generateAttribute('zusatz'))
174
+                {
175
+                  $PDF->pdf->lbr(1);
176
+                  //                  $PDF->pdf->SetX($margins['left']+65+8);
177
+                  $PDF->pdf->SetX($margins['left']+65);
178
+                  $PDF->pdf->CreateMultiCell($intContentLength,0,$this->generateAttribute('zusatz'),0,$intHeadlineFontSize,'','L',PDF_FONT_NAME_MAIN);
179
+                }
180
+                $PDF->pdf->lbr(3);
181
+
182
+                $PDF->pdf->SetTextColor(17,40,70,0);
183
+                $PDF->pdf->SetTextColor(193,102,21);
184
+                $PDF->pdf->setX($margins['left']+65);
185
+                $PDF->pdf->CreateCell($intContentLength,0,'Charakteristik',1,$intHeadlineFontSize,'');
186
+                $PDF->pdf->SetTextColor(86,85,79,100);
187
+                $PDF->pdf->setX($margins['left']+65);
188
+                $PDF->pdf->CreateMultiCell($intContentLength,0,preg_replace('/\s+$/','',ucfirst(strip_tags($PDF->pdf->unhtmlentities(\StringUtil::restoreBasicEntities(str_ireplace(['<br>','<br />'],["\n","\n"],$this->generateAttribute('charakteristik'))))))."\n"),0,$intContentFontSize,'','L',PDF_FONT_NAME_DATA);
189
+                $PDF->pdf->lbr(2);
190
+
191
+                if ($this->objProduct->besonderheit) {
192
+                  $PDF->pdf->SetTextColor(17,40,70,0);
193
+                  $PDF->pdf->SetTextColor(193,102,21);
194
+                  $PDF->pdf->setX($margins['left']+65);
195
+                  $PDF->pdf->CreateCell($intContentLength,0,'Besonderheit',1,$intHeadlineFontSize,'');
196
+                  $PDF->pdf->SetTextColor(86,85,79,100);
197
+                  $PDF->pdf->setX($margins['left']+65);
198
+                  $PDF->pdf->CreateMultiCell($intContentLength,0,ucfirst(strip_tags($PDF->pdf->unhtmlentities(\StringUtil::restoreBasicEntities($this->generateAttribute('besonderheit')))))."\n",0,$intContentFontSize,'','L',PDF_FONT_NAME_DATA);
199
+                  $PDF->pdf->lbr(2);
200
+                }
201
+
202
+                if ($this->objProduct->speiseempfehlung) {
203
+                  $PDF->pdf->SetTextColor(17,40,70,0);
204
+                  $PDF->pdf->SetTextColor(193,102,21);
205
+                  $PDF->pdf->setX($margins['left']+65);
206
+                  $PDF->pdf->CreateCell($intContentLength,0,'Speiseempfehlung',1,$intHeadlineFontSize,'');
207
+                  $PDF->pdf->SetTextColor(86,85,79,100);
208
+                  $PDF->pdf->setX($margins['left']+65);
209
+                  $PDF->pdf->CreateMultiCell($intContentLength,0,ucfirst(strip_tags($PDF->pdf->unhtmlentities(\StringUtil::restoreBasicEntities($this->generateAttribute('speiseempfehlung')))))."\n",0,$intContentFontSize,'','L',PDF_FONT_NAME_DATA);
210
+                  $PDF->pdf->lbr(2);
211
+                }
212
+
213
+                /*if ($this->objProduct->trinktemperatur)
214
+                {
215
+                  $PDF->pdf->SetTextColor(17,40,70,0);
216
+                  $PDF->pdf->SetTextColor(193,102,21);
217
+                  $PDF->pdf->setX($margins['left']+65);
218
+                  $PDF->pdf->CreateCell($intContentLength, 0, 'Empfohlene Trinktemperatur:', 1, $intHeadlineFontSize, '');
219
+                  $PDF->pdf->SetTextColor(86, 85, 79, 100);
220
+                  $PDF->pdf->setX($margins['left']+65);
221
+                  $PDF->pdf->CreateMultiCell($intContentLength, 0, ucfirst(strip_tags($PDF->pdf->unhtmlentities($this->generateAttribute('trinktemperatur'))))." °C", 0, $intContentFontSize, '', 'L', PDF_FONT_NAME_DATA);
222
+                  $PDF->pdf->lbr(2);
223
+                }*/
224
+
225
+                $PDF->pdf->lbr(2);
226
+                $PDF->pdf->SetFont(PDF_FONT_NAME_DATA,'',PDF_FONT_SIZE_DATA);
227
+                $PDF->pdf->SetTextColor(86,85,79,100);
228
+                $PDF->pdf->SetCellHeightRatio(1.3);
229
+
230
+                $box_Y1 = $PDF->pdf->GetY();
231
+                $PDF->pdf2 = clone $PDF->pdf;
232
+                $PDF->pdf2->setPrintHeader(false);
233
+                $PDF->pdf2->setPrintFooter(false);
234
+                $strClone = 'pdf2';
235
+
236
+                for ($i=2; $i > 0; $i--)
237
+                {
238
+
239
+                  if ($this->objProduct->alkohol) {
240
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
241
+                    $PDF->$strClone->SetTextColor(193,102,21);
242
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
243
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Alkohol', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
244
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
245
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
246
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, \System::getFormattedNumber($this->generateAttribute('alkohol'),1).' Vol. %', 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
247
+                    $PDF->$strClone->lbr(1.3);
248
+                  }
249
+
250
+                  if ($this->objProduct->restsuesse) {
251
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
252
+                    $PDF->$strClone->SetTextColor(193,102,21);
253
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
254
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Restsüße', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
255
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
256
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
257
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, \System::getFormattedNumber($this->generateAttribute('restsuesse'),1).' g/Ltr.', 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
258
+                    $PDF->$strClone->lbr(1.3);
259
+                  }
260
+
261
+                  if ($this->objProduct->saeure) {
262
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
263
+                    $PDF->$strClone->SetTextColor(193,102,21);
264
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
265
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Säure', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
266
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
267
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
268
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, \System::getFormattedNumber($this->generateAttribute('saeure'),1).' g/Ltr.', 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
269
+                    $PDF->$strClone->lbr(1.3);
270
+                  }
271
+
272
+                  /*
273
+                  if ($this->objProduct->jahrgang) {
274
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
275
+                    $PDF->$strClone->SetTextColor(193,102,21);
276
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
277
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Jahrgang:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
278
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
279
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
280
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('jahrgang'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
281
+                    $PDF->$strClone->lbr(1);
282
+                  }
283
+
284
+                  if ($this->objProduct->qualitaet) {
285
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
286
+                    $PDF->$strClone->SetTextColor(193,102,21);
287
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
288
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Qualitätsstufe:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
289
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
290
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
291
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('qualitaet'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
292
+                    $PDF->$strClone->lbr(1);
293
+                  }
294
+
295
+                  if ($this->objProduct->geschmack) {
296
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
297
+                    $PDF->$strClone->SetTextColor(193,102,21);
298
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
299
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Geschmack:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
300
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
301
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
302
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('geschmack'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
303
+                    $PDF->$strClone->lbr(1);
304
+                  }
305
+                  */
306
+                  if ($this->objProduct->rebsorte) {
307
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
308
+                    $PDF->$strClone->SetTextColor(193,102,21);
309
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
310
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Rebsorte', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
311
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
312
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
313
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('rebsorte'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
314
+                    $PDF->$strClone->lbr(1.3);
315
+                  }
316
+
317
+                  /*if ($Baseprice['value']) {
318
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
319
+                    $PDF->$strClone->SetTextColor(193,102,21);
320
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
321
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Inhalt:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
322
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
323
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
324
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, rtrim(rtrim(\System::getFormattedNumber($Baseprice['value'],3),'0'),',').(in_array($this->objProduct->type,array(1,3)) ? ' l' : ''), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
325
+                    $PDF->$strClone->lbr(1);
326
+                  }*/
327
+
328
+                  if ($this->objProduct->lagerfaehigkeit) {
329
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
330
+                    $PDF->$strClone->SetTextColor(193,102,21);
331
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
332
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Lagerfähigkeit', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
333
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
334
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
335
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('lagerfaehigkeit').' Jahre', 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
336
+                    $PDF->$strClone->lbr(1.3);
337
+                  }
338
+
339
+                  if ($this->objProduct->trinktemperatur)
340
+                  {
341
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
342
+                    $PDF->$strClone->SetTextColor(193,102,21);
343
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
344
+                    $PDF->$strClone->CreateMultiCell($intLabelLength, 0, 'Empfohlene Trinktemperatur', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
345
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
346
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
347
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, ucfirst(strip_tags($PDF->pdf->unhtmlentities($this->generateAttribute('trinktemperatur'))))." °C", 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
348
+                    $PDF->$strClone->lbr(1);
349
+                  }
350
+
351
+                  if ($this->objProduct->praemierungen) {
352
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
353
+                    $PDF->$strClone->SetTextColor(193,102,21);
354
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
355
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Prämierung', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
356
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
357
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
358
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('praemierungen'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
359
+                    $PDF->$strClone->lbr(1.3);
360
+                  }
361
+
362
+                  /*if ($this->objProduct->sku) {
363
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
364
+                    $PDF->$strClone->SetTextColor(193,102,21);
365
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
366
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'Artikelnummer:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
367
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
368
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
369
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('sku'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
370
+                    $PDF->$strClone->lbr(1);
371
+                  }
372
+
373
+                  if ($this->objProduct->ean) {
374
+                    $PDF->$strClone->SetTextColor(17,40,70,0);
375
+                    $PDF->$strClone->SetTextColor(193,102,21);
376
+                    $PDF->$strClone->SetX($margins['left']+65+2.5);
377
+                    $PDF->$strClone->CreateCell($intLabelLength, 0, 'EAN:', 0, $intValueFontSize, 'B','L',PDF_FONT_NAME_DATA);
378
+                    $PDF->$strClone->SetX($intValOffset + $margins['left']+65+2.5);
379
+                    $PDF->$strClone->SetTextColor(86,85,79,100);
380
+                    $PDF->$strClone->CreateMultiCell($intValLength, 0, $this->generateAttribute('ean'), 0, $intValueFontSize, '', 'L', PDF_FONT_NAME_DATA);
381
+                    $PDF->$strClone->lbr(1);
382
+                  }*/
383
+
384
+                  $box_Y2 = $PDF->$strClone->GetY();
385
+
386
+                  $strClone = 'pdf';
387
+
388
+                  if ($i == 2)
389
+                  {
390
+                    $PDF->pdf->Rect($margins['left']+65, $box_Y1-2, $intContentLength, $box_Y2 - $box_Y1+4, 'F',array('all'=>array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(193,102,21))), array(234,236,237));
391
+                    //$PDF->pdf->RoundedRect($margins['left']+55, $box_Y1-2, $intBoxContentLength+5, $box_Y2 - $box_Y1+4, 4.0, '0101','F',array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 1, 'color' => array(35,52,75,13)), array(13, 26, 51, 0));
392
+                    //$PDF->pdf->RoundedRect($margins['left'], $box_Y1-2, $intBoxContentLength+5, $box_Y2 - $box_Y1+4, 4.0, '0101','F',array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 1, 'color' => array(35,52,75,13)), array(80, 38, 100, 32));
393
+                  }
394
+                }
395
+
396
+          unset($PDF->pdf2);
397
+                $PDF->pdf->lbr(2);
398
+
399
+
400
+            break;
401
+        }
402
+
403
+
404
+
405
+        // Generate PDF
406
+        $PDF->documentFilename = $this->objProduct->sku.'_'.standardize($this->objProduct->name).'_'.$objTime->parse("Y-m-d").".pdf";
407
+
408
+        $PDF->generate();
409
+
410
+        // Stop script execution
411
+        exit;
412
+    }
413
+
414
+    protected function generateAttribute($strAttribute, $blnStripTags = false, array $arrOptions = array()) {
415
+
416
+        $objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strAttribute];
417
+
418
+        if (!($objAttribute instanceof IsotopeAttribute)) {
419
+            throw new \InvalidArgumentException($strAttribute . ' is not a valid attribute');
420
+        }
421
+
422
+        $strBuffer = $objAttribute->generate($this->objProduct, $arrOptions);
423
+
424
+        if ($blnStripTags)
425
+        {
426
+            $strBuffer = strip_tags($strBuffer,'<br><br /><br/></p></ p>');
427
+            $strBuffer = str_ireplace(array('<br />','<br>','<br/>'),"\n",$strBuffer);
428
+            $strBuffer = str_ireplace(array('</p>','</ p>'),"\n",$strBuffer);
429
+            $strBuffer = preg_replace('/(\r\n|\n)$/','',$strBuffer);
430
+        }
431
+
432
+        return $strBuffer;
433
+    }
434
+
435
+
436
+}
0 437
\ No newline at end of file