Passed
Push — 1.7 ( 23cbb7...8df8a8 )
by Greg
08:15
created
app/Report/ReportPdfLine.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@
 block discarded – undo
19 19
  * Class ReportPdfLine
20 20
  */
21 21
 class ReportPdfLine extends ReportBaseLine {
22
-	/**
23
-	 * PDF line renderer
24
-	 *
25
-	 * @param ReportTcpdf $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		if ($this->x1 == ".") {
29
-			$this->x1 = $renderer->GetX();
30
-		}
31
-		if ($this->y1 == ".") {
32
-			$this->y1 = $renderer->GetY();
33
-		}
34
-		if ($this->x2 == ".") {
35
-			$this->x2 = $renderer->getMaxLineWidth();
36
-		}
37
-		if ($this->y2 == ".") {
38
-			$this->y2 = $renderer->GetY();
39
-		}
40
-		if ($renderer->getRTL()) {
41
-			$renderer->Line($renderer->getPageWidth() - $this->x1, $this->y1, $renderer->getPageWidth() - $this->x2, $this->y2);
42
-		} else {
43
-			$renderer->Line($this->x1, $this->y1, $this->x2, $this->y2);
44
-		}
45
-	}
22
+    /**
23
+     * PDF line renderer
24
+     *
25
+     * @param ReportTcpdf $renderer
26
+     */
27
+    public function render($renderer) {
28
+        if ($this->x1 == ".") {
29
+            $this->x1 = $renderer->GetX();
30
+        }
31
+        if ($this->y1 == ".") {
32
+            $this->y1 = $renderer->GetY();
33
+        }
34
+        if ($this->x2 == ".") {
35
+            $this->x2 = $renderer->getMaxLineWidth();
36
+        }
37
+        if ($this->y2 == ".") {
38
+            $this->y2 = $renderer->GetY();
39
+        }
40
+        if ($renderer->getRTL()) {
41
+            $renderer->Line($renderer->getPageWidth() - $this->x1, $this->y1, $renderer->getPageWidth() - $this->x2, $this->y2);
42
+        } else {
43
+            $renderer->Line($this->x1, $this->y1, $this->x2, $this->y2);
44
+        }
45
+    }
46 46
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@
 block discarded – undo
18 18
 /**
19 19
  * Class ReportPdfLine
20 20
  */
21
-class ReportPdfLine extends ReportBaseLine {
21
+class ReportPdfLine extends ReportBaseLine
22
+{
22 23
 	/**
23 24
 	 * PDF line renderer
24 25
 	 *
25 26
 	 * @param ReportTcpdf $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		if ($this->x1 == ".") {
29 31
 			$this->x1 = $renderer->GetX();
30 32
 		}
Please login to merge, or discard this patch.
app/Report/ReportBase.php 3 patches
Indentation   +451 added lines, -451 removed lines patch added patch discarded remove patch
@@ -21,455 +21,455 @@
 block discarded – undo
21 21
  * Class ReportBase
22 22
  */
23 23
 class ReportBase {
24
-	/** User measure unit. */
25
-	const UNITS = 'pt';
26
-
27
-	/** webtrees URL */
28
-	const WT_URL = WT_WEBTREES_URL;
29
-
30
-	/** @var float Left Margin (expressed in points) Default: 17.99 mm, 0.7083 inch */
31
-	public $leftmargin = 51.0;
32
-
33
-	/** @var float Right Margin (expressed in points) Default: 9.87 mm, 0.389 inch */
34
-	public $rightmargin = 28.0;
35
-
36
-	/** @var float Top Margin (expressed in points) Default: 26.81 mm */
37
-	public $topmargin = 76.0;
38
-
39
-	/** @var float Bottom Margin (expressed in points) Default: 21.6 mm */
40
-	public $bottommargin = 60.0;
41
-
42
-	/** @var float Header Margin (expressed in points) Default: 4.93 mm */
43
-	public $headermargin = 14.0;
44
-
45
-	/** @var float Footer Margin (expressed in points) Default: 9.88 mm, 0.389 inch */
46
-	public $footermargin = 28.0;
47
-
48
-	/** @var string Page orientation (portrait, landscape) */
49
-	public $orientation = 'portrait';
50
-
51
-	/** @var string Page format name */
52
-	public $pageFormat = 'A4';
53
-
54
-	/** @var float Height of page format in points */
55
-	public $pageh = 0.0;
56
-
57
-	/** @var float Width of page format in points */
58
-	public $pagew = 0.0;
59
-
60
-	/** @var string[][] An array of the Styles elements found in the document */
61
-	public $Styles = array();
62
-
63
-	/** @var string The default Report font name */
64
-	public $defaultFont = 'dejavusans';
65
-
66
-	/** @var int The default Report font size */
67
-	public $defaultFontSize = 12;
68
-
69
-	/** @var string Header (H), Page header (PH), Body (B) or Footer (F) */
70
-	public $processing = 'H';
71
-
72
-	/** @var bool RTL Language (false=LTR, true=RTL) */
73
-	public $rtl = false;
74
-
75
-	/** @var bool Show the Generated by... (true=show the text) */
76
-	public $showGenText = true;
77
-
78
-	/** @var string Generated By... text */
79
-	public $generatedby = '';
80
-
81
-	/** @var string The report title */
82
-	public $title = '';
83
-
84
-	/** @var string Author of the report, the users full name */
85
-	public $rauthor = WT_BASE_URL;
86
-
87
-	/** @var string Keywords */
88
-	public $rkeywords = '';
89
-
90
-	/** @var string Report Description / Subject */
91
-	public $rsubject = '';
92
-
93
-	/**
94
-	 * Initial Setup - ReportBase
95
-	 *
96
-	 * Setting up document wide defaults that will be inherited of the report modules
97
-	 * As DEFAULT A4 and Portrait will be used if not set
98
-	 */
99
-	public function setup() {
100
-		// Set RTL direction
101
-		if (I18N::direction() === 'rtl') {
102
-			$this->rtl = true;
103
-		}
104
-		// Set the Keywords
105
-		$this->rkeywords = '';
106
-		// Generated By...text
107
-		// I18N: This is a report footer. %s is the name of the application.
108
-		$this->generatedby = I18N::translate('Generated by %s', WT_WEBTREES . ' ' . WT_VERSION);
109
-
110
-		// For known size pages
111
-		if ($this->pagew == 0 && $this->pageh == 0) {
112
-			/**
113
-			 * The current ISO 216 standard was introduced in 1975 and is a direct follow up to the german DIN 476 standard from 1922. ISO 216 is also called EN 20216 in Europe.
114
-			 * The ISO paper sizes are based on the metric system so everything else is aproxiamte
115
-			 *
116
-			 * The Series A is used for Standard Printing and Stationary.
117
-			 * The Series B is used for Posters, Wall-Charts etc.
118
-			 * The C series is used for folders, post cards and envelopes. C series envelope is suitable to insert A series sizes.
119
-			 * ISO also define format series RA and SRA for untrimmed raw paper, where SRA stands for 'supplementary raw format A'.
120
-			 * Japan has adopted the ISO series A sizes, but its series B sizes are slightly different. These sizes are sometimes called JIS B or JB sizes.
121
-			 *  sun was a unit of length used in Japan and is equal to about 3.03 cm or 1.193 inches
122
-			 * The United States, Canada, and in part Mexico, are today the only industrialized nations in which the ISO standard paper sizes are not yet widely used.
123
-			 *
124
-			 * A0 & A1        Technical drawings, posters
125
-			 * A1 & A2        Flip charts
126
-			 * A2 & A3        Drawings, diagrams, large tables
127
-			 * A4             Letters, magazines, forms, catalogs, laser printer and copying machine output
128
-			 * A5             Note pads
129
-			 * A6             Postcards
130
-			 * B5, A5, B6  A6 Books
131
-			 * C4, C5, C6     Envelopes for A4 letters: unfolded (C4), folded once (C5), folded twice (C6)
132
-			 * B4 & A3        Newspapers, supported by most copying machines in addition to A4
133
-			 * B8 & A8        Playing cards
134
-			 *
135
-			 * 1 inch = 72 points
136
-			 * 1 mm = 2.8346457 points
137
-			 * 1 inch = 25.4 mm
138
-			 * 1 point = 0,35278 mm
139
-			 */
140
-			switch ($this->pageFormat) {
141
-				// ISO A series
142
-			case '4A0': // ISO 216, 1682 mm x 2378 mm
143
-				$sizes = array(4767.86, 6740.79);
144
-				break;
145
-			case '2A0': // ISO 216, 1189 mm x 1682 mm
146
-				$sizes = array(3370.39, 4767.86);
147
-				break;
148
-			case 'A0': // ISO 216, 841 mm x 1189mm
149
-				$sizes = array(2383.94, 3370.39);
150
-				break;
151
-			case 'A1': // ISO 216, 594 mm x 841 mm
152
-				$sizes = array(1683.78, 2383.94);
153
-				break;
154
-			case 'A2': // ISO 216, 420 mm x 594 mm
155
-				$sizes = array(1190.55, 1683.78);
156
-				break;
157
-			case 'A3': // ISO 216, 297 mm x 420 mm
158
-				$sizes = array(841.89, 1190.55);
159
-				break;
160
-			case 'A4': // ISO 216, 210 mm 297 mm
161
-				$sizes = array(595.28, 841.89);
162
-				break;
163
-			case 'A5': // ISO 216, 148 mm x 210 mm
164
-				$sizes = array(419.53, 595.28);
165
-				break;
166
-			case 'A6': // ISO 216, 105 mm x 148 mm
167
-				$sizes = array(297.64, 419.53);
168
-				break;
169
-			case 'A7': // ISO 216, 74 mm x 105 mm
170
-				$sizes = array(209.76, 297.64);
171
-				break;
172
-			case 'A8': // ISO 216, 52 mm x 74 mm
173
-				$sizes = array(147.40, 209.76);
174
-				break;
175
-			case 'A9': // ISO 216, 37 mm x 52 mm
176
-				$sizes = array(104.88, 147.40);
177
-				break;
178
-			case 'A10': // ISO 216, 26 mm x 37 mm
179
-				$sizes = array(73.70, 104.88);
180
-				break;
181
-
182
-			// ISO B series
183
-			case 'B0': // ISO 216, 1000 mm x 1414 mm
184
-				$sizes = array(2834.65, 4008.19);
185
-				break;
186
-			case 'B1': // ISO 216, 707 mm x 1000 mm
187
-				$sizes = array(2004.09, 2834.65);
188
-				break;
189
-			case 'B2': // ISO 216, 500 mm x 707 mm
190
-				$sizes = array(1417.32, 2004.09);
191
-				break;
192
-			case 'B3': // ISO 216, 353 mm x 500 mm
193
-				$sizes = array(1000.63, 1417.32);
194
-				break;
195
-			case 'B4': // ISO 216, 250 mm x 353 mm
196
-				$sizes = array(708.66, 1000.63);
197
-				break;
198
-			case 'B5': // ISO 216, 176 mm x 250 mm
199
-				$sizes = array(498.90, 708.66);
200
-				break;
201
-			case 'B6': // ISO 216, 125 mm x 176 mm
202
-				$sizes = array(354.33, 498.90);
203
-				break;
204
-			case 'B7': // ISO 216, 88 mm x 125 mm
205
-				$sizes = array(249.45, 354.33);
206
-				break;
207
-			case 'B8': // ISO 216, 62 mm x 88 mm
208
-				$sizes = array(175.75, 249.45);
209
-				break;
210
-			case 'B9': // ISO 216, 44 mm x 62 mm
211
-				$sizes = array(124.72, 175.75);
212
-				break;
213
-			case 'B10': // ISO 216, 31 mm x 44 mm
214
-				$sizes = array(87.87, 124.72);
215
-				break;
216
-
217
-			// ISO C series, Envelope
218
-			case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
-				$sizes = array(2599.37, 3676.54);
220
-				break;
221
-			case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
-				$sizes = array(1836.85, 2599.37);
223
-				break;
224
-			case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
-				$sizes = array(1298.27, 1836.85);
226
-				break;
227
-			case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
-				$sizes = array(918.43, 1298.27);
229
-				break;
230
-			case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
-				$sizes = array(649.13, 918.43);
232
-				break;
233
-			case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
-				$sizes = array(459.21, 649.13);
235
-				break;
236
-			case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
-				$sizes = array(323.15, 649.13);
238
-				break;
239
-			case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
-				$sizes = array(323.15, 459.21);
241
-				break;
242
-			case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
-				$sizes = array(229.61, 459.21);
244
-				break;
245
-			case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
-				$sizes = array(229.61, 323.15);
247
-				break;
248
-			case 'C8': // ISO 269, 57 mm x 81 mm
249
-				$sizes = array(161.57, 229.61);
250
-				break;
251
-			case 'C9': // ISO 269, 40 mm x 57 mm
252
-				$sizes = array(113.39, 161.57);
253
-				break;
254
-			case 'C10': // ISO 269, 28 mm x 40 mm
255
-				$sizes = array(79.37, 113.39);
256
-				break;
257
-			case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
-				$sizes = array(311.81, 623.62);
259
-				break;
260
-
261
-			// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
-			case 'RA0': // ISO 478, 860 mm x 1220 mm
263
-				$sizes = array(2437.80, 3458.27);
264
-				break;
265
-			case 'RA1': // ISO 478, 610 mm x 860 mm
266
-				$sizes = array(1729.13, 2437.80);
267
-				break;
268
-			case 'RA2': // ISO 478, 430 mm x 610 mm
269
-				$sizes = array(1218.90, 1729.13);
270
-				break;
271
-			case 'RA3': // ISO 478, 305 mm x 430 mm
272
-				$sizes = array(864.57, 1218.90);
273
-				break;
274
-			case 'RA4': // ISO 478, 215 mm x 305 mm
275
-				$sizes = array(609.45, 864.57);
276
-				break;
277
-
278
-			// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
-			case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
-				$sizes = array(2551.18, 3628.35);
281
-				break;
282
-			case 'SRA1': // ISO 593, 640 mm x 900 mm
283
-				$sizes = array(1814.17, 2551.18);
284
-				break;
285
-			case 'SRA2': // ISO 593, 450 mm x 640 mm
286
-				$sizes = array(1275.59, 1814.17);
287
-				break;
288
-			case 'SRA3': // ISO 593, 320 mm x 450 mm
289
-				$sizes = array(907.09, 1275.59);
290
-				break;
291
-			case 'SRA4': // ISO 593, 225 mm x 320 mm
292
-				$sizes = array(637.80, 907.09);
293
-				break;
294
-
295
-			// ISO size variations
296
-			case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
-				$sizes = array(1261.42, 1754.65);
298
-				break;
299
-			case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
-				$sizes = array(864.57, 1440.00);
301
-				break;
302
-			case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
-				$sizes = array(912.76, 1261.42);
304
-				break;
305
-			case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
-				$sizes = array(864.57, 1380.47);
307
-				break;
308
-			case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
-				$sizes = array(666.14, 912.76);
310
-				break;
311
-			case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
-				$sizes = array(595.28, 986.46);
313
-				break;
314
-			case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
-				$sizes = array(649.13, 912.76);
316
-				break;
317
-			case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
-				$sizes = array(643.46, 1009.13);
319
-				break;
320
-			case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
-				$sizes = array(490.39, 666.14);
322
-				break;
323
-			case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
-				$sizes = array(572.60, 782.36);
325
-				break;
326
-
327
-			// Japanese version of the ISO 216 B series
328
-			case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
-				$sizes = array(2919.69, 4127.24);
330
-				break;
331
-			case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
-				$sizes = array(2063.62, 2919.69);
333
-				break;
334
-			case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
-				$sizes = array(1459.84, 2063.62);
336
-				break;
337
-			case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
-				$sizes = array(1031.81, 1459.84);
339
-				break;
340
-			case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
-				$sizes = array(728.50, 1031.81);
342
-				break;
343
-			case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
-				$sizes = array(515.91, 728.50);
345
-				break;
346
-			case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
-				$sizes = array(362.83, 515.91);
348
-				break;
349
-			case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
-				$sizes = array(257.95, 362.83);
351
-				break;
352
-			case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
-				$sizes = array(181.42, 257.95);
354
-				break;
355
-			case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
-				$sizes = array(127.56, 181.42);
357
-				break;
358
-			case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
-				$sizes = array(90.71, 127.56);
360
-				break;
361
-
362
-			// US pages
363
-			case 'EXECUTIVE': // 7.25 in x 10.5 in
364
-				$sizes = array(522.00, 756.00);
365
-				break;
366
-			case 'FOLIO': // 8.5 in x 13 in
367
-				$sizes = array(612.00, 936.00);
368
-				break;
369
-			case 'FOOLSCAP': // 13.5 in x 17 in
370
-				$sizes = array(972.00, 1224.00);
371
-				break;
372
-			case 'LEDGER': // 11 in x 17 in
373
-				$sizes = array(792.00, 1224.00);
374
-				break;
375
-			case 'LEGAL': // 8.5 in x 14 in
376
-				$sizes = array(612.00, 1008.00);
377
-				break;
378
-			case 'LETTER': // 8.5 in x 11 in
379
-				$sizes = array(612.00, 792.00);
380
-				break;
381
-			case 'QUARTO': // 8.46 in x 10.8 in
382
-				$sizes = array(609.12, 777.50);
383
-				break;
384
-			case 'STATEMENT': // 5.5 in x 8.5 in
385
-				$sizes = array(396.00, 612.00);
386
-				break;
387
-			case 'USGOVT': // 8 in x 11 in
388
-				$sizes = array(576.00, 792.00);
389
-				break;
390
-			default:
391
-				$this->pageFormat = 'A4';
392
-				$sizes            = array(595.28, 841.89);
393
-				break;
394
-			}
395
-			$this->pagew = $sizes[0];
396
-			$this->pageh = $sizes[1];
397
-		} else {
398
-			if ($this->pagew < 10) {
399
-				throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customwidth" larger then this in the XML file');
400
-			}
401
-			if ($this->pageh < 10) {
402
-				throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customheight" larger then this in the XML file');
403
-			}
404
-		}
405
-
406
-		return 0;
407
-	}
408
-
409
-	/**
410
-	 * Process the Header , Page header, Body or Footer - ReportBase
411
-	 *
412
-	 * @param string $p Header (H), Page header (PH), Body (B) or Footer (F)
413
-	 *
414
-	 * @return int
415
-	 */
416
-	public function setProcessing($p) {
417
-		$this->processing = $p;
418
-
419
-		return 0;
420
-	}
421
-
422
-	/**
423
-	 * Add the Title when raw character data is used in Title - ReportBase
424
-	 *
425
-	 * @param string $data
426
-	 *
427
-	 * @return int
428
-	 */
429
-	public function addTitle($data) {
430
-		$this->title .= $data;
431
-
432
-		return 0;
433
-	}
434
-
435
-	/**
436
-	 * Add the Description when raw character data is used in Description - ReportBase
437
-	 *
438
-	 * @param string $data
439
-	 *
440
-	 * @return int
441
-	 */
442
-	public function addDescription($data) {
443
-		$this->rsubject .= $data;
444
-
445
-		return 0;
446
-	}
447
-
448
-	/**
449
-	 * Add Style to Styles array - ReportBase
450
-	 *
451
-	 * @param array $style
452
-	 *
453
-	 * @return int
454
-	 */
455
-	public function addStyle($style) {
456
-		$this->Styles[$style['name']] = $style;
457
-
458
-		return 0;
459
-	}
460
-
461
-	/**
462
-	 * Get a style from the Styles array - ReportBase
463
-	 *
464
-	 * @param string $s Style name
465
-	 *
466
-	 * @return array
467
-	 */
468
-	public function getStyle($s) {
469
-		if (!isset($this->Styles[$s])) {
470
-			return current($this->Styles);
471
-		}
472
-
473
-		return $this->Styles[$s];
474
-	}
24
+    /** User measure unit. */
25
+    const UNITS = 'pt';
26
+
27
+    /** webtrees URL */
28
+    const WT_URL = WT_WEBTREES_URL;
29
+
30
+    /** @var float Left Margin (expressed in points) Default: 17.99 mm, 0.7083 inch */
31
+    public $leftmargin = 51.0;
32
+
33
+    /** @var float Right Margin (expressed in points) Default: 9.87 mm, 0.389 inch */
34
+    public $rightmargin = 28.0;
35
+
36
+    /** @var float Top Margin (expressed in points) Default: 26.81 mm */
37
+    public $topmargin = 76.0;
38
+
39
+    /** @var float Bottom Margin (expressed in points) Default: 21.6 mm */
40
+    public $bottommargin = 60.0;
41
+
42
+    /** @var float Header Margin (expressed in points) Default: 4.93 mm */
43
+    public $headermargin = 14.0;
44
+
45
+    /** @var float Footer Margin (expressed in points) Default: 9.88 mm, 0.389 inch */
46
+    public $footermargin = 28.0;
47
+
48
+    /** @var string Page orientation (portrait, landscape) */
49
+    public $orientation = 'portrait';
50
+
51
+    /** @var string Page format name */
52
+    public $pageFormat = 'A4';
53
+
54
+    /** @var float Height of page format in points */
55
+    public $pageh = 0.0;
56
+
57
+    /** @var float Width of page format in points */
58
+    public $pagew = 0.0;
59
+
60
+    /** @var string[][] An array of the Styles elements found in the document */
61
+    public $Styles = array();
62
+
63
+    /** @var string The default Report font name */
64
+    public $defaultFont = 'dejavusans';
65
+
66
+    /** @var int The default Report font size */
67
+    public $defaultFontSize = 12;
68
+
69
+    /** @var string Header (H), Page header (PH), Body (B) or Footer (F) */
70
+    public $processing = 'H';
71
+
72
+    /** @var bool RTL Language (false=LTR, true=RTL) */
73
+    public $rtl = false;
74
+
75
+    /** @var bool Show the Generated by... (true=show the text) */
76
+    public $showGenText = true;
77
+
78
+    /** @var string Generated By... text */
79
+    public $generatedby = '';
80
+
81
+    /** @var string The report title */
82
+    public $title = '';
83
+
84
+    /** @var string Author of the report, the users full name */
85
+    public $rauthor = WT_BASE_URL;
86
+
87
+    /** @var string Keywords */
88
+    public $rkeywords = '';
89
+
90
+    /** @var string Report Description / Subject */
91
+    public $rsubject = '';
92
+
93
+    /**
94
+     * Initial Setup - ReportBase
95
+     *
96
+     * Setting up document wide defaults that will be inherited of the report modules
97
+     * As DEFAULT A4 and Portrait will be used if not set
98
+     */
99
+    public function setup() {
100
+        // Set RTL direction
101
+        if (I18N::direction() === 'rtl') {
102
+            $this->rtl = true;
103
+        }
104
+        // Set the Keywords
105
+        $this->rkeywords = '';
106
+        // Generated By...text
107
+        // I18N: This is a report footer. %s is the name of the application.
108
+        $this->generatedby = I18N::translate('Generated by %s', WT_WEBTREES . ' ' . WT_VERSION);
109
+
110
+        // For known size pages
111
+        if ($this->pagew == 0 && $this->pageh == 0) {
112
+            /**
113
+             * The current ISO 216 standard was introduced in 1975 and is a direct follow up to the german DIN 476 standard from 1922. ISO 216 is also called EN 20216 in Europe.
114
+             * The ISO paper sizes are based on the metric system so everything else is aproxiamte
115
+             *
116
+             * The Series A is used for Standard Printing and Stationary.
117
+             * The Series B is used for Posters, Wall-Charts etc.
118
+             * The C series is used for folders, post cards and envelopes. C series envelope is suitable to insert A series sizes.
119
+             * ISO also define format series RA and SRA for untrimmed raw paper, where SRA stands for 'supplementary raw format A'.
120
+             * Japan has adopted the ISO series A sizes, but its series B sizes are slightly different. These sizes are sometimes called JIS B or JB sizes.
121
+             *  sun was a unit of length used in Japan and is equal to about 3.03 cm or 1.193 inches
122
+             * The United States, Canada, and in part Mexico, are today the only industrialized nations in which the ISO standard paper sizes are not yet widely used.
123
+             *
124
+             * A0 & A1        Technical drawings, posters
125
+             * A1 & A2        Flip charts
126
+             * A2 & A3        Drawings, diagrams, large tables
127
+             * A4             Letters, magazines, forms, catalogs, laser printer and copying machine output
128
+             * A5             Note pads
129
+             * A6             Postcards
130
+             * B5, A5, B6  A6 Books
131
+             * C4, C5, C6     Envelopes for A4 letters: unfolded (C4), folded once (C5), folded twice (C6)
132
+             * B4 & A3        Newspapers, supported by most copying machines in addition to A4
133
+             * B8 & A8        Playing cards
134
+             *
135
+             * 1 inch = 72 points
136
+             * 1 mm = 2.8346457 points
137
+             * 1 inch = 25.4 mm
138
+             * 1 point = 0,35278 mm
139
+             */
140
+            switch ($this->pageFormat) {
141
+                // ISO A series
142
+            case '4A0': // ISO 216, 1682 mm x 2378 mm
143
+                $sizes = array(4767.86, 6740.79);
144
+                break;
145
+            case '2A0': // ISO 216, 1189 mm x 1682 mm
146
+                $sizes = array(3370.39, 4767.86);
147
+                break;
148
+            case 'A0': // ISO 216, 841 mm x 1189mm
149
+                $sizes = array(2383.94, 3370.39);
150
+                break;
151
+            case 'A1': // ISO 216, 594 mm x 841 mm
152
+                $sizes = array(1683.78, 2383.94);
153
+                break;
154
+            case 'A2': // ISO 216, 420 mm x 594 mm
155
+                $sizes = array(1190.55, 1683.78);
156
+                break;
157
+            case 'A3': // ISO 216, 297 mm x 420 mm
158
+                $sizes = array(841.89, 1190.55);
159
+                break;
160
+            case 'A4': // ISO 216, 210 mm 297 mm
161
+                $sizes = array(595.28, 841.89);
162
+                break;
163
+            case 'A5': // ISO 216, 148 mm x 210 mm
164
+                $sizes = array(419.53, 595.28);
165
+                break;
166
+            case 'A6': // ISO 216, 105 mm x 148 mm
167
+                $sizes = array(297.64, 419.53);
168
+                break;
169
+            case 'A7': // ISO 216, 74 mm x 105 mm
170
+                $sizes = array(209.76, 297.64);
171
+                break;
172
+            case 'A8': // ISO 216, 52 mm x 74 mm
173
+                $sizes = array(147.40, 209.76);
174
+                break;
175
+            case 'A9': // ISO 216, 37 mm x 52 mm
176
+                $sizes = array(104.88, 147.40);
177
+                break;
178
+            case 'A10': // ISO 216, 26 mm x 37 mm
179
+                $sizes = array(73.70, 104.88);
180
+                break;
181
+
182
+            // ISO B series
183
+            case 'B0': // ISO 216, 1000 mm x 1414 mm
184
+                $sizes = array(2834.65, 4008.19);
185
+                break;
186
+            case 'B1': // ISO 216, 707 mm x 1000 mm
187
+                $sizes = array(2004.09, 2834.65);
188
+                break;
189
+            case 'B2': // ISO 216, 500 mm x 707 mm
190
+                $sizes = array(1417.32, 2004.09);
191
+                break;
192
+            case 'B3': // ISO 216, 353 mm x 500 mm
193
+                $sizes = array(1000.63, 1417.32);
194
+                break;
195
+            case 'B4': // ISO 216, 250 mm x 353 mm
196
+                $sizes = array(708.66, 1000.63);
197
+                break;
198
+            case 'B5': // ISO 216, 176 mm x 250 mm
199
+                $sizes = array(498.90, 708.66);
200
+                break;
201
+            case 'B6': // ISO 216, 125 mm x 176 mm
202
+                $sizes = array(354.33, 498.90);
203
+                break;
204
+            case 'B7': // ISO 216, 88 mm x 125 mm
205
+                $sizes = array(249.45, 354.33);
206
+                break;
207
+            case 'B8': // ISO 216, 62 mm x 88 mm
208
+                $sizes = array(175.75, 249.45);
209
+                break;
210
+            case 'B9': // ISO 216, 44 mm x 62 mm
211
+                $sizes = array(124.72, 175.75);
212
+                break;
213
+            case 'B10': // ISO 216, 31 mm x 44 mm
214
+                $sizes = array(87.87, 124.72);
215
+                break;
216
+
217
+            // ISO C series, Envelope
218
+            case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
+                $sizes = array(2599.37, 3676.54);
220
+                break;
221
+            case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
+                $sizes = array(1836.85, 2599.37);
223
+                break;
224
+            case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
+                $sizes = array(1298.27, 1836.85);
226
+                break;
227
+            case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
+                $sizes = array(918.43, 1298.27);
229
+                break;
230
+            case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
+                $sizes = array(649.13, 918.43);
232
+                break;
233
+            case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
+                $sizes = array(459.21, 649.13);
235
+                break;
236
+            case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
+                $sizes = array(323.15, 649.13);
238
+                break;
239
+            case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
+                $sizes = array(323.15, 459.21);
241
+                break;
242
+            case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
+                $sizes = array(229.61, 459.21);
244
+                break;
245
+            case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
+                $sizes = array(229.61, 323.15);
247
+                break;
248
+            case 'C8': // ISO 269, 57 mm x 81 mm
249
+                $sizes = array(161.57, 229.61);
250
+                break;
251
+            case 'C9': // ISO 269, 40 mm x 57 mm
252
+                $sizes = array(113.39, 161.57);
253
+                break;
254
+            case 'C10': // ISO 269, 28 mm x 40 mm
255
+                $sizes = array(79.37, 113.39);
256
+                break;
257
+            case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
+                $sizes = array(311.81, 623.62);
259
+                break;
260
+
261
+            // Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
+            case 'RA0': // ISO 478, 860 mm x 1220 mm
263
+                $sizes = array(2437.80, 3458.27);
264
+                break;
265
+            case 'RA1': // ISO 478, 610 mm x 860 mm
266
+                $sizes = array(1729.13, 2437.80);
267
+                break;
268
+            case 'RA2': // ISO 478, 430 mm x 610 mm
269
+                $sizes = array(1218.90, 1729.13);
270
+                break;
271
+            case 'RA3': // ISO 478, 305 mm x 430 mm
272
+                $sizes = array(864.57, 1218.90);
273
+                break;
274
+            case 'RA4': // ISO 478, 215 mm x 305 mm
275
+                $sizes = array(609.45, 864.57);
276
+                break;
277
+
278
+            // Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
+            case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
+                $sizes = array(2551.18, 3628.35);
281
+                break;
282
+            case 'SRA1': // ISO 593, 640 mm x 900 mm
283
+                $sizes = array(1814.17, 2551.18);
284
+                break;
285
+            case 'SRA2': // ISO 593, 450 mm x 640 mm
286
+                $sizes = array(1275.59, 1814.17);
287
+                break;
288
+            case 'SRA3': // ISO 593, 320 mm x 450 mm
289
+                $sizes = array(907.09, 1275.59);
290
+                break;
291
+            case 'SRA4': // ISO 593, 225 mm x 320 mm
292
+                $sizes = array(637.80, 907.09);
293
+                break;
294
+
295
+            // ISO size variations
296
+            case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
+                $sizes = array(1261.42, 1754.65);
298
+                break;
299
+            case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
+                $sizes = array(864.57, 1440.00);
301
+                break;
302
+            case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
+                $sizes = array(912.76, 1261.42);
304
+                break;
305
+            case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
+                $sizes = array(864.57, 1380.47);
307
+                break;
308
+            case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
+                $sizes = array(666.14, 912.76);
310
+                break;
311
+            case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
+                $sizes = array(595.28, 986.46);
313
+                break;
314
+            case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
+                $sizes = array(649.13, 912.76);
316
+                break;
317
+            case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
+                $sizes = array(643.46, 1009.13);
319
+                break;
320
+            case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
+                $sizes = array(490.39, 666.14);
322
+                break;
323
+            case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
+                $sizes = array(572.60, 782.36);
325
+                break;
326
+
327
+            // Japanese version of the ISO 216 B series
328
+            case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
+                $sizes = array(2919.69, 4127.24);
330
+                break;
331
+            case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
+                $sizes = array(2063.62, 2919.69);
333
+                break;
334
+            case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
+                $sizes = array(1459.84, 2063.62);
336
+                break;
337
+            case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
+                $sizes = array(1031.81, 1459.84);
339
+                break;
340
+            case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
+                $sizes = array(728.50, 1031.81);
342
+                break;
343
+            case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
+                $sizes = array(515.91, 728.50);
345
+                break;
346
+            case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
+                $sizes = array(362.83, 515.91);
348
+                break;
349
+            case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
+                $sizes = array(257.95, 362.83);
351
+                break;
352
+            case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
+                $sizes = array(181.42, 257.95);
354
+                break;
355
+            case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
+                $sizes = array(127.56, 181.42);
357
+                break;
358
+            case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
+                $sizes = array(90.71, 127.56);
360
+                break;
361
+
362
+            // US pages
363
+            case 'EXECUTIVE': // 7.25 in x 10.5 in
364
+                $sizes = array(522.00, 756.00);
365
+                break;
366
+            case 'FOLIO': // 8.5 in x 13 in
367
+                $sizes = array(612.00, 936.00);
368
+                break;
369
+            case 'FOOLSCAP': // 13.5 in x 17 in
370
+                $sizes = array(972.00, 1224.00);
371
+                break;
372
+            case 'LEDGER': // 11 in x 17 in
373
+                $sizes = array(792.00, 1224.00);
374
+                break;
375
+            case 'LEGAL': // 8.5 in x 14 in
376
+                $sizes = array(612.00, 1008.00);
377
+                break;
378
+            case 'LETTER': // 8.5 in x 11 in
379
+                $sizes = array(612.00, 792.00);
380
+                break;
381
+            case 'QUARTO': // 8.46 in x 10.8 in
382
+                $sizes = array(609.12, 777.50);
383
+                break;
384
+            case 'STATEMENT': // 5.5 in x 8.5 in
385
+                $sizes = array(396.00, 612.00);
386
+                break;
387
+            case 'USGOVT': // 8 in x 11 in
388
+                $sizes = array(576.00, 792.00);
389
+                break;
390
+            default:
391
+                $this->pageFormat = 'A4';
392
+                $sizes            = array(595.28, 841.89);
393
+                break;
394
+            }
395
+            $this->pagew = $sizes[0];
396
+            $this->pageh = $sizes[1];
397
+        } else {
398
+            if ($this->pagew < 10) {
399
+                throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customwidth" larger then this in the XML file');
400
+            }
401
+            if ($this->pageh < 10) {
402
+                throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customheight" larger then this in the XML file');
403
+            }
404
+        }
405
+
406
+        return 0;
407
+    }
408
+
409
+    /**
410
+     * Process the Header , Page header, Body or Footer - ReportBase
411
+     *
412
+     * @param string $p Header (H), Page header (PH), Body (B) or Footer (F)
413
+     *
414
+     * @return int
415
+     */
416
+    public function setProcessing($p) {
417
+        $this->processing = $p;
418
+
419
+        return 0;
420
+    }
421
+
422
+    /**
423
+     * Add the Title when raw character data is used in Title - ReportBase
424
+     *
425
+     * @param string $data
426
+     *
427
+     * @return int
428
+     */
429
+    public function addTitle($data) {
430
+        $this->title .= $data;
431
+
432
+        return 0;
433
+    }
434
+
435
+    /**
436
+     * Add the Description when raw character data is used in Description - ReportBase
437
+     *
438
+     * @param string $data
439
+     *
440
+     * @return int
441
+     */
442
+    public function addDescription($data) {
443
+        $this->rsubject .= $data;
444
+
445
+        return 0;
446
+    }
447
+
448
+    /**
449
+     * Add Style to Styles array - ReportBase
450
+     *
451
+     * @param array $style
452
+     *
453
+     * @return int
454
+     */
455
+    public function addStyle($style) {
456
+        $this->Styles[$style['name']] = $style;
457
+
458
+        return 0;
459
+    }
460
+
461
+    /**
462
+     * Get a style from the Styles array - ReportBase
463
+     *
464
+     * @param string $s Style name
465
+     *
466
+     * @return array
467
+     */
468
+    public function getStyle($s) {
469
+        if (!isset($this->Styles[$s])) {
470
+            return current($this->Styles);
471
+        }
472
+
473
+        return $this->Styles[$s];
474
+    }
475 475
 }
Please login to merge, or discard this patch.
Switch Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -139,258 +139,258 @@
 block discarded – undo
139 139
 			 */
140 140
 			switch ($this->pageFormat) {
141 141
 				// ISO A series
142
-			case '4A0': // ISO 216, 1682 mm x 2378 mm
143
-				$sizes = array(4767.86, 6740.79);
144
-				break;
145
-			case '2A0': // ISO 216, 1189 mm x 1682 mm
146
-				$sizes = array(3370.39, 4767.86);
147
-				break;
148
-			case 'A0': // ISO 216, 841 mm x 1189mm
149
-				$sizes = array(2383.94, 3370.39);
150
-				break;
151
-			case 'A1': // ISO 216, 594 mm x 841 mm
152
-				$sizes = array(1683.78, 2383.94);
153
-				break;
154
-			case 'A2': // ISO 216, 420 mm x 594 mm
155
-				$sizes = array(1190.55, 1683.78);
156
-				break;
157
-			case 'A3': // ISO 216, 297 mm x 420 mm
158
-				$sizes = array(841.89, 1190.55);
159
-				break;
160
-			case 'A4': // ISO 216, 210 mm 297 mm
161
-				$sizes = array(595.28, 841.89);
162
-				break;
163
-			case 'A5': // ISO 216, 148 mm x 210 mm
164
-				$sizes = array(419.53, 595.28);
165
-				break;
166
-			case 'A6': // ISO 216, 105 mm x 148 mm
167
-				$sizes = array(297.64, 419.53);
168
-				break;
169
-			case 'A7': // ISO 216, 74 mm x 105 mm
170
-				$sizes = array(209.76, 297.64);
171
-				break;
172
-			case 'A8': // ISO 216, 52 mm x 74 mm
173
-				$sizes = array(147.40, 209.76);
174
-				break;
175
-			case 'A9': // ISO 216, 37 mm x 52 mm
176
-				$sizes = array(104.88, 147.40);
177
-				break;
178
-			case 'A10': // ISO 216, 26 mm x 37 mm
179
-				$sizes = array(73.70, 104.88);
180
-				break;
181
-
182
-			// ISO B series
183
-			case 'B0': // ISO 216, 1000 mm x 1414 mm
184
-				$sizes = array(2834.65, 4008.19);
185
-				break;
186
-			case 'B1': // ISO 216, 707 mm x 1000 mm
187
-				$sizes = array(2004.09, 2834.65);
188
-				break;
189
-			case 'B2': // ISO 216, 500 mm x 707 mm
190
-				$sizes = array(1417.32, 2004.09);
191
-				break;
192
-			case 'B3': // ISO 216, 353 mm x 500 mm
193
-				$sizes = array(1000.63, 1417.32);
194
-				break;
195
-			case 'B4': // ISO 216, 250 mm x 353 mm
196
-				$sizes = array(708.66, 1000.63);
197
-				break;
198
-			case 'B5': // ISO 216, 176 mm x 250 mm
199
-				$sizes = array(498.90, 708.66);
200
-				break;
201
-			case 'B6': // ISO 216, 125 mm x 176 mm
202
-				$sizes = array(354.33, 498.90);
203
-				break;
204
-			case 'B7': // ISO 216, 88 mm x 125 mm
205
-				$sizes = array(249.45, 354.33);
206
-				break;
207
-			case 'B8': // ISO 216, 62 mm x 88 mm
208
-				$sizes = array(175.75, 249.45);
209
-				break;
210
-			case 'B9': // ISO 216, 44 mm x 62 mm
211
-				$sizes = array(124.72, 175.75);
212
-				break;
213
-			case 'B10': // ISO 216, 31 mm x 44 mm
214
-				$sizes = array(87.87, 124.72);
215
-				break;
216
-
217
-			// ISO C series, Envelope
218
-			case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
-				$sizes = array(2599.37, 3676.54);
220
-				break;
221
-			case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
-				$sizes = array(1836.85, 2599.37);
223
-				break;
224
-			case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
-				$sizes = array(1298.27, 1836.85);
226
-				break;
227
-			case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
-				$sizes = array(918.43, 1298.27);
229
-				break;
230
-			case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
-				$sizes = array(649.13, 918.43);
232
-				break;
233
-			case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
-				$sizes = array(459.21, 649.13);
235
-				break;
236
-			case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
-				$sizes = array(323.15, 649.13);
238
-				break;
239
-			case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
-				$sizes = array(323.15, 459.21);
241
-				break;
242
-			case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
-				$sizes = array(229.61, 459.21);
244
-				break;
245
-			case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
-				$sizes = array(229.61, 323.15);
247
-				break;
248
-			case 'C8': // ISO 269, 57 mm x 81 mm
249
-				$sizes = array(161.57, 229.61);
250
-				break;
251
-			case 'C9': // ISO 269, 40 mm x 57 mm
252
-				$sizes = array(113.39, 161.57);
253
-				break;
254
-			case 'C10': // ISO 269, 28 mm x 40 mm
255
-				$sizes = array(79.37, 113.39);
256
-				break;
257
-			case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
-				$sizes = array(311.81, 623.62);
259
-				break;
260
-
261
-			// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
-			case 'RA0': // ISO 478, 860 mm x 1220 mm
263
-				$sizes = array(2437.80, 3458.27);
264
-				break;
265
-			case 'RA1': // ISO 478, 610 mm x 860 mm
266
-				$sizes = array(1729.13, 2437.80);
267
-				break;
268
-			case 'RA2': // ISO 478, 430 mm x 610 mm
269
-				$sizes = array(1218.90, 1729.13);
270
-				break;
271
-			case 'RA3': // ISO 478, 305 mm x 430 mm
272
-				$sizes = array(864.57, 1218.90);
273
-				break;
274
-			case 'RA4': // ISO 478, 215 mm x 305 mm
275
-				$sizes = array(609.45, 864.57);
276
-				break;
277
-
278
-			// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
-			case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
-				$sizes = array(2551.18, 3628.35);
281
-				break;
282
-			case 'SRA1': // ISO 593, 640 mm x 900 mm
283
-				$sizes = array(1814.17, 2551.18);
284
-				break;
285
-			case 'SRA2': // ISO 593, 450 mm x 640 mm
286
-				$sizes = array(1275.59, 1814.17);
287
-				break;
288
-			case 'SRA3': // ISO 593, 320 mm x 450 mm
289
-				$sizes = array(907.09, 1275.59);
290
-				break;
291
-			case 'SRA4': // ISO 593, 225 mm x 320 mm
292
-				$sizes = array(637.80, 907.09);
293
-				break;
294
-
295
-			// ISO size variations
296
-			case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
-				$sizes = array(1261.42, 1754.65);
298
-				break;
299
-			case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
-				$sizes = array(864.57, 1440.00);
301
-				break;
302
-			case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
-				$sizes = array(912.76, 1261.42);
304
-				break;
305
-			case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
-				$sizes = array(864.57, 1380.47);
307
-				break;
308
-			case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
-				$sizes = array(666.14, 912.76);
310
-				break;
311
-			case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
-				$sizes = array(595.28, 986.46);
313
-				break;
314
-			case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
-				$sizes = array(649.13, 912.76);
316
-				break;
317
-			case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
-				$sizes = array(643.46, 1009.13);
319
-				break;
320
-			case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
-				$sizes = array(490.39, 666.14);
322
-				break;
323
-			case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
-				$sizes = array(572.60, 782.36);
325
-				break;
326
-
327
-			// Japanese version of the ISO 216 B series
328
-			case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
-				$sizes = array(2919.69, 4127.24);
330
-				break;
331
-			case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
-				$sizes = array(2063.62, 2919.69);
333
-				break;
334
-			case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
-				$sizes = array(1459.84, 2063.62);
336
-				break;
337
-			case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
-				$sizes = array(1031.81, 1459.84);
339
-				break;
340
-			case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
-				$sizes = array(728.50, 1031.81);
342
-				break;
343
-			case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
-				$sizes = array(515.91, 728.50);
345
-				break;
346
-			case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
-				$sizes = array(362.83, 515.91);
348
-				break;
349
-			case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
-				$sizes = array(257.95, 362.83);
351
-				break;
352
-			case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
-				$sizes = array(181.42, 257.95);
354
-				break;
355
-			case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
-				$sizes = array(127.56, 181.42);
357
-				break;
358
-			case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
-				$sizes = array(90.71, 127.56);
360
-				break;
361
-
362
-			// US pages
363
-			case 'EXECUTIVE': // 7.25 in x 10.5 in
364
-				$sizes = array(522.00, 756.00);
365
-				break;
366
-			case 'FOLIO': // 8.5 in x 13 in
367
-				$sizes = array(612.00, 936.00);
368
-				break;
369
-			case 'FOOLSCAP': // 13.5 in x 17 in
370
-				$sizes = array(972.00, 1224.00);
371
-				break;
372
-			case 'LEDGER': // 11 in x 17 in
373
-				$sizes = array(792.00, 1224.00);
374
-				break;
375
-			case 'LEGAL': // 8.5 in x 14 in
376
-				$sizes = array(612.00, 1008.00);
377
-				break;
378
-			case 'LETTER': // 8.5 in x 11 in
379
-				$sizes = array(612.00, 792.00);
380
-				break;
381
-			case 'QUARTO': // 8.46 in x 10.8 in
382
-				$sizes = array(609.12, 777.50);
383
-				break;
384
-			case 'STATEMENT': // 5.5 in x 8.5 in
385
-				$sizes = array(396.00, 612.00);
386
-				break;
387
-			case 'USGOVT': // 8 in x 11 in
388
-				$sizes = array(576.00, 792.00);
389
-				break;
390
-			default:
391
-				$this->pageFormat = 'A4';
392
-				$sizes            = array(595.28, 841.89);
393
-				break;
142
+			    case '4A0': // ISO 216, 1682 mm x 2378 mm
143
+				    $sizes = array(4767.86, 6740.79);
144
+				    break;
145
+			    case '2A0': // ISO 216, 1189 mm x 1682 mm
146
+				    $sizes = array(3370.39, 4767.86);
147
+				    break;
148
+			    case 'A0': // ISO 216, 841 mm x 1189mm
149
+				    $sizes = array(2383.94, 3370.39);
150
+				    break;
151
+			    case 'A1': // ISO 216, 594 mm x 841 mm
152
+				    $sizes = array(1683.78, 2383.94);
153
+				    break;
154
+			    case 'A2': // ISO 216, 420 mm x 594 mm
155
+				    $sizes = array(1190.55, 1683.78);
156
+				    break;
157
+			    case 'A3': // ISO 216, 297 mm x 420 mm
158
+				    $sizes = array(841.89, 1190.55);
159
+				    break;
160
+			    case 'A4': // ISO 216, 210 mm 297 mm
161
+				    $sizes = array(595.28, 841.89);
162
+				    break;
163
+			    case 'A5': // ISO 216, 148 mm x 210 mm
164
+				    $sizes = array(419.53, 595.28);
165
+				    break;
166
+			    case 'A6': // ISO 216, 105 mm x 148 mm
167
+				    $sizes = array(297.64, 419.53);
168
+				    break;
169
+			    case 'A7': // ISO 216, 74 mm x 105 mm
170
+				    $sizes = array(209.76, 297.64);
171
+				    break;
172
+			    case 'A8': // ISO 216, 52 mm x 74 mm
173
+				    $sizes = array(147.40, 209.76);
174
+				    break;
175
+			    case 'A9': // ISO 216, 37 mm x 52 mm
176
+				    $sizes = array(104.88, 147.40);
177
+				    break;
178
+			    case 'A10': // ISO 216, 26 mm x 37 mm
179
+				    $sizes = array(73.70, 104.88);
180
+				    break;
181
+
182
+			    // ISO B series
183
+			    case 'B0': // ISO 216, 1000 mm x 1414 mm
184
+				    $sizes = array(2834.65, 4008.19);
185
+				    break;
186
+			    case 'B1': // ISO 216, 707 mm x 1000 mm
187
+				    $sizes = array(2004.09, 2834.65);
188
+				    break;
189
+			    case 'B2': // ISO 216, 500 mm x 707 mm
190
+				    $sizes = array(1417.32, 2004.09);
191
+				    break;
192
+			    case 'B3': // ISO 216, 353 mm x 500 mm
193
+				    $sizes = array(1000.63, 1417.32);
194
+				    break;
195
+			    case 'B4': // ISO 216, 250 mm x 353 mm
196
+				    $sizes = array(708.66, 1000.63);
197
+				    break;
198
+			    case 'B5': // ISO 216, 176 mm x 250 mm
199
+				    $sizes = array(498.90, 708.66);
200
+				    break;
201
+			    case 'B6': // ISO 216, 125 mm x 176 mm
202
+				    $sizes = array(354.33, 498.90);
203
+				    break;
204
+			    case 'B7': // ISO 216, 88 mm x 125 mm
205
+				    $sizes = array(249.45, 354.33);
206
+				    break;
207
+			    case 'B8': // ISO 216, 62 mm x 88 mm
208
+				    $sizes = array(175.75, 249.45);
209
+				    break;
210
+			    case 'B9': // ISO 216, 44 mm x 62 mm
211
+				    $sizes = array(124.72, 175.75);
212
+				    break;
213
+			    case 'B10': // ISO 216, 31 mm x 44 mm
214
+				    $sizes = array(87.87, 124.72);
215
+				    break;
216
+
217
+			    // ISO C series, Envelope
218
+			    case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
+				    $sizes = array(2599.37, 3676.54);
220
+				    break;
221
+			    case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
+				    $sizes = array(1836.85, 2599.37);
223
+				    break;
224
+			    case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
+				    $sizes = array(1298.27, 1836.85);
226
+				    break;
227
+			    case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
+				    $sizes = array(918.43, 1298.27);
229
+				    break;
230
+			    case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
+				    $sizes = array(649.13, 918.43);
232
+				    break;
233
+			    case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
+				    $sizes = array(459.21, 649.13);
235
+				    break;
236
+			    case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
+				    $sizes = array(323.15, 649.13);
238
+				    break;
239
+			    case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
+				    $sizes = array(323.15, 459.21);
241
+				    break;
242
+			    case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
+				    $sizes = array(229.61, 459.21);
244
+				    break;
245
+			    case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
+				    $sizes = array(229.61, 323.15);
247
+				    break;
248
+			    case 'C8': // ISO 269, 57 mm x 81 mm
249
+				    $sizes = array(161.57, 229.61);
250
+				    break;
251
+			    case 'C9': // ISO 269, 40 mm x 57 mm
252
+				    $sizes = array(113.39, 161.57);
253
+				    break;
254
+			    case 'C10': // ISO 269, 28 mm x 40 mm
255
+				    $sizes = array(79.37, 113.39);
256
+				    break;
257
+			    case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
+				    $sizes = array(311.81, 623.62);
259
+				    break;
260
+
261
+			    // Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
+			    case 'RA0': // ISO 478, 860 mm x 1220 mm
263
+				    $sizes = array(2437.80, 3458.27);
264
+				    break;
265
+			    case 'RA1': // ISO 478, 610 mm x 860 mm
266
+				    $sizes = array(1729.13, 2437.80);
267
+				    break;
268
+			    case 'RA2': // ISO 478, 430 mm x 610 mm
269
+				    $sizes = array(1218.90, 1729.13);
270
+				    break;
271
+			    case 'RA3': // ISO 478, 305 mm x 430 mm
272
+				    $sizes = array(864.57, 1218.90);
273
+				    break;
274
+			    case 'RA4': // ISO 478, 215 mm x 305 mm
275
+				    $sizes = array(609.45, 864.57);
276
+				    break;
277
+
278
+			    // Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
+			    case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
+				    $sizes = array(2551.18, 3628.35);
281
+				    break;
282
+			    case 'SRA1': // ISO 593, 640 mm x 900 mm
283
+				    $sizes = array(1814.17, 2551.18);
284
+				    break;
285
+			    case 'SRA2': // ISO 593, 450 mm x 640 mm
286
+				    $sizes = array(1275.59, 1814.17);
287
+				    break;
288
+			    case 'SRA3': // ISO 593, 320 mm x 450 mm
289
+				    $sizes = array(907.09, 1275.59);
290
+				    break;
291
+			    case 'SRA4': // ISO 593, 225 mm x 320 mm
292
+				    $sizes = array(637.80, 907.09);
293
+				    break;
294
+
295
+			    // ISO size variations
296
+			    case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
+				    $sizes = array(1261.42, 1754.65);
298
+				    break;
299
+			    case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
+				    $sizes = array(864.57, 1440.00);
301
+				    break;
302
+			    case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
+				    $sizes = array(912.76, 1261.42);
304
+				    break;
305
+			    case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
+				    $sizes = array(864.57, 1380.47);
307
+				    break;
308
+			    case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
+				    $sizes = array(666.14, 912.76);
310
+				    break;
311
+			    case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
+				    $sizes = array(595.28, 986.46);
313
+				    break;
314
+			    case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
+				    $sizes = array(649.13, 912.76);
316
+				    break;
317
+			    case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
+				    $sizes = array(643.46, 1009.13);
319
+				    break;
320
+			    case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
+				    $sizes = array(490.39, 666.14);
322
+				    break;
323
+			    case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
+				    $sizes = array(572.60, 782.36);
325
+				    break;
326
+
327
+			    // Japanese version of the ISO 216 B series
328
+			    case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
+				    $sizes = array(2919.69, 4127.24);
330
+				    break;
331
+			    case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
+				    $sizes = array(2063.62, 2919.69);
333
+				    break;
334
+			    case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
+				    $sizes = array(1459.84, 2063.62);
336
+				    break;
337
+			    case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
+				    $sizes = array(1031.81, 1459.84);
339
+				    break;
340
+			    case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
+				    $sizes = array(728.50, 1031.81);
342
+				    break;
343
+			    case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
+				    $sizes = array(515.91, 728.50);
345
+				    break;
346
+			    case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
+				    $sizes = array(362.83, 515.91);
348
+				    break;
349
+			    case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
+				    $sizes = array(257.95, 362.83);
351
+				    break;
352
+			    case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
+				    $sizes = array(181.42, 257.95);
354
+				    break;
355
+			    case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
+				    $sizes = array(127.56, 181.42);
357
+				    break;
358
+			    case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
+				    $sizes = array(90.71, 127.56);
360
+				    break;
361
+
362
+			    // US pages
363
+			    case 'EXECUTIVE': // 7.25 in x 10.5 in
364
+				    $sizes = array(522.00, 756.00);
365
+				    break;
366
+			    case 'FOLIO': // 8.5 in x 13 in
367
+				    $sizes = array(612.00, 936.00);
368
+				    break;
369
+			    case 'FOOLSCAP': // 13.5 in x 17 in
370
+				    $sizes = array(972.00, 1224.00);
371
+				    break;
372
+			    case 'LEDGER': // 11 in x 17 in
373
+				    $sizes = array(792.00, 1224.00);
374
+				    break;
375
+			    case 'LEGAL': // 8.5 in x 14 in
376
+				    $sizes = array(612.00, 1008.00);
377
+				    break;
378
+			    case 'LETTER': // 8.5 in x 11 in
379
+				    $sizes = array(612.00, 792.00);
380
+				    break;
381
+			    case 'QUARTO': // 8.46 in x 10.8 in
382
+				    $sizes = array(609.12, 777.50);
383
+				    break;
384
+			    case 'STATEMENT': // 5.5 in x 8.5 in
385
+				    $sizes = array(396.00, 612.00);
386
+				    break;
387
+			    case 'USGOVT': // 8 in x 11 in
388
+				    $sizes = array(576.00, 792.00);
389
+				    break;
390
+			    default:
391
+				    $this->pageFormat = 'A4';
392
+				    $sizes            = array(595.28, 841.89);
393
+				    break;
394 394
 			}
395 395
 			$this->pagew = $sizes[0];
396 396
 			$this->pageh = $sizes[1];
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
 /**
21 21
  * Class ReportBase
22 22
  */
23
-class ReportBase {
23
+class ReportBase
24
+{
24 25
 	/** User measure unit. */
25 26
 	const UNITS = 'pt';
26 27
 
@@ -96,7 +97,8 @@  discard block
 block discarded – undo
96 97
 	 * Setting up document wide defaults that will be inherited of the report modules
97 98
 	 * As DEFAULT A4 and Portrait will be used if not set
98 99
 	 */
99
-	public function setup() {
100
+	public function setup()
101
+	{
100 102
 		// Set RTL direction
101 103
 		if (I18N::direction() === 'rtl') {
102 104
 			$this->rtl = true;
@@ -413,7 +415,8 @@  discard block
 block discarded – undo
413 415
 	 *
414 416
 	 * @return int
415 417
 	 */
416
-	public function setProcessing($p) {
418
+	public function setProcessing($p)
419
+	{
417 420
 		$this->processing = $p;
418 421
 
419 422
 		return 0;
@@ -426,7 +429,8 @@  discard block
 block discarded – undo
426 429
 	 *
427 430
 	 * @return int
428 431
 	 */
429
-	public function addTitle($data) {
432
+	public function addTitle($data)
433
+	{
430 434
 		$this->title .= $data;
431 435
 
432 436
 		return 0;
@@ -439,7 +443,8 @@  discard block
 block discarded – undo
439 443
 	 *
440 444
 	 * @return int
441 445
 	 */
442
-	public function addDescription($data) {
446
+	public function addDescription($data)
447
+	{
443 448
 		$this->rsubject .= $data;
444 449
 
445 450
 		return 0;
@@ -452,7 +457,8 @@  discard block
 block discarded – undo
452 457
 	 *
453 458
 	 * @return int
454 459
 	 */
455
-	public function addStyle($style) {
460
+	public function addStyle($style)
461
+	{
456 462
 		$this->Styles[$style['name']] = $style;
457 463
 
458 464
 		return 0;
@@ -465,7 +471,8 @@  discard block
 block discarded – undo
465 471
 	 *
466 472
 	 * @return array
467 473
 	 */
468
-	public function getStyle($s) {
474
+	public function getStyle($s)
475
+	{
469 476
 		if (!isset($this->Styles[$s])) {
470 477
 			return current($this->Styles);
471 478
 		}
Please login to merge, or discard this patch.
app/Report/ReportBaseFootnote.php 2 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -19,118 +19,118 @@
 block discarded – undo
19 19
  * Class ReportBaseFootnote
20 20
  */
21 21
 class ReportBaseFootnote extends ReportBaseElement {
22
-	/**
23
-	 * The name of the style for this element
24
-	 *
25
-	 * @var string
26
-	 */
27
-	public $styleName = "";
22
+    /**
23
+     * The name of the style for this element
24
+     *
25
+     * @var string
26
+     */
27
+    public $styleName = "";
28 28
 
29
-	/**
30
-	 * Numbers for the links
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $num;
29
+    /**
30
+     * Numbers for the links
31
+     *
32
+     * @var int
33
+     */
34
+    public $num;
35 35
 
36
-	/**
37
-	 * The text that will be printed with the number
38
-	 *
39
-	 * @var string
40
-	 */
41
-	public $numText = "";
36
+    /**
37
+     * The text that will be printed with the number
38
+     *
39
+     * @var string
40
+     */
41
+    public $numText = "";
42 42
 
43
-	/**
44
-	 * Remaining width of a cell
45
-	 *
46
-	 * @var float User unit (points)
47
-	 */
48
-	public $wrapWidthRemaining;
43
+    /**
44
+     * Remaining width of a cell
45
+     *
46
+     * @var float User unit (points)
47
+     */
48
+    public $wrapWidthRemaining;
49 49
 
50
-	/**
51
-	 * Original width of a cell
52
-	 *
53
-	 * @var float User unit (points)
54
-	 */
55
-	public $wrapWidthCell;
50
+    /**
51
+     * Original width of a cell
52
+     *
53
+     * @var float User unit (points)
54
+     */
55
+    public $wrapWidthCell;
56 56
 
57
-	/** @var string A link */
58
-	public $addlink;
57
+    /** @var string A link */
58
+    public $addlink;
59 59
 
60
-	/**
61
-	 * Createa an element.
62
-	 *
63
-	 * @param string $style
64
-	 */
65
-	public function __construct($style = "") {
66
-		$this->text = "";
67
-		if (!empty($style)) {
68
-			$this->styleName = $style;
69
-		} else {
70
-			$this->styleName = "footnote";
71
-		}
72
-	}
60
+    /**
61
+     * Createa an element.
62
+     *
63
+     * @param string $style
64
+     */
65
+    public function __construct($style = "") {
66
+        $this->text = "";
67
+        if (!empty($style)) {
68
+            $this->styleName = $style;
69
+        } else {
70
+            $this->styleName = "footnote";
71
+        }
72
+    }
73 73
 
74
-	/**
75
-	 * Add text.
76
-	 *
77
-	 * @param $t
78
-	 *
79
-	 * @return int
80
-	 */
81
-	public function addText($t) {
82
-		$t = trim($t, "\r\n\t");
83
-		$t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
84
-		$t = strip_tags($t);
85
-		$t = htmlspecialchars_decode($t);
86
-		$this->text .= $t;
74
+    /**
75
+     * Add text.
76
+     *
77
+     * @param $t
78
+     *
79
+     * @return int
80
+     */
81
+    public function addText($t) {
82
+        $t = trim($t, "\r\n\t");
83
+        $t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
84
+        $t = strip_tags($t);
85
+        $t = htmlspecialchars_decode($t);
86
+        $this->text .= $t;
87 87
 
88
-		return 0;
89
-	}
88
+        return 0;
89
+    }
90 90
 
91
-	/**
92
-	 * Set the width to wrap text.
93
-	 *
94
-	 * @param $wrapwidth
95
-	 * @param $cellwidth
96
-	 *
97
-	 * @return mixed
98
-	 */
99
-	public function setWrapWidth($wrapwidth, $cellwidth) {
100
-		$this->wrapWidthCell = $cellwidth;
101
-		if (strpos($this->numText, "\n") !== false) {
102
-			$this->wrapWidthRemaining = $cellwidth;
103
-		} else {
104
-			$this->wrapWidthRemaining = $wrapwidth;
105
-		}
91
+    /**
92
+     * Set the width to wrap text.
93
+     *
94
+     * @param $wrapwidth
95
+     * @param $cellwidth
96
+     *
97
+     * @return mixed
98
+     */
99
+    public function setWrapWidth($wrapwidth, $cellwidth) {
100
+        $this->wrapWidthCell = $cellwidth;
101
+        if (strpos($this->numText, "\n") !== false) {
102
+            $this->wrapWidthRemaining = $cellwidth;
103
+        } else {
104
+            $this->wrapWidthRemaining = $wrapwidth;
105
+        }
106 106
 
107
-		return $this->wrapWidthRemaining;
108
-	}
107
+        return $this->wrapWidthRemaining;
108
+    }
109 109
 
110
-	/**
111
-	 * Set the number.
112
-	 *
113
-	 * @param $n
114
-	 *
115
-	 * @return int
116
-	 */
117
-	public function setNum($n) {
118
-		$this->num     = $n;
119
-		$this->numText = "$n ";
110
+    /**
111
+     * Set the number.
112
+     *
113
+     * @param $n
114
+     *
115
+     * @return int
116
+     */
117
+    public function setNum($n) {
118
+        $this->num     = $n;
119
+        $this->numText = "$n ";
120 120
 
121
-		return 0;
122
-	}
121
+        return 0;
122
+    }
123 123
 
124
-	/**
125
-	 * Add a link.
126
-	 *
127
-	 * @param $a
128
-	 *
129
-	 * @return int
130
-	 */
131
-	public function setAddlink($a) {
132
-		$this->addlink = $a;
124
+    /**
125
+     * Add a link.
126
+     *
127
+     * @param $a
128
+     *
129
+     * @return int
130
+     */
131
+    public function setAddlink($a) {
132
+        $this->addlink = $a;
133 133
 
134
-		return 0;
135
-	}
134
+        return 0;
135
+    }
136 136
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportBaseFootnote
20 20
  */
21
-class ReportBaseFootnote extends ReportBaseElement {
21
+class ReportBaseFootnote extends ReportBaseElement
22
+{
22 23
 	/**
23 24
 	 * The name of the style for this element
24 25
 	 *
@@ -62,7 +63,8 @@  discard block
 block discarded – undo
62 63
 	 *
63 64
 	 * @param string $style
64 65
 	 */
65
-	public function __construct($style = "") {
66
+	public function __construct($style = "")
67
+	{
66 68
 		$this->text = "";
67 69
 		if (!empty($style)) {
68 70
 			$this->styleName = $style;
@@ -78,7 +80,8 @@  discard block
 block discarded – undo
78 80
 	 *
79 81
 	 * @return int
80 82
 	 */
81
-	public function addText($t) {
83
+	public function addText($t)
84
+	{
82 85
 		$t = trim($t, "\r\n\t");
83 86
 		$t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
84 87
 		$t = strip_tags($t);
@@ -96,7 +99,8 @@  discard block
 block discarded – undo
96 99
 	 *
97 100
 	 * @return mixed
98 101
 	 */
99
-	public function setWrapWidth($wrapwidth, $cellwidth) {
102
+	public function setWrapWidth($wrapwidth, $cellwidth)
103
+	{
100 104
 		$this->wrapWidthCell = $cellwidth;
101 105
 		if (strpos($this->numText, "\n") !== false) {
102 106
 			$this->wrapWidthRemaining = $cellwidth;
@@ -114,7 +118,8 @@  discard block
 block discarded – undo
114 118
 	 *
115 119
 	 * @return int
116 120
 	 */
117
-	public function setNum($n) {
121
+	public function setNum($n)
122
+	{
118 123
 		$this->num     = $n;
119 124
 		$this->numText = "$n ";
120 125
 
@@ -128,7 +133,8 @@  discard block
 block discarded – undo
128 133
 	 *
129 134
 	 * @return int
130 135
 	 */
131
-	public function setAddlink($a) {
136
+	public function setAddlink($a)
137
+	{
132 138
 		$this->addlink = $a;
133 139
 
134 140
 		return 0;
Please login to merge, or discard this patch.
app/Report/ReportPdfPageheader.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
  * class ReportPdfPageheader
20 20
  */
21 21
 class ReportPdfPageheader extends ReportBasePageheader {
22
-	/**
23
-	 * PageHeader element renderer
24
-	 *
25
-	 * @param ReportTcpdf $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		$renderer->clearPageHeader();
29
-		foreach ($this->elements as $element) {
30
-			$renderer->addPageHeader($element);
31
-		}
32
-	}
22
+    /**
23
+     * PageHeader element renderer
24
+     *
25
+     * @param ReportTcpdf $renderer
26
+     */
27
+    public function render($renderer) {
28
+        $renderer->clearPageHeader();
29
+        foreach ($this->elements as $element) {
30
+            $renderer->addPageHeader($element);
31
+        }
32
+    }
33 33
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@
 block discarded – undo
18 18
 /**
19 19
  * class ReportPdfPageheader
20 20
  */
21
-class ReportPdfPageheader extends ReportBasePageheader {
21
+class ReportPdfPageheader extends ReportBasePageheader
22
+{
22 23
 	/**
23 24
 	 * PageHeader element renderer
24 25
 	 *
25 26
 	 * @param ReportTcpdf $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		$renderer->clearPageHeader();
29 31
 		foreach ($this->elements as $element) {
30 32
 			$renderer->addPageHeader($element);
Please login to merge, or discard this patch.
app/Report/ReportHtmlText.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -19,158 +19,158 @@
 block discarded – undo
19 19
  * Class ReportHtmlText
20 20
  */
21 21
 class ReportHtmlText extends ReportBaseText {
22
-	/**
23
-	 * Render the elements.
24
-	 *
25
-	 * @param ReportHtml $renderer
26
-	 * @param int        $curx
27
-	 * @param bool       $attrib Is is called from a different element?
28
-	 */
29
-	public function render($renderer, $curx = 0, $attrib = true) {
22
+    /**
23
+     * Render the elements.
24
+     *
25
+     * @param ReportHtml $renderer
26
+     * @param int        $curx
27
+     * @param bool       $attrib Is is called from a different element?
28
+     */
29
+    public function render($renderer, $curx = 0, $attrib = true) {
30 30
 
31
-		// Setup the style name
32
-		if ($renderer->getCurrentStyle() != $this->styleName) {
33
-			$renderer->setCurrentStyle($this->styleName);
34
-		}
35
-		$temptext = str_replace("#PAGENUM#", $renderer->pageNo(), $this->text);
36
-		// underline «title» part of Source item
37
-		$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
31
+        // Setup the style name
32
+        if ($renderer->getCurrentStyle() != $this->styleName) {
33
+            $renderer->setCurrentStyle($this->styleName);
34
+        }
35
+        $temptext = str_replace("#PAGENUM#", $renderer->pageNo(), $this->text);
36
+        // underline «title» part of Source item
37
+        $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
38 38
 
39
-		// If any text at all
40
-		if (!empty($temptext)) {
41
-			// If called by an other element
42
-			if (!$attrib) {
43
-				$renderer->write($temptext, $this->color);
44
-			} else {
45
-				// Save the start positions
46
-				$startX = $renderer->getX();
47
-				$startY = $renderer->getY();
48
-				$width  = $renderer->getRemainingWidth();
49
-				// If text is wider then page width then wrap it
50
-				if ($renderer->getStringWidth($temptext) > $width) {
51
-					$lines = explode("\n", $temptext);
52
-					foreach ($lines as $line) {
53
-						echo "<div style=\"position:absolute;top:", $startY, "pt;", $renderer->alignRTL, ":", $startX, "pt;width:", $width, "pt;\">";
54
-						$line = $renderer->textWrap($line, $width);
55
-						$startY += $renderer->getTextCellHeight($line);
56
-						$renderer->setY($startY);
57
-						$renderer->write($line, $this->color);
58
-						echo "</div>\n";
59
-					}
60
-				} else {
61
-					echo "<div style=\"position:absolute;top:", $startY, "pt;", $renderer->alignRTL, ":", $startX, "pt;width:", $width, "pt;\">";
62
-					$renderer->write($temptext, $this->color);
63
-					echo "</div>\n";
64
-					$renderer->setX($startX + $renderer->getStringWidth($temptext));
65
-					if ($renderer->countLines($temptext) != 1) {
66
-						$renderer->setXy(0, ($startY + $renderer->getTextCellHeight($temptext)));
67
-					}
68
-				}
69
-			}
70
-		}
71
-	}
39
+        // If any text at all
40
+        if (!empty($temptext)) {
41
+            // If called by an other element
42
+            if (!$attrib) {
43
+                $renderer->write($temptext, $this->color);
44
+            } else {
45
+                // Save the start positions
46
+                $startX = $renderer->getX();
47
+                $startY = $renderer->getY();
48
+                $width  = $renderer->getRemainingWidth();
49
+                // If text is wider then page width then wrap it
50
+                if ($renderer->getStringWidth($temptext) > $width) {
51
+                    $lines = explode("\n", $temptext);
52
+                    foreach ($lines as $line) {
53
+                        echo "<div style=\"position:absolute;top:", $startY, "pt;", $renderer->alignRTL, ":", $startX, "pt;width:", $width, "pt;\">";
54
+                        $line = $renderer->textWrap($line, $width);
55
+                        $startY += $renderer->getTextCellHeight($line);
56
+                        $renderer->setY($startY);
57
+                        $renderer->write($line, $this->color);
58
+                        echo "</div>\n";
59
+                    }
60
+                } else {
61
+                    echo "<div style=\"position:absolute;top:", $startY, "pt;", $renderer->alignRTL, ":", $startX, "pt;width:", $width, "pt;\">";
62
+                    $renderer->write($temptext, $this->color);
63
+                    echo "</div>\n";
64
+                    $renderer->setX($startX + $renderer->getStringWidth($temptext));
65
+                    if ($renderer->countLines($temptext) != 1) {
66
+                        $renderer->setXy(0, ($startY + $renderer->getTextCellHeight($temptext)));
67
+                    }
68
+                }
69
+            }
70
+        }
71
+    }
72 72
 
73
-	/**
74
-	 * Returns the height in points of the text element
75
-	 * The height is already calculated in getWidth()
76
-	 *
77
-	 * @param ReportHtml $html
78
-	 *
79
-	 * @return float
80
-	 */
81
-	public function getHeight($html) {
82
-		$ct = substr_count($this->text, "\n");
83
-		if ($ct > 0) {
84
-			$ct += 1;
85
-		}
86
-		$style = $html->getStyle($this->styleName);
73
+    /**
74
+     * Returns the height in points of the text element
75
+     * The height is already calculated in getWidth()
76
+     *
77
+     * @param ReportHtml $html
78
+     *
79
+     * @return float
80
+     */
81
+    public function getHeight($html) {
82
+        $ct = substr_count($this->text, "\n");
83
+        if ($ct > 0) {
84
+            $ct += 1;
85
+        }
86
+        $style = $html->getStyle($this->styleName);
87 87
 
88
-		return ($style["size"] * $ct) * $html->cellHeightRatio;
89
-	}
88
+        return ($style["size"] * $ct) * $html->cellHeightRatio;
89
+    }
90 90
 
91
-	/**
92
-	 * Get the width of text and wrap it too
93
-	 *
94
-	 * @param ReportHtml $html
95
-	 *
96
-	 * @return array
97
-	 */
98
-	public function getWidth($html) {
99
-		// Setup the style name
100
-		if ($html->getCurrentStyle() != $this->styleName) {
101
-			$html->setCurrentStyle($this->styleName);
102
-		}
91
+    /**
92
+     * Get the width of text and wrap it too
93
+     *
94
+     * @param ReportHtml $html
95
+     *
96
+     * @return array
97
+     */
98
+    public function getWidth($html) {
99
+        // Setup the style name
100
+        if ($html->getCurrentStyle() != $this->styleName) {
101
+            $html->setCurrentStyle($this->styleName);
102
+        }
103 103
 
104
-		// Check for the largest font size in the box
105
-		$fsize = $html->getCurrentStyleHeight();
106
-		if ($fsize > $html->largestFontHeight) {
107
-			$html->largestFontHeight = $fsize;
108
-		}
104
+        // Check for the largest font size in the box
105
+        $fsize = $html->getCurrentStyleHeight();
106
+        if ($fsize > $html->largestFontHeight) {
107
+            $html->largestFontHeight = $fsize;
108
+        }
109 109
 
110
-		// Get the line width for the text in points
111
-		$lw = $html->getStringWidth($this->text);
112
-		// Line Feed counter - Number of lines in the text
113
-		$lfct = $html->countLines($this->text);
114
-		// If there is still remaining wrap width...
115
-		if ($this->wrapWidthRemaining > 0) {
116
-			// Check with line counter too!
117
-			if ($lw >= $this->wrapWidthRemaining || $lfct > 1) {
118
-				$newtext            = "";
119
-				$wrapWidthRemaining = $this->wrapWidthRemaining;
120
-				$lines              = explode("\n", $this->text);
121
-				// Go throught the text line by line
122
-				foreach ($lines as $line) {
123
-					// Line width in points + a little margin
124
-					$lw = $html->getStringWidth($line);
125
-					// If the line has to be wraped
126
-					if ($lw > $wrapWidthRemaining) {
127
-						$words    = explode(" ", $line);
128
-						$addspace = count($words);
129
-						$lw       = 0;
130
-						foreach ($words as $word) {
131
-							$addspace--;
132
-							$lw += $html->getStringWidth($word . " ");
133
-							if ($lw <= $wrapWidthRemaining) {
134
-								$newtext .= $word;
135
-								if ($addspace != 0) {
136
-									$newtext .= " ";
137
-								}
138
-							} else {
139
-								$lw = $html->getStringWidth($word . " ");
140
-								$newtext .= "\n$word";
141
-								if ($addspace != 0) {
142
-									$newtext .= " ";
143
-								}
144
-								// Reset the wrap width to the cell width
145
-								$wrapWidthRemaining = $this->wrapWidthCell;
146
-							}
147
-						}
148
-					} else {
149
-						$newtext .= $line;
150
-					}
151
-					// Check the Line Feed counter
152
-					if ($lfct > 1) {
153
-						// Add a new line feed as long as it’s not the last line
154
-						$newtext .= "\n";
155
-						// Reset the line width
156
-						$lw = 0;
157
-						// Reset the wrap width to the cell width
158
-						$wrapWidthRemaining = $this->wrapWidthCell;
159
-					}
160
-					$lfct--;
161
-				}
162
-				$this->text = $newtext;
163
-				$lfct       = substr_count($this->text, "\n");
110
+        // Get the line width for the text in points
111
+        $lw = $html->getStringWidth($this->text);
112
+        // Line Feed counter - Number of lines in the text
113
+        $lfct = $html->countLines($this->text);
114
+        // If there is still remaining wrap width...
115
+        if ($this->wrapWidthRemaining > 0) {
116
+            // Check with line counter too!
117
+            if ($lw >= $this->wrapWidthRemaining || $lfct > 1) {
118
+                $newtext            = "";
119
+                $wrapWidthRemaining = $this->wrapWidthRemaining;
120
+                $lines              = explode("\n", $this->text);
121
+                // Go throught the text line by line
122
+                foreach ($lines as $line) {
123
+                    // Line width in points + a little margin
124
+                    $lw = $html->getStringWidth($line);
125
+                    // If the line has to be wraped
126
+                    if ($lw > $wrapWidthRemaining) {
127
+                        $words    = explode(" ", $line);
128
+                        $addspace = count($words);
129
+                        $lw       = 0;
130
+                        foreach ($words as $word) {
131
+                            $addspace--;
132
+                            $lw += $html->getStringWidth($word . " ");
133
+                            if ($lw <= $wrapWidthRemaining) {
134
+                                $newtext .= $word;
135
+                                if ($addspace != 0) {
136
+                                    $newtext .= " ";
137
+                                }
138
+                            } else {
139
+                                $lw = $html->getStringWidth($word . " ");
140
+                                $newtext .= "\n$word";
141
+                                if ($addspace != 0) {
142
+                                    $newtext .= " ";
143
+                                }
144
+                                // Reset the wrap width to the cell width
145
+                                $wrapWidthRemaining = $this->wrapWidthCell;
146
+                            }
147
+                        }
148
+                    } else {
149
+                        $newtext .= $line;
150
+                    }
151
+                    // Check the Line Feed counter
152
+                    if ($lfct > 1) {
153
+                        // Add a new line feed as long as it’s not the last line
154
+                        $newtext .= "\n";
155
+                        // Reset the line width
156
+                        $lw = 0;
157
+                        // Reset the wrap width to the cell width
158
+                        $wrapWidthRemaining = $this->wrapWidthCell;
159
+                    }
160
+                    $lfct--;
161
+                }
162
+                $this->text = $newtext;
163
+                $lfct       = substr_count($this->text, "\n");
164 164
 
165
-				return array($lw, 1, $lfct);
166
-			}
167
-		}
168
-		$l    = 0;
169
-		$lfct = substr_count($this->text, "\n");
170
-		if ($lfct > 0) {
171
-			$l = 2;
172
-		}
165
+                return array($lw, 1, $lfct);
166
+            }
167
+        }
168
+        $l    = 0;
169
+        $lfct = substr_count($this->text, "\n");
170
+        if ($lfct > 0) {
171
+            $l = 2;
172
+        }
173 173
 
174
-		return array($lw, $l, $lfct);
175
-	}
174
+        return array($lw, $l, $lfct);
175
+    }
176 176
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportHtmlText
20 20
  */
21
-class ReportHtmlText extends ReportBaseText {
21
+class ReportHtmlText extends ReportBaseText
22
+{
22 23
 	/**
23 24
 	 * Render the elements.
24 25
 	 *
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
 	 * @param int        $curx
27 28
 	 * @param bool       $attrib Is is called from a different element?
28 29
 	 */
29
-	public function render($renderer, $curx = 0, $attrib = true) {
30
+	public function render($renderer, $curx = 0, $attrib = true)
31
+	{
30 32
 
31 33
 		// Setup the style name
32 34
 		if ($renderer->getCurrentStyle() != $this->styleName) {
@@ -78,7 +80,8 @@  discard block
 block discarded – undo
78 80
 	 *
79 81
 	 * @return float
80 82
 	 */
81
-	public function getHeight($html) {
83
+	public function getHeight($html)
84
+	{
82 85
 		$ct = substr_count($this->text, "\n");
83 86
 		if ($ct > 0) {
84 87
 			$ct += 1;
@@ -95,7 +98,8 @@  discard block
 block discarded – undo
95 98
 	 *
96 99
 	 * @return array
97 100
 	 */
98
-	public function getWidth($html) {
101
+	public function getWidth($html)
102
+	{
99 103
 		// Setup the style name
100 104
 		if ($html->getCurrentStyle() != $this->styleName) {
101 105
 			$html->setCurrentStyle($this->styleName);
Please login to merge, or discard this patch.
app/Report/ReportPdfCell.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -21,125 +21,125 @@
 block discarded – undo
21 21
  * Class ReportPdfCell
22 22
  */
23 23
 class ReportPdfCell extends ReportBaseCell {
24
-	/**
25
-	 * PDF Cell renderer
26
-	 *
27
-	 * @param ReportTcpdf $renderer
28
-	 */
29
-	public function render($renderer) {
24
+    /**
25
+     * PDF Cell renderer
26
+     *
27
+     * @param ReportTcpdf $renderer
28
+     */
29
+    public function render($renderer) {
30 30
 
31
-		// Set up the text style
32
-		if (($renderer->getCurrentStyle()) != ($this->styleName)) {
33
-			$renderer->setCurrentStyle($this->styleName);
34
-		}
35
-		$temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text);
36
-		// underline «title» part of Source item
37
-		$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
38
-		$match    = array();
39
-		// Indicates if the cell background must be painted (1) or transparent (0)
40
-		if ($this->fill == 1) {
41
-			if (!empty($this->bgcolor)) {
42
-				// HTML color to RGB
43
-				if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
44
-					$r = hexdec($match[1]);
45
-					$g = hexdec($match[2]);
46
-					$b = hexdec($match[3]);
47
-					$renderer->SetFillColor($r, $g, $b);
48
-				}
49
-			} // If no color set then don't fill
50
-			else {
51
-				$this->fill = 0;
52
-			}
53
-		}
54
-		// Paint the Border color if set
55
-		if (!empty($this->bocolor)) {
56
-			// HTML color to RGB
57
-			if (preg_match("/#?(..)(..)(..)/", $this->bocolor, $match)) {
58
-				$r = hexdec($match[1]);
59
-				$g = hexdec($match[2]);
60
-				$b = hexdec($match[3]);
61
-				$renderer->SetDrawColor($r, $g, $b);
62
-			}
63
-		}
64
-		// Paint the text color or they might use inherited colors by the previous function
65
-		if (preg_match("/#?(..)(..)(..)/", $this->tcolor, $match)) {
66
-			$r = hexdec($match[1]);
67
-			$g = hexdec($match[2]);
68
-			$b = hexdec($match[3]);
69
-			$renderer->SetTextColor($r, $g, $b);
70
-		} else {
71
-			$renderer->SetTextColor(0, 0, 0);
72
-		}
31
+        // Set up the text style
32
+        if (($renderer->getCurrentStyle()) != ($this->styleName)) {
33
+            $renderer->setCurrentStyle($this->styleName);
34
+        }
35
+        $temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text);
36
+        // underline «title» part of Source item
37
+        $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
38
+        $match    = array();
39
+        // Indicates if the cell background must be painted (1) or transparent (0)
40
+        if ($this->fill == 1) {
41
+            if (!empty($this->bgcolor)) {
42
+                // HTML color to RGB
43
+                if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
44
+                    $r = hexdec($match[1]);
45
+                    $g = hexdec($match[2]);
46
+                    $b = hexdec($match[3]);
47
+                    $renderer->SetFillColor($r, $g, $b);
48
+                }
49
+            } // If no color set then don't fill
50
+            else {
51
+                $this->fill = 0;
52
+            }
53
+        }
54
+        // Paint the Border color if set
55
+        if (!empty($this->bocolor)) {
56
+            // HTML color to RGB
57
+            if (preg_match("/#?(..)(..)(..)/", $this->bocolor, $match)) {
58
+                $r = hexdec($match[1]);
59
+                $g = hexdec($match[2]);
60
+                $b = hexdec($match[3]);
61
+                $renderer->SetDrawColor($r, $g, $b);
62
+            }
63
+        }
64
+        // Paint the text color or they might use inherited colors by the previous function
65
+        if (preg_match("/#?(..)(..)(..)/", $this->tcolor, $match)) {
66
+            $r = hexdec($match[1]);
67
+            $g = hexdec($match[2]);
68
+            $b = hexdec($match[3]);
69
+            $renderer->SetTextColor($r, $g, $b);
70
+        } else {
71
+            $renderer->SetTextColor(0, 0, 0);
72
+        }
73 73
 
74
-		// If current position (left)
75
-		if ($this->left == ".") {
76
-			$cX = $renderer->GetX();
77
-		} // For static position add margin (also updates X)
78
-		else {
79
-			$cX = $renderer->addMarginX($this->left);
80
-		}
74
+        // If current position (left)
75
+        if ($this->left == ".") {
76
+            $cX = $renderer->GetX();
77
+        } // For static position add margin (also updates X)
78
+        else {
79
+            $cX = $renderer->addMarginX($this->left);
80
+        }
81 81
 
82
-		// Check the width if set to page wide OR set by xml to larger then page wide
83
-		if ($this->width == 0 || $this->width > $renderer->getRemainingWidthPDF()) {
84
-			$this->width = $renderer->getRemainingWidthPDF();
85
-		}
86
-		// For current position
87
-		if ($this->top == ".") {
88
-			$this->top = $renderer->GetY();
89
-		} else {
90
-			$renderer->SetY($this->top);
91
-		}
82
+        // Check the width if set to page wide OR set by xml to larger then page wide
83
+        if ($this->width == 0 || $this->width > $renderer->getRemainingWidthPDF()) {
84
+            $this->width = $renderer->getRemainingWidthPDF();
85
+        }
86
+        // For current position
87
+        if ($this->top == ".") {
88
+            $this->top = $renderer->GetY();
89
+        } else {
90
+            $renderer->SetY($this->top);
91
+        }
92 92
 
93
-		// Check the last cell height and adjust the current cell height if needed
94
-		if ($renderer->lastCellHeight > $this->height) {
95
-			$this->height = $renderer->lastCellHeight;
96
-		}
97
-		// Check for pagebreak
98
-		if (!empty($temptext)) {
99
-			$cHT = $renderer->getNumLines($temptext, $this->width);
100
-			$cHT = $cHT * $renderer->getCellHeightRatio() * $renderer->getCurrentStyleHeight();
101
-			$cM  = $renderer->getMargins();
102
-			// Add padding
103
-			if (is_array($cM['cell'])) {
104
-				$cHT += ($cM['padding_bottom'] + $cM['padding_top']);
105
-			} else {
106
-				$cHT += ($cM['cell'] * 2);
107
-			}
108
-			// Add a new page if needed
109
-			if ($renderer->checkPageBreakPDF($cHT)) {
110
-				$this->top = $renderer->GetY();
111
-			}
112
-			$temptext = FunctionsRtl::spanLtrRtl($temptext, "BOTH");
113
-		}
114
-		// HTML ready - last value is true
115
-		$renderer->MultiCell(
116
-			$this->width,
117
-			$this->height,
118
-			$temptext,
119
-			$this->border,
120
-			$this->align,
121
-			$this->fill,
122
-			$this->newline,
123
-			$cX,
124
-			$this->top,
125
-			$this->reseth,
126
-			$this->stretch,
127
-			true
128
-		);
129
-		// Reset the last cell height for the next line
130
-		if ($this->newline >= 1) {
131
-			$renderer->lastCellHeight = 0;
132
-		} // OR save the last height if heigher then before
133
-		elseif ($renderer->lastCellHeight < $renderer->getLastH()) {
134
-			$renderer->lastCellHeight = $renderer->getLastH();
135
-		}
93
+        // Check the last cell height and adjust the current cell height if needed
94
+        if ($renderer->lastCellHeight > $this->height) {
95
+            $this->height = $renderer->lastCellHeight;
96
+        }
97
+        // Check for pagebreak
98
+        if (!empty($temptext)) {
99
+            $cHT = $renderer->getNumLines($temptext, $this->width);
100
+            $cHT = $cHT * $renderer->getCellHeightRatio() * $renderer->getCurrentStyleHeight();
101
+            $cM  = $renderer->getMargins();
102
+            // Add padding
103
+            if (is_array($cM['cell'])) {
104
+                $cHT += ($cM['padding_bottom'] + $cM['padding_top']);
105
+            } else {
106
+                $cHT += ($cM['cell'] * 2);
107
+            }
108
+            // Add a new page if needed
109
+            if ($renderer->checkPageBreakPDF($cHT)) {
110
+                $this->top = $renderer->GetY();
111
+            }
112
+            $temptext = FunctionsRtl::spanLtrRtl($temptext, "BOTH");
113
+        }
114
+        // HTML ready - last value is true
115
+        $renderer->MultiCell(
116
+            $this->width,
117
+            $this->height,
118
+            $temptext,
119
+            $this->border,
120
+            $this->align,
121
+            $this->fill,
122
+            $this->newline,
123
+            $cX,
124
+            $this->top,
125
+            $this->reseth,
126
+            $this->stretch,
127
+            true
128
+        );
129
+        // Reset the last cell height for the next line
130
+        if ($this->newline >= 1) {
131
+            $renderer->lastCellHeight = 0;
132
+        } // OR save the last height if heigher then before
133
+        elseif ($renderer->lastCellHeight < $renderer->getLastH()) {
134
+            $renderer->lastCellHeight = $renderer->getLastH();
135
+        }
136 136
 
137
-		// Set up the url link if exists ontop of the cell
138
-		if (!empty($this->url)) {
139
-			$renderer->Link($cX, $this->top, $this->width, $this->height, $this->url);
140
-		}
141
-		// Reset the border and the text color to black or they will be inherited
142
-		$renderer->SetDrawColor(0, 0, 0);
143
-		$renderer->SetTextColor(0, 0, 0);
144
-	}
137
+        // Set up the url link if exists ontop of the cell
138
+        if (!empty($this->url)) {
139
+            $renderer->Link($cX, $this->top, $this->width, $this->height, $this->url);
140
+        }
141
+        // Reset the border and the text color to black or they will be inherited
142
+        $renderer->SetDrawColor(0, 0, 0);
143
+        $renderer->SetTextColor(0, 0, 0);
144
+    }
145 145
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,15 @@
 block discarded – undo
20 20
 /**
21 21
  * Class ReportPdfCell
22 22
  */
23
-class ReportPdfCell extends ReportBaseCell {
23
+class ReportPdfCell extends ReportBaseCell
24
+{
24 25
 	/**
25 26
 	 * PDF Cell renderer
26 27
 	 *
27 28
 	 * @param ReportTcpdf $renderer
28 29
 	 */
29
-	public function render($renderer) {
30
+	public function render($renderer)
31
+	{
30 32
 
31 33
 		// Set up the text style
32 34
 		if (($renderer->getCurrentStyle()) != ($this->styleName)) {
Please login to merge, or discard this patch.
app/Report/ReportPdf.php 2 patches
Indentation   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -22,269 +22,269 @@
 block discarded – undo
22 22
  * Class ReportPdf
23 23
  */
24 24
 class ReportPdf extends ReportBase {
25
-	/**
26
-	 * PDF compression - Zlib extension is required
27
-	 *
28
-	 * @var bool const
29
-	 */
30
-	const COMPRESSION = true;
31
-	/**
32
-	 * If true reduce the RAM memory usage by caching temporary data on filesystem (slower).
33
-	 *
34
-	 * @var bool const
35
-	 */
36
-	const DISK_CACHE = false;
37
-	/**
38
-	 * true means that the input text is unicode (PDF)
39
-	 *
40
-	 * @var bool const
41
-	 */
42
-	const UNICODE = true;
43
-	/**
44
-	 * false means that the full font is embedded, true means only the used chars
45
-	 * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files
46
-	 *
47
-	 * @var bool const
48
-	 */
49
-	const SUBSETTING = false;
50
-	/**
51
-	 * A new object of the PDF class
52
-	 *
53
-	 * @var ReportTcpdf
54
-	 */
55
-	public $pdf;
25
+    /**
26
+     * PDF compression - Zlib extension is required
27
+     *
28
+     * @var bool const
29
+     */
30
+    const COMPRESSION = true;
31
+    /**
32
+     * If true reduce the RAM memory usage by caching temporary data on filesystem (slower).
33
+     *
34
+     * @var bool const
35
+     */
36
+    const DISK_CACHE = false;
37
+    /**
38
+     * true means that the input text is unicode (PDF)
39
+     *
40
+     * @var bool const
41
+     */
42
+    const UNICODE = true;
43
+    /**
44
+     * false means that the full font is embedded, true means only the used chars
45
+     * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files
46
+     *
47
+     * @var bool const
48
+     */
49
+    const SUBSETTING = false;
50
+    /**
51
+     * A new object of the PDF class
52
+     *
53
+     * @var ReportTcpdf
54
+     */
55
+    public $pdf;
56 56
 
57
-	/**
58
-	 * PDF Setup - ReportPdf
59
-	 */
60
-	public function setup() {
61
-		parent::setup();
57
+    /**
58
+     * PDF Setup - ReportPdf
59
+     */
60
+    public function setup() {
61
+        parent::setup();
62 62
 
63
-		// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
64
-		$this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, array(
65
-			$this->pagew,
66
-			$this->pageh,
67
-		), self::UNICODE, "UTF-8", self::DISK_CACHE);
63
+        // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
64
+        $this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, array(
65
+            $this->pagew,
66
+            $this->pageh,
67
+        ), self::UNICODE, "UTF-8", self::DISK_CACHE);
68 68
 
69
-		// Setup the PDF margins
70
-		$this->pdf->SetMargins($this->leftmargin, $this->topmargin, $this->rightmargin);
71
-		$this->pdf->setHeaderMargin($this->headermargin);
72
-		$this->pdf->setFooterMargin($this->footermargin);
73
-		//Set auto page breaks
74
-		$this->pdf->SetAutoPageBreak(true, $this->bottommargin);
75
-		// Set font subsetting
76
-		$this->pdf->setFontSubsetting(self::SUBSETTING);
77
-		// Setup PDF compression
78
-		$this->pdf->SetCompression(self::COMPRESSION);
79
-		// Setup RTL support
80
-		$this->pdf->setRTL($this->rtl);
81
-		// Set the document information
82
-		// Only admin should see the version number
83
-		$appversion = WT_WEBTREES;
84
-		if (Auth::isAdmin()) {
85
-			$appversion .= " " . WT_VERSION;
86
-		}
87
-		$this->pdf->SetCreator($appversion . " (" . parent::WT_URL . ")");
88
-		// Not implemented yet - ReportBase::setup()
89
-		$this->pdf->SetAuthor($this->rauthor);
90
-		$this->pdf->SetTitle($this->title);
91
-		$this->pdf->SetSubject($this->rsubject);
92
-		$this->pdf->SetKeywords($this->rkeywords);
69
+        // Setup the PDF margins
70
+        $this->pdf->SetMargins($this->leftmargin, $this->topmargin, $this->rightmargin);
71
+        $this->pdf->setHeaderMargin($this->headermargin);
72
+        $this->pdf->setFooterMargin($this->footermargin);
73
+        //Set auto page breaks
74
+        $this->pdf->SetAutoPageBreak(true, $this->bottommargin);
75
+        // Set font subsetting
76
+        $this->pdf->setFontSubsetting(self::SUBSETTING);
77
+        // Setup PDF compression
78
+        $this->pdf->SetCompression(self::COMPRESSION);
79
+        // Setup RTL support
80
+        $this->pdf->setRTL($this->rtl);
81
+        // Set the document information
82
+        // Only admin should see the version number
83
+        $appversion = WT_WEBTREES;
84
+        if (Auth::isAdmin()) {
85
+            $appversion .= " " . WT_VERSION;
86
+        }
87
+        $this->pdf->SetCreator($appversion . " (" . parent::WT_URL . ")");
88
+        // Not implemented yet - ReportBase::setup()
89
+        $this->pdf->SetAuthor($this->rauthor);
90
+        $this->pdf->SetTitle($this->title);
91
+        $this->pdf->SetSubject($this->rsubject);
92
+        $this->pdf->SetKeywords($this->rkeywords);
93 93
 
94
-		$this->pdf->setReport($this);
94
+        $this->pdf->setReport($this);
95 95
 
96
-		if ($this->showGenText) {
97
-			// The default style name for Generated by.... is 'genby'
98
-			$element = new ReportPdfCell(0, 10, 0, "C", "", "genby", 1, ".", ".", 0, 0, "", "", true);
99
-			$element->addText($this->generatedby);
100
-			$element->setUrl(parent::WT_URL);
101
-			$this->pdf->addFooter($element);
102
-		}
103
-	}
96
+        if ($this->showGenText) {
97
+            // The default style name for Generated by.... is 'genby'
98
+            $element = new ReportPdfCell(0, 10, 0, "C", "", "genby", 1, ".", ".", 0, 0, "", "", true);
99
+            $element->addText($this->generatedby);
100
+            $element->setUrl(parent::WT_URL);
101
+            $this->pdf->addFooter($element);
102
+        }
103
+    }
104 104
 
105
-	/**
106
-	 * Add an element - ReportPdf
107
-	 *
108
-	 * @param object|string $element Object or string
109
-	 *
110
-	 * @return int
111
-	 */
112
-	public function addElement($element) {
113
-		if ($this->processing == "B") {
114
-			return $this->pdf->addBody($element);
115
-		} elseif ($this->processing == "H") {
116
-			return $this->pdf->addHeader($element);
117
-		} elseif ($this->processing == "F") {
118
-			return $this->pdf->addFooter($element);
119
-		}
105
+    /**
106
+     * Add an element - ReportPdf
107
+     *
108
+     * @param object|string $element Object or string
109
+     *
110
+     * @return int
111
+     */
112
+    public function addElement($element) {
113
+        if ($this->processing == "B") {
114
+            return $this->pdf->addBody($element);
115
+        } elseif ($this->processing == "H") {
116
+            return $this->pdf->addHeader($element);
117
+        } elseif ($this->processing == "F") {
118
+            return $this->pdf->addFooter($element);
119
+        }
120 120
 
121
-		return 0;
122
-	}
121
+        return 0;
122
+    }
123 123
 
124
-	/**
125
-	 * Run the report.
126
-	 */
127
-	public function run() {
128
-		$this->pdf->body();
129
-		header('Expires:');
130
-		header('Pragma:');
131
-		header('Cache-control:');
132
-		$this->pdf->Output('webtrees-' . uniqid() . '.pdf', 'I');
133
-	}
124
+    /**
125
+     * Run the report.
126
+     */
127
+    public function run() {
128
+        $this->pdf->body();
129
+        header('Expires:');
130
+        header('Pragma:');
131
+        header('Cache-control:');
132
+        $this->pdf->Output('webtrees-' . uniqid() . '.pdf', 'I');
133
+    }
134 134
 
135
-	/**
136
-	 * Clear the Header - ReportPdf
137
-	 */
138
-	public function clearHeader() {
139
-		$this->pdf->clearHeader();
140
-	}
135
+    /**
136
+     * Clear the Header - ReportPdf
137
+     */
138
+    public function clearHeader() {
139
+        $this->pdf->clearHeader();
140
+    }
141 141
 
142
-	/**
143
-	 * Clear the Page Header - ReportPdf
144
-	 */
145
-	public function clearPageHeader() {
146
-		$this->pdf->clearPageHeader();
147
-	}
142
+    /**
143
+     * Clear the Page Header - ReportPdf
144
+     */
145
+    public function clearPageHeader() {
146
+        $this->pdf->clearPageHeader();
147
+    }
148 148
 
149
-	/**
150
-	 * Create a new Cell object - ReportPdf
151
-	 *
152
-	 * @param int    $width   cell width (expressed in points)
153
-	 * @param int    $height  cell height (expressed in points)
154
-	 * @param mixed  $border  Border style
155
-	 * @param string $align   Text alignement
156
-	 * @param string $bgcolor Background color code
157
-	 * @param string $style   The name of the text style
158
-	 * @param int    $ln      Indicates where the current position should go after the call
159
-	 * @param mixed  $top     Y-position
160
-	 * @param mixed  $left    X-position
161
-	 * @param int    $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
162
-	 * @param int    $stretch Stretch carachter mode
163
-	 * @param string $bocolor Border color
164
-	 * @param string $tcolor  Text color
165
-	 * @param bool   $reseth
166
-	 *
167
-	 * @return ReportPdfCell
168
-	 */
169
-	public function createCell(
170
-		$width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth
171
-	) {
172
-		return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
173
-	}
149
+    /**
150
+     * Create a new Cell object - ReportPdf
151
+     *
152
+     * @param int    $width   cell width (expressed in points)
153
+     * @param int    $height  cell height (expressed in points)
154
+     * @param mixed  $border  Border style
155
+     * @param string $align   Text alignement
156
+     * @param string $bgcolor Background color code
157
+     * @param string $style   The name of the text style
158
+     * @param int    $ln      Indicates where the current position should go after the call
159
+     * @param mixed  $top     Y-position
160
+     * @param mixed  $left    X-position
161
+     * @param int    $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
162
+     * @param int    $stretch Stretch carachter mode
163
+     * @param string $bocolor Border color
164
+     * @param string $tcolor  Text color
165
+     * @param bool   $reseth
166
+     *
167
+     * @return ReportPdfCell
168
+     */
169
+    public function createCell(
170
+        $width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth
171
+    ) {
172
+        return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
173
+    }
174 174
 
175
-	/**
176
-	 * Create a new TextBox object - ReportPdf
177
-	 *
178
-	 * @param float  $width   Text box width
179
-	 * @param float  $height  Text box height
180
-	 * @param bool   $border
181
-	 * @param string $bgcolor Background color code in HTML
182
-	 * @param bool   $newline
183
-	 * @param mixed  $left
184
-	 * @param mixed  $top
185
-	 * @param bool   $pagecheck
186
-	 * @param string $style
187
-	 * @param bool   $fill
188
-	 * @param bool   $padding
189
-	 * @param bool   $reseth
190
-	 *
191
-	 * @return ReportPdfTextbox
192
-	 */
193
-	public function createTextBox(
194
-		$width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth
195
-	) {
196
-		return new ReportPdfTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth);
197
-	}
175
+    /**
176
+     * Create a new TextBox object - ReportPdf
177
+     *
178
+     * @param float  $width   Text box width
179
+     * @param float  $height  Text box height
180
+     * @param bool   $border
181
+     * @param string $bgcolor Background color code in HTML
182
+     * @param bool   $newline
183
+     * @param mixed  $left
184
+     * @param mixed  $top
185
+     * @param bool   $pagecheck
186
+     * @param string $style
187
+     * @param bool   $fill
188
+     * @param bool   $padding
189
+     * @param bool   $reseth
190
+     *
191
+     * @return ReportPdfTextbox
192
+     */
193
+    public function createTextBox(
194
+        $width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth
195
+    ) {
196
+        return new ReportPdfTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth);
197
+    }
198 198
 
199
-	/**
200
-	 * Create a new Text object- ReportPdf
201
-	 *
202
-	 * @param string $style The name of the text style
203
-	 * @param string $color HTML color code
204
-	 *
205
-	 * @return ReportPdfText
206
-	 */
207
-	public function createText($style, $color) {
208
-		return new ReportPdfText($style, $color);
209
-	}
199
+    /**
200
+     * Create a new Text object- ReportPdf
201
+     *
202
+     * @param string $style The name of the text style
203
+     * @param string $color HTML color code
204
+     *
205
+     * @return ReportPdfText
206
+     */
207
+    public function createText($style, $color) {
208
+        return new ReportPdfText($style, $color);
209
+    }
210 210
 
211
-	/**
212
-	 * Create a new Footnote object - ReportPdf
213
-	 *
214
-	 * @param string $style Style name
215
-	 *
216
-	 * @return ReportPdfFootnote
217
-	 */
218
-	public function createFootnote($style) {
219
-		return new ReportPdfFootnote($style);
220
-	}
211
+    /**
212
+     * Create a new Footnote object - ReportPdf
213
+     *
214
+     * @param string $style Style name
215
+     *
216
+     * @return ReportPdfFootnote
217
+     */
218
+    public function createFootnote($style) {
219
+        return new ReportPdfFootnote($style);
220
+    }
221 221
 
222
-	/**
223
-	 * Create a new Page Header object - ReportPdf
224
-	 *
225
-	 * @return ReportPdfPageheader
226
-	 */
227
-	public function createPageHeader() {
228
-		return new ReportPdfPageheader;
229
-	}
222
+    /**
223
+     * Create a new Page Header object - ReportPdf
224
+     *
225
+     * @return ReportPdfPageheader
226
+     */
227
+    public function createPageHeader() {
228
+        return new ReportPdfPageheader;
229
+    }
230 230
 
231
-	/**
232
-	 * Create a new image object - ReportPdf
233
-	 *
234
-	 * @param string  $file  Filename
235
-	 * @param mixed   $x
236
-	 * @param mixed   $y
237
-	 * @param int $w     Image width
238
-	 * @param int $h     Image height
239
-	 * @param string  $align L:left, C:center, R:right or empty to use x/y
240
-	 * @param string  $ln    T:same line, N:next line
241
-	 *
242
-	 * @return ReportPdfImage
243
-	 */
244
-	public function createImage($file, $x, $y, $w, $h, $align, $ln) {
245
-		return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln);
246
-	}
231
+    /**
232
+     * Create a new image object - ReportPdf
233
+     *
234
+     * @param string  $file  Filename
235
+     * @param mixed   $x
236
+     * @param mixed   $y
237
+     * @param int $w     Image width
238
+     * @param int $h     Image height
239
+     * @param string  $align L:left, C:center, R:right or empty to use x/y
240
+     * @param string  $ln    T:same line, N:next line
241
+     *
242
+     * @return ReportPdfImage
243
+     */
244
+    public function createImage($file, $x, $y, $w, $h, $align, $ln) {
245
+        return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln);
246
+    }
247 247
 
248
-	/**
249
-	 * Create a new image object from Media Object - ReportPdf
250
-	 *
251
-	 * @param Media  $mediaobject
252
-	 * @param mixed  $x
253
-	 * @param mixed  $y
254
-	 * @param int    $w           Image width
255
-	 * @param int    $h           Image height
256
-	 * @param string $align       L:left, C:center, R:right or empty to use x/y
257
-	 * @param string $ln          T:same line, N:next line
258
-	 *
259
-	 * @return ReportPdfImage
260
-	 */
261
-	public function createImageFromObject($mediaobject, $x, $y, $w, $h, $align, $ln) {
262
-		return new ReportPdfImage($mediaobject->getServerFilename('thumb'), $x, $y, $w, $h, $align, $ln);
263
-	}
248
+    /**
249
+     * Create a new image object from Media Object - ReportPdf
250
+     *
251
+     * @param Media  $mediaobject
252
+     * @param mixed  $x
253
+     * @param mixed  $y
254
+     * @param int    $w           Image width
255
+     * @param int    $h           Image height
256
+     * @param string $align       L:left, C:center, R:right or empty to use x/y
257
+     * @param string $ln          T:same line, N:next line
258
+     *
259
+     * @return ReportPdfImage
260
+     */
261
+    public function createImageFromObject($mediaobject, $x, $y, $w, $h, $align, $ln) {
262
+        return new ReportPdfImage($mediaobject->getServerFilename('thumb'), $x, $y, $w, $h, $align, $ln);
263
+    }
264 264
 
265
-	/**
266
-	 * Create a new line object - ReportPdf
267
-	 *
268
-	 * @param mixed $x1
269
-	 * @param mixed $y1
270
-	 * @param mixed $x2
271
-	 * @param mixed $y2
272
-	 *
273
-	 * @return ReportPdfLine
274
-	 */
275
-	public function createLine($x1, $y1, $x2, $y2) {
276
-		return new ReportPdfLine($x1, $y1, $x2, $y2);
277
-	}
265
+    /**
266
+     * Create a new line object - ReportPdf
267
+     *
268
+     * @param mixed $x1
269
+     * @param mixed $y1
270
+     * @param mixed $x2
271
+     * @param mixed $y2
272
+     *
273
+     * @return ReportPdfLine
274
+     */
275
+    public function createLine($x1, $y1, $x2, $y2) {
276
+        return new ReportPdfLine($x1, $y1, $x2, $y2);
277
+    }
278 278
 
279
-	/**
280
-	 * Create an HTML element.
281
-	 *
282
-	 * @param $tag
283
-	 * @param $attrs
284
-	 *
285
-	 * @return ReportPdfHtml
286
-	 */
287
-	public function createHTML($tag, $attrs) {
288
-		return new ReportPdfHtml($tag, $attrs);
289
-	}
279
+    /**
280
+     * Create an HTML element.
281
+     *
282
+     * @param $tag
283
+     * @param $attrs
284
+     *
285
+     * @return ReportPdfHtml
286
+     */
287
+    public function createHTML($tag, $attrs) {
288
+        return new ReportPdfHtml($tag, $attrs);
289
+    }
290 290
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Class ReportPdf
23 23
  */
24
-class ReportPdf extends ReportBase {
24
+class ReportPdf extends ReportBase
25
+{
25 26
 	/**
26 27
 	 * PDF compression - Zlib extension is required
27 28
 	 *
@@ -57,7 +58,8 @@  discard block
 block discarded – undo
57 58
 	/**
58 59
 	 * PDF Setup - ReportPdf
59 60
 	 */
60
-	public function setup() {
61
+	public function setup()
62
+	{
61 63
 		parent::setup();
62 64
 
63 65
 		// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
@@ -109,7 +111,8 @@  discard block
 block discarded – undo
109 111
 	 *
110 112
 	 * @return int
111 113
 	 */
112
-	public function addElement($element) {
114
+	public function addElement($element)
115
+	{
113 116
 		if ($this->processing == "B") {
114 117
 			return $this->pdf->addBody($element);
115 118
 		} elseif ($this->processing == "H") {
@@ -124,7 +127,8 @@  discard block
 block discarded – undo
124 127
 	/**
125 128
 	 * Run the report.
126 129
 	 */
127
-	public function run() {
130
+	public function run()
131
+	{
128 132
 		$this->pdf->body();
129 133
 		header('Expires:');
130 134
 		header('Pragma:');
@@ -135,14 +139,16 @@  discard block
 block discarded – undo
135 139
 	/**
136 140
 	 * Clear the Header - ReportPdf
137 141
 	 */
138
-	public function clearHeader() {
142
+	public function clearHeader()
143
+	{
139 144
 		$this->pdf->clearHeader();
140 145
 	}
141 146
 
142 147
 	/**
143 148
 	 * Clear the Page Header - ReportPdf
144 149
 	 */
145
-	public function clearPageHeader() {
150
+	public function clearPageHeader()
151
+	{
146 152
 		$this->pdf->clearPageHeader();
147 153
 	}
148 154
 
@@ -204,7 +210,8 @@  discard block
 block discarded – undo
204 210
 	 *
205 211
 	 * @return ReportPdfText
206 212
 	 */
207
-	public function createText($style, $color) {
213
+	public function createText($style, $color)
214
+	{
208 215
 		return new ReportPdfText($style, $color);
209 216
 	}
210 217
 
@@ -215,7 +222,8 @@  discard block
 block discarded – undo
215 222
 	 *
216 223
 	 * @return ReportPdfFootnote
217 224
 	 */
218
-	public function createFootnote($style) {
225
+	public function createFootnote($style)
226
+	{
219 227
 		return new ReportPdfFootnote($style);
220 228
 	}
221 229
 
@@ -224,7 +232,8 @@  discard block
 block discarded – undo
224 232
 	 *
225 233
 	 * @return ReportPdfPageheader
226 234
 	 */
227
-	public function createPageHeader() {
235
+	public function createPageHeader()
236
+	{
228 237
 		return new ReportPdfPageheader;
229 238
 	}
230 239
 
@@ -241,7 +250,8 @@  discard block
 block discarded – undo
241 250
 	 *
242 251
 	 * @return ReportPdfImage
243 252
 	 */
244
-	public function createImage($file, $x, $y, $w, $h, $align, $ln) {
253
+	public function createImage($file, $x, $y, $w, $h, $align, $ln)
254
+	{
245 255
 		return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln);
246 256
 	}
247 257
 
@@ -258,7 +268,8 @@  discard block
 block discarded – undo
258 268
 	 *
259 269
 	 * @return ReportPdfImage
260 270
 	 */
261
-	public function createImageFromObject($mediaobject, $x, $y, $w, $h, $align, $ln) {
271
+	public function createImageFromObject($mediaobject, $x, $y, $w, $h, $align, $ln)
272
+	{
262 273
 		return new ReportPdfImage($mediaobject->getServerFilename('thumb'), $x, $y, $w, $h, $align, $ln);
263 274
 	}
264 275
 
@@ -272,7 +283,8 @@  discard block
 block discarded – undo
272 283
 	 *
273 284
 	 * @return ReportPdfLine
274 285
 	 */
275
-	public function createLine($x1, $y1, $x2, $y2) {
286
+	public function createLine($x1, $y1, $x2, $y2)
287
+	{
276 288
 		return new ReportPdfLine($x1, $y1, $x2, $y2);
277 289
 	}
278 290
 
@@ -284,7 +296,8 @@  discard block
 block discarded – undo
284 296
 	 *
285 297
 	 * @return ReportPdfHtml
286 298
 	 */
287
-	public function createHTML($tag, $attrs) {
299
+	public function createHTML($tag, $attrs)
300
+	{
288 301
 		return new ReportPdfHtml($tag, $attrs);
289 302
 	}
290 303
 }
Please login to merge, or discard this patch.
app/Report/ReportBaseElement.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -19,103 +19,103 @@
 block discarded – undo
19 19
  * Class ReportBaseElement
20 20
  */
21 21
 class ReportBaseElement {
22
-	/** @var string Text*/
23
-	public $text = '';
22
+    /** @var string Text*/
23
+    public $text = '';
24 24
 
25
-	/**
26
-	 * Element renderer
27
-	 *
28
-	 * @param ReportHtml|ReportTcpdf $renderer
29
-	 */
30
-	public function render($renderer) {
31
-		//-- to be implemented in inherited classes
32
-	}
25
+    /**
26
+     * Element renderer
27
+     *
28
+     * @param ReportHtml|ReportTcpdf $renderer
29
+     */
30
+    public function render($renderer) {
31
+        //-- to be implemented in inherited classes
32
+    }
33 33
 
34
-	/**
35
-	 * Get the height.
36
-	 *
37
-	 * @param ReportHtml|ReportTcpdf $renderer
38
-	 *
39
-	 * @return float
40
-	 */
41
-	public function getHeight($renderer) {
42
-		return 0.0;
43
-	}
34
+    /**
35
+     * Get the height.
36
+     *
37
+     * @param ReportHtml|ReportTcpdf $renderer
38
+     *
39
+     * @return float
40
+     */
41
+    public function getHeight($renderer) {
42
+        return 0.0;
43
+    }
44 44
 
45
-	/**
46
-	 * Get the width.
47
-	 *
48
-	 * @param ReportHtml|ReportTcpdf $renderer
49
-	 *
50
-	 * @return float
51
-	 */
52
-	public function getWidth($renderer) {
53
-		return 0.0;
54
-	}
45
+    /**
46
+     * Get the width.
47
+     *
48
+     * @param ReportHtml|ReportTcpdf $renderer
49
+     *
50
+     * @return float
51
+     */
52
+    public function getWidth($renderer) {
53
+        return 0.0;
54
+    }
55 55
 
56
-	/**
57
-	 * Add text.
58
-	 *
59
-	 * @param string $t
60
-	 *
61
-	 * @return int
62
-	 */
63
-	public function addText($t) {
64
-		$t = trim($t, "\r\n\t");
65
-		$t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
66
-		$t = strip_tags($t);
67
-		$t = htmlspecialchars_decode($t);
68
-		$this->text .= $t;
56
+    /**
57
+     * Add text.
58
+     *
59
+     * @param string $t
60
+     *
61
+     * @return int
62
+     */
63
+    public function addText($t) {
64
+        $t = trim($t, "\r\n\t");
65
+        $t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
66
+        $t = strip_tags($t);
67
+        $t = htmlspecialchars_decode($t);
68
+        $this->text .= $t;
69 69
 
70
-		return 0;
71
-	}
70
+        return 0;
71
+    }
72 72
 
73
-	/**
74
-	 * Add an end-of-line.
75
-	 *
76
-	 * @return int
77
-	 */
78
-	public function addNewline() {
79
-		$this->text .= "\n";
73
+    /**
74
+     * Add an end-of-line.
75
+     *
76
+     * @return int
77
+     */
78
+    public function addNewline() {
79
+        $this->text .= "\n";
80 80
 
81
-		return 0;
82
-	}
81
+        return 0;
82
+    }
83 83
 
84
-	/**
85
-	 * Get the current text.
86
-	 *
87
-	 * @return string
88
-	 */
89
-	public function getValue() {
90
-		return $this->text;
91
-	}
84
+    /**
85
+     * Get the current text.
86
+     *
87
+     * @return string
88
+     */
89
+    public function getValue() {
90
+        return $this->text;
91
+    }
92 92
 
93
-	/**
94
-	 * Set the width to wrap text.
95
-	 *
96
-	 * @param $wrapwidth
97
-	 * @param $cellwidth
98
-	 *
99
-	 * @return int
100
-	 */
101
-	public function setWrapWidth($wrapwidth, $cellwidth) {
102
-		return 0;
103
-	}
93
+    /**
94
+     * Set the width to wrap text.
95
+     *
96
+     * @param $wrapwidth
97
+     * @param $cellwidth
98
+     *
99
+     * @return int
100
+     */
101
+    public function setWrapWidth($wrapwidth, $cellwidth) {
102
+        return 0;
103
+    }
104 104
 
105
-	/**
106
-	 * Render the footnotes.
107
-	 *
108
-	 * @param $renderer
109
-	 */
110
-	public function renderFootnote($renderer) {
111
-	}
105
+    /**
106
+     * Render the footnotes.
107
+     *
108
+     * @param $renderer
109
+     */
110
+    public function renderFootnote($renderer) {
111
+    }
112 112
 
113
-	/**
114
-	 * Set the text.
115
-	 *
116
-	 * @param $text
117
-	 */
118
-	public function setText($text) {
119
-		$this->text = $text;
120
-	}
113
+    /**
114
+     * Set the text.
115
+     *
116
+     * @param $text
117
+     */
118
+    public function setText($text) {
119
+        $this->text = $text;
120
+    }
121 121
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportBaseElement
20 20
  */
21
-class ReportBaseElement {
21
+class ReportBaseElement
22
+{
22 23
 	/** @var string Text*/
23 24
 	public $text = '';
24 25
 
@@ -27,7 +28,8 @@  discard block
 block discarded – undo
27 28
 	 *
28 29
 	 * @param ReportHtml|ReportTcpdf $renderer
29 30
 	 */
30
-	public function render($renderer) {
31
+	public function render($renderer)
32
+	{
31 33
 		//-- to be implemented in inherited classes
32 34
 	}
33 35
 
@@ -38,7 +40,8 @@  discard block
 block discarded – undo
38 40
 	 *
39 41
 	 * @return float
40 42
 	 */
41
-	public function getHeight($renderer) {
43
+	public function getHeight($renderer)
44
+	{
42 45
 		return 0.0;
43 46
 	}
44 47
 
@@ -49,7 +52,8 @@  discard block
 block discarded – undo
49 52
 	 *
50 53
 	 * @return float
51 54
 	 */
52
-	public function getWidth($renderer) {
55
+	public function getWidth($renderer)
56
+	{
53 57
 		return 0.0;
54 58
 	}
55 59
 
@@ -60,7 +64,8 @@  discard block
 block discarded – undo
60 64
 	 *
61 65
 	 * @return int
62 66
 	 */
63
-	public function addText($t) {
67
+	public function addText($t)
68
+	{
64 69
 		$t = trim($t, "\r\n\t");
65 70
 		$t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
66 71
 		$t = strip_tags($t);
@@ -75,7 +80,8 @@  discard block
 block discarded – undo
75 80
 	 *
76 81
 	 * @return int
77 82
 	 */
78
-	public function addNewline() {
83
+	public function addNewline()
84
+	{
79 85
 		$this->text .= "\n";
80 86
 
81 87
 		return 0;
@@ -86,7 +92,8 @@  discard block
 block discarded – undo
86 92
 	 *
87 93
 	 * @return string
88 94
 	 */
89
-	public function getValue() {
95
+	public function getValue()
96
+	{
90 97
 		return $this->text;
91 98
 	}
92 99
 
@@ -98,7 +105,8 @@  discard block
 block discarded – undo
98 105
 	 *
99 106
 	 * @return int
100 107
 	 */
101
-	public function setWrapWidth($wrapwidth, $cellwidth) {
108
+	public function setWrapWidth($wrapwidth, $cellwidth)
109
+	{
102 110
 		return 0;
103 111
 	}
104 112
 
@@ -107,7 +115,8 @@  discard block
 block discarded – undo
107 115
 	 *
108 116
 	 * @param $renderer
109 117
 	 */
110
-	public function renderFootnote($renderer) {
118
+	public function renderFootnote($renderer)
119
+	{
111 120
 	}
112 121
 
113 122
 	/**
@@ -115,7 +124,8 @@  discard block
 block discarded – undo
115 124
 	 *
116 125
 	 * @param $text
117 126
 	 */
118
-	public function setText($text) {
127
+	public function setText($text)
128
+	{
119 129
 		$this->text = $text;
120 130
 	}
121 131
 }
Please login to merge, or discard this patch.
app/Report/ReportPdfText.php 2 patches
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -21,144 +21,144 @@
 block discarded – undo
21 21
  * Class ReportPdfText
22 22
  */
23 23
 class ReportPdfText extends ReportBaseText {
24
-	/**
25
-	 * PDF Text renderer
26
-	 *
27
-	 * @param ReportTcpdf $renderer
28
-	 */
29
-	public function render($renderer) {
30
-		// Set up the style
31
-		if ($renderer->getCurrentStyle() != $this->styleName) {
32
-			$renderer->setCurrentStyle($this->styleName);
33
-		}
34
-		$temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text);
35
-		// underline «title» part of Source item
36
-		$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
24
+    /**
25
+     * PDF Text renderer
26
+     *
27
+     * @param ReportTcpdf $renderer
28
+     */
29
+    public function render($renderer) {
30
+        // Set up the style
31
+        if ($renderer->getCurrentStyle() != $this->styleName) {
32
+            $renderer->setCurrentStyle($this->styleName);
33
+        }
34
+        $temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text);
35
+        // underline «title» part of Source item
36
+        $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
37 37
 
38
-		// Paint the text color or they might use inherited colors by the previous function
39
-		$match = array();
40
-		if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) {
41
-			$r = hexdec($match[1]);
42
-			$g = hexdec($match[2]);
43
-			$b = hexdec($match[3]);
44
-			$renderer->SetTextColor($r, $g, $b);
45
-		} else {
46
-			$renderer->SetTextColor(0, 0, 0);
47
-		}
48
-		$temptext = FunctionsRtl::spanLtrRtl($temptext, "BOTH");
49
-		$temptext = str_replace(
50
-			array('<br><span dir="rtl" >', '<br><span dir="ltr" >', '> ', ' <'),
51
-			array('<span dir="rtl" ><br>', '<span dir="ltr" ><br>', '>&nbsp;', '&nbsp;<'),
52
-			$temptext
53
-		);
54
-		$renderer->writeHTML(
55
-			$temptext,
56
-			false,
57
-			false,
58
-			true,
59
-			false,
60
-			""
61
-		); //change height - line break etc. - the form is mirror on rtl pages
62
-		// Reset the text color to black or it will be inherited
63
-		$renderer->SetTextColor(0, 0, 0);
64
-	}
38
+        // Paint the text color or they might use inherited colors by the previous function
39
+        $match = array();
40
+        if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) {
41
+            $r = hexdec($match[1]);
42
+            $g = hexdec($match[2]);
43
+            $b = hexdec($match[3]);
44
+            $renderer->SetTextColor($r, $g, $b);
45
+        } else {
46
+            $renderer->SetTextColor(0, 0, 0);
47
+        }
48
+        $temptext = FunctionsRtl::spanLtrRtl($temptext, "BOTH");
49
+        $temptext = str_replace(
50
+            array('<br><span dir="rtl" >', '<br><span dir="ltr" >', '> ', ' <'),
51
+            array('<span dir="rtl" ><br>', '<span dir="ltr" ><br>', '>&nbsp;', '&nbsp;<'),
52
+            $temptext
53
+        );
54
+        $renderer->writeHTML(
55
+            $temptext,
56
+            false,
57
+            false,
58
+            true,
59
+            false,
60
+            ""
61
+        ); //change height - line break etc. - the form is mirror on rtl pages
62
+        // Reset the text color to black or it will be inherited
63
+        $renderer->SetTextColor(0, 0, 0);
64
+    }
65 65
 
66
-	/**
67
-	 * Returns the height in points of the text element
68
-	 *
69
-	 * The height is already calculated in getWidth()
70
-	 *
71
-	 * @param ReportTcpdf $pdf
72
-	 *
73
-	 * @return float 0
74
-	 */
75
-	public function getHeight($pdf) {
76
-		return 0;
77
-	}
66
+    /**
67
+     * Returns the height in points of the text element
68
+     *
69
+     * The height is already calculated in getWidth()
70
+     *
71
+     * @param ReportTcpdf $pdf
72
+     *
73
+     * @return float 0
74
+     */
75
+    public function getHeight($pdf) {
76
+        return 0;
77
+    }
78 78
 
79
-	/**
80
-	 * Splits the text into lines if necessary to fit into a giving cell
81
-	 *
82
-	 * @param ReportTcpdf $pdf
83
-	 *
84
-	 * @return array
85
-	 */
86
-	public function getWidth($pdf) {
87
-		// Setup the style name, a font must be selected to calculate the width
88
-		if ($pdf->getCurrentStyle() != $this->styleName) {
89
-			$pdf->setCurrentStyle($this->styleName);
90
-		}
91
-		// Check for the largest font size in the box
92
-		$fsize = $pdf->getCurrentStyleHeight();
93
-		if ($fsize > $pdf->largestFontHeight) {
94
-			$pdf->largestFontHeight = $fsize;
95
-		}
79
+    /**
80
+     * Splits the text into lines if necessary to fit into a giving cell
81
+     *
82
+     * @param ReportTcpdf $pdf
83
+     *
84
+     * @return array
85
+     */
86
+    public function getWidth($pdf) {
87
+        // Setup the style name, a font must be selected to calculate the width
88
+        if ($pdf->getCurrentStyle() != $this->styleName) {
89
+            $pdf->setCurrentStyle($this->styleName);
90
+        }
91
+        // Check for the largest font size in the box
92
+        $fsize = $pdf->getCurrentStyleHeight();
93
+        if ($fsize > $pdf->largestFontHeight) {
94
+            $pdf->largestFontHeight = $fsize;
95
+        }
96 96
 
97
-		// Get the line width
98
-		$lw = $pdf->GetStringWidth($this->text);
99
-		// Line Feed counter - Number of lines in the text
100
-		$lfct = substr_count($this->text, "\n") + 1;
101
-		// If there is still remaining wrap width...
102
-		if ($this->wrapWidthRemaining > 0) {
103
-			// Check with line counter too!
104
-			// but floor the $wrapWidthRemaining first to keep it bugfree!
105
-			$wrapWidthRemaining = (int) ($this->wrapWidthRemaining);
106
-			if ($lw >= $wrapWidthRemaining || $lfct > 1) {
107
-				$newtext = "";
108
-				$lines   = explode("\n", $this->text);
109
-				// Go throught the text line by line
110
-				foreach ($lines as $line) {
111
-					// Line width in points + a little margin
112
-					$lw = $pdf->GetStringWidth($line);
113
-					// If the line has to be wraped
114
-					if ($lw >= $wrapWidthRemaining) {
115
-						$words    = explode(" ", $line);
116
-						$addspace = count($words);
117
-						$lw       = 0;
118
-						foreach ($words as $word) {
119
-							$addspace--;
120
-							$lw += $pdf->GetStringWidth($word . " ");
121
-							if ($lw <= $wrapWidthRemaining) {
122
-								$newtext .= $word;
123
-								if ($addspace != 0) {
124
-									$newtext .= " ";
125
-								}
126
-							} else {
127
-								$lw = $pdf->GetStringWidth($word . " ");
128
-								$newtext .= "\n$word";
129
-								if ($addspace != 0) {
130
-									$newtext .= " ";
131
-								}
132
-								// Reset the wrap width to the cell width
133
-								$wrapWidthRemaining = $this->wrapWidthCell;
134
-							}
135
-						}
136
-					} else {
137
-						$newtext .= $line;
138
-					}
139
-					// Check the Line Feed counter
140
-					if ($lfct > 1) {
141
-						// Add a new line as long as it’s not the last line
142
-						$newtext .= "\n";
143
-						// Reset the line width
144
-						$lw = 0;
145
-						// Reset the wrap width to the cell width
146
-						$wrapWidthRemaining = $this->wrapWidthCell;
147
-					}
148
-					$lfct--;
149
-				}
150
-				$this->text = $newtext;
151
-				$lfct       = substr_count($this->text, "\n");
97
+        // Get the line width
98
+        $lw = $pdf->GetStringWidth($this->text);
99
+        // Line Feed counter - Number of lines in the text
100
+        $lfct = substr_count($this->text, "\n") + 1;
101
+        // If there is still remaining wrap width...
102
+        if ($this->wrapWidthRemaining > 0) {
103
+            // Check with line counter too!
104
+            // but floor the $wrapWidthRemaining first to keep it bugfree!
105
+            $wrapWidthRemaining = (int) ($this->wrapWidthRemaining);
106
+            if ($lw >= $wrapWidthRemaining || $lfct > 1) {
107
+                $newtext = "";
108
+                $lines   = explode("\n", $this->text);
109
+                // Go throught the text line by line
110
+                foreach ($lines as $line) {
111
+                    // Line width in points + a little margin
112
+                    $lw = $pdf->GetStringWidth($line);
113
+                    // If the line has to be wraped
114
+                    if ($lw >= $wrapWidthRemaining) {
115
+                        $words    = explode(" ", $line);
116
+                        $addspace = count($words);
117
+                        $lw       = 0;
118
+                        foreach ($words as $word) {
119
+                            $addspace--;
120
+                            $lw += $pdf->GetStringWidth($word . " ");
121
+                            if ($lw <= $wrapWidthRemaining) {
122
+                                $newtext .= $word;
123
+                                if ($addspace != 0) {
124
+                                    $newtext .= " ";
125
+                                }
126
+                            } else {
127
+                                $lw = $pdf->GetStringWidth($word . " ");
128
+                                $newtext .= "\n$word";
129
+                                if ($addspace != 0) {
130
+                                    $newtext .= " ";
131
+                                }
132
+                                // Reset the wrap width to the cell width
133
+                                $wrapWidthRemaining = $this->wrapWidthCell;
134
+                            }
135
+                        }
136
+                    } else {
137
+                        $newtext .= $line;
138
+                    }
139
+                    // Check the Line Feed counter
140
+                    if ($lfct > 1) {
141
+                        // Add a new line as long as it’s not the last line
142
+                        $newtext .= "\n";
143
+                        // Reset the line width
144
+                        $lw = 0;
145
+                        // Reset the wrap width to the cell width
146
+                        $wrapWidthRemaining = $this->wrapWidthCell;
147
+                    }
148
+                    $lfct--;
149
+                }
150
+                $this->text = $newtext;
151
+                $lfct       = substr_count($this->text, "\n");
152 152
 
153
-				return array($lw, 1, $lfct);
154
-			}
155
-		}
156
-		$l    = 0;
157
-		$lfct = substr_count($this->text, "\n");
158
-		if ($lfct > 0) {
159
-			$l = 2;
160
-		}
153
+                return array($lw, 1, $lfct);
154
+            }
155
+        }
156
+        $l    = 0;
157
+        $lfct = substr_count($this->text, "\n");
158
+        if ($lfct > 0) {
159
+            $l = 2;
160
+        }
161 161
 
162
-		return array($lw, $l, $lfct);
163
-	}
162
+        return array($lw, $l, $lfct);
163
+    }
164 164
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,13 +20,15 @@  discard block
 block discarded – undo
20 20
 /**
21 21
  * Class ReportPdfText
22 22
  */
23
-class ReportPdfText extends ReportBaseText {
23
+class ReportPdfText extends ReportBaseText
24
+{
24 25
 	/**
25 26
 	 * PDF Text renderer
26 27
 	 *
27 28
 	 * @param ReportTcpdf $renderer
28 29
 	 */
29
-	public function render($renderer) {
30
+	public function render($renderer)
31
+	{
30 32
 		// Set up the style
31 33
 		if ($renderer->getCurrentStyle() != $this->styleName) {
32 34
 			$renderer->setCurrentStyle($this->styleName);
@@ -72,7 +74,8 @@  discard block
 block discarded – undo
72 74
 	 *
73 75
 	 * @return float 0
74 76
 	 */
75
-	public function getHeight($pdf) {
77
+	public function getHeight($pdf)
78
+	{
76 79
 		return 0;
77 80
 	}
78 81
 
@@ -83,7 +86,8 @@  discard block
 block discarded – undo
83 86
 	 *
84 87
 	 * @return array
85 88
 	 */
86
-	public function getWidth($pdf) {
89
+	public function getWidth($pdf)
90
+	{
87 91
 		// Setup the style name, a font must be selected to calculate the width
88 92
 		if ($pdf->getCurrentStyle() != $this->styleName) {
89 93
 			$pdf->setCurrentStyle($this->styleName);
Please login to merge, or discard this patch.