@@ -18,13 +18,15 @@ |
||
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); |
@@ -18,7 +18,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -20,13 +20,15 @@ |
||
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)) { |
@@ -21,7 +21,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -18,7 +18,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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>", " "), array("\n", " "), $t); |
66 | 71 | $t = strip_tags($t); |
@@ -75,7 +80,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -20,13 +20,15 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -18,14 +18,16 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Class ReportBasePageheader |
20 | 20 | */ |
21 | -class ReportBasePageheader extends ReportBaseElement { |
|
21 | +class ReportBasePageheader extends ReportBaseElement |
|
22 | +{ |
|
22 | 23 | /** @var ReportBaseElement[] Elements */ |
23 | 24 | public $elements = array(); |
24 | 25 | |
25 | 26 | /** |
26 | 27 | * Create a page header |
27 | 28 | */ |
28 | - public function __construct() { |
|
29 | + public function __construct() |
|
30 | + { |
|
29 | 31 | $this->elements = array(); |
30 | 32 | |
31 | 33 | return 0; |
@@ -36,7 +38,8 @@ discard block |
||
36 | 38 | * |
37 | 39 | * @return int |
38 | 40 | */ |
39 | - public function textBox() { |
|
41 | + public function textBox() |
|
42 | + { |
|
40 | 43 | $this->elements = array(); |
41 | 44 | |
42 | 45 | return 0; |
@@ -47,7 +50,8 @@ discard block |
||
47 | 50 | * |
48 | 51 | * @param ReportBaseElement $element |
49 | 52 | */ |
50 | - public function addElement($element) { |
|
53 | + public function addElement($element) |
|
54 | + { |
|
51 | 55 | $this->elements[] = $element; |
52 | 56 | } |
53 | 57 | } |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Class ReportParserGenerate - parse a report.xml file and generate the report. |
36 | 36 | */ |
37 | -class ReportParserGenerate extends ReportParserBase { |
|
37 | +class ReportParserGenerate extends ReportParserBase |
|
38 | +{ |
|
38 | 39 | /** @var bool Are we collecting data from <Footnote> elements */ |
39 | 40 | private $process_footnote = true; |
40 | 41 | |
@@ -121,7 +122,8 @@ discard block |
||
121 | 122 | * @param ReportBase $report_root |
122 | 123 | * @param string[][] $vars |
123 | 124 | */ |
124 | - public function __construct($report, ReportBase $report_root = null, array $vars = array()) { |
|
125 | + public function __construct($report, ReportBase $report_root = null, array $vars = array()) |
|
126 | + { |
|
125 | 127 | $this->report_root = $report_root; |
126 | 128 | $this->wt_report = $report_root; |
127 | 129 | $this->current_element = new ReportBaseElement; |
@@ -139,7 +141,8 @@ discard block |
||
139 | 141 | * @param string $name the name of the XML element parsed |
140 | 142 | * @param array $attrs an array of key value pairs for the attributes |
141 | 143 | */ |
142 | - protected function startElement($parser, $name, $attrs) { |
|
144 | + protected function startElement($parser, $name, $attrs) |
|
145 | + { |
|
143 | 146 | $newattrs = array(); |
144 | 147 | |
145 | 148 | foreach ($attrs as $key => $value) { |
@@ -171,7 +174,8 @@ discard block |
||
171 | 174 | * @param resource $parser the resource handler for the XML parser |
172 | 175 | * @param string $name the name of the XML element parsed |
173 | 176 | */ |
174 | - protected function endElement($parser, $name) { |
|
177 | + protected function endElement($parser, $name) |
|
178 | + { |
|
175 | 179 | if (($this->process_footnote || $name === "Footnote") && ($this->process_ifs === 0 || $name === "if") && ($this->process_gedcoms === 0 || $name === "Gedcom") && ($this->process_repeats === 0 || $name === "Facts" || $name === "RepeatTag" || $name === "List" || $name === "Relatives")) { |
176 | 180 | $start_method = $name . 'StartHandler'; |
177 | 181 | $end_method = $name . 'EndHandler'; |
@@ -189,7 +193,8 @@ discard block |
||
189 | 193 | * @param resource $parser the resource handler for the XML parser |
190 | 194 | * @param string $data the name of the XML element parsed |
191 | 195 | */ |
192 | - protected function characterData($parser, $data) { |
|
196 | + protected function characterData($parser, $data) |
|
197 | + { |
|
193 | 198 | if ($this->print_data && $this->process_gedcoms === 0 && $this->process_ifs === 0 && $this->process_repeats === 0) { |
194 | 199 | $this->current_element->addText($data); |
195 | 200 | } |
@@ -200,7 +205,8 @@ discard block |
||
200 | 205 | * |
201 | 206 | * @param array $attrs an array of key value pairs for the attributes |
202 | 207 | */ |
203 | - private function styleStartHandler($attrs) { |
|
208 | + private function styleStartHandler($attrs) |
|
209 | + { |
|
204 | 210 | if (empty($attrs['name'])) { |
205 | 211 | throw new \DomainException('REPORT ERROR Style: The "name" of the style is missing or not set in the XML file.'); |
206 | 212 | } |
@@ -239,7 +245,8 @@ discard block |
||
239 | 245 | * |
240 | 246 | * @param array $attrs an array of key value pairs for the attributes |
241 | 247 | */ |
242 | - private function docStartHandler($attrs) { |
|
248 | + private function docStartHandler($attrs) |
|
249 | + { |
|
243 | 250 | $this->parser = $this->xml_parser; |
244 | 251 | |
245 | 252 | // Custom page width |
@@ -328,14 +335,16 @@ discard block |
||
328 | 335 | /** |
329 | 336 | * XML </Doc> |
330 | 337 | */ |
331 | - private function docEndHandler() { |
|
338 | + private function docEndHandler() |
|
339 | + { |
|
332 | 340 | $this->wt_report->run(); |
333 | 341 | } |
334 | 342 | |
335 | 343 | /** |
336 | 344 | * XML <Header> |
337 | 345 | */ |
338 | - private function headerStartHandler() { |
|
346 | + private function headerStartHandler() |
|
347 | + { |
|
339 | 348 | // Clear the Header before any new elements are added |
340 | 349 | $this->wt_report->clearHeader(); |
341 | 350 | $this->wt_report->setProcessing("H"); |
@@ -344,7 +353,8 @@ discard block |
||
344 | 353 | /** |
345 | 354 | * XML <PageHeader> |
346 | 355 | */ |
347 | - private function pageHeaderStartHandler() { |
|
356 | + private function pageHeaderStartHandler() |
|
357 | + { |
|
348 | 358 | array_push($this->print_data_stack, $this->print_data); |
349 | 359 | $this->print_data = false; |
350 | 360 | array_push($this->wt_report_stack, $this->wt_report); |
@@ -354,7 +364,8 @@ discard block |
||
354 | 364 | /** |
355 | 365 | * XML <pageHeaderEndHandler> |
356 | 366 | */ |
357 | - private function pageHeaderEndHandler() { |
|
367 | + private function pageHeaderEndHandler() |
|
368 | + { |
|
358 | 369 | $this->print_data = array_pop($this->print_data_stack); |
359 | 370 | $this->current_element = $this->wt_report; |
360 | 371 | $this->wt_report = array_pop($this->wt_report_stack); |
@@ -364,14 +375,16 @@ discard block |
||
364 | 375 | /** |
365 | 376 | * XML <bodyStartHandler> |
366 | 377 | */ |
367 | - private function bodyStartHandler() { |
|
378 | + private function bodyStartHandler() |
|
379 | + { |
|
368 | 380 | $this->wt_report->setProcessing("B"); |
369 | 381 | } |
370 | 382 | |
371 | 383 | /** |
372 | 384 | * XML <footerStartHandler> |
373 | 385 | */ |
374 | - private function footerStartHandler() { |
|
386 | + private function footerStartHandler() |
|
387 | + { |
|
375 | 388 | $this->wt_report->setProcessing("F"); |
376 | 389 | } |
377 | 390 | |
@@ -380,7 +393,8 @@ discard block |
||
380 | 393 | * |
381 | 394 | * @param array $attrs an array of key value pairs for the attributes |
382 | 395 | */ |
383 | - private function cellStartHandler($attrs) { |
|
396 | + private function cellStartHandler($attrs) |
|
397 | + { |
|
384 | 398 | // string The text alignment of the text in this box. |
385 | 399 | $align = ""; |
386 | 400 | if (!empty($attrs['align'])) { |
@@ -534,7 +548,8 @@ discard block |
||
534 | 548 | /** |
535 | 549 | * XML </Cell> |
536 | 550 | */ |
537 | - private function cellEndHandler() { |
|
551 | + private function cellEndHandler() |
|
552 | + { |
|
538 | 553 | $this->print_data = array_pop($this->print_data_stack); |
539 | 554 | $this->wt_report->addElement($this->current_element); |
540 | 555 | } |
@@ -542,7 +557,8 @@ discard block |
||
542 | 557 | /** |
543 | 558 | * XML <Now /> element handler |
544 | 559 | */ |
545 | - private function nowStartHandler() { |
|
560 | + private function nowStartHandler() |
|
561 | + { |
|
546 | 562 | $g = FunctionsDate::timestampToGedcomDate(WT_TIMESTAMP + WT_TIMESTAMP_OFFSET); |
547 | 563 | $this->current_element->addText($g->display()); |
548 | 564 | } |
@@ -550,14 +566,16 @@ discard block |
||
550 | 566 | /** |
551 | 567 | * XML <PageNum /> element handler |
552 | 568 | */ |
553 | - private function pageNumStartHandler() { |
|
569 | + private function pageNumStartHandler() |
|
570 | + { |
|
554 | 571 | $this->current_element->addText("#PAGENUM#"); |
555 | 572 | } |
556 | 573 | |
557 | 574 | /** |
558 | 575 | * XML <TotalPages /> element handler |
559 | 576 | */ |
560 | - private function totalPagesStartHandler() { |
|
577 | + private function totalPagesStartHandler() |
|
578 | + { |
|
561 | 579 | $this->current_element->addText("{{:ptp:}}"); |
562 | 580 | } |
563 | 581 | |
@@ -566,7 +584,8 @@ discard block |
||
566 | 584 | * |
567 | 585 | * @param array $attrs an array of key value pairs for the attributes |
568 | 586 | */ |
569 | - private function gedcomStartHandler($attrs) { |
|
587 | + private function gedcomStartHandler($attrs) |
|
588 | + { |
|
570 | 589 | global $WT_TREE; |
571 | 590 | |
572 | 591 | if ($this->process_gedcoms > 0) { |
@@ -629,7 +648,8 @@ discard block |
||
629 | 648 | /** |
630 | 649 | * Called at the end of an element. |
631 | 650 | */ |
632 | - private function gedcomEndHandler() { |
|
651 | + private function gedcomEndHandler() |
|
652 | + { |
|
633 | 653 | if ($this->process_gedcoms > 0) { |
634 | 654 | $this->process_gedcoms--; |
635 | 655 | } else { |
@@ -642,7 +662,8 @@ discard block |
||
642 | 662 | * |
643 | 663 | * @param array $attrs an array of key value pairs for the attributes |
644 | 664 | */ |
645 | - private function textBoxStartHandler($attrs) { |
|
665 | + private function textBoxStartHandler($attrs) |
|
666 | + { |
|
646 | 667 | // string Background color code |
647 | 668 | $bgcolor = ""; |
648 | 669 | if (!empty($attrs['bgcolor'])) { |
@@ -765,7 +786,8 @@ discard block |
||
765 | 786 | /** |
766 | 787 | * XML <textBoxEndHandler> |
767 | 788 | */ |
768 | - private function textBoxEndHandler() { |
|
789 | + private function textBoxEndHandler() |
|
790 | + { |
|
769 | 791 | $this->print_data = array_pop($this->print_data_stack); |
770 | 792 | $this->current_element = $this->wt_report; |
771 | 793 | $this->wt_report = array_pop($this->wt_report_stack); |
@@ -777,7 +799,8 @@ discard block |
||
777 | 799 | * |
778 | 800 | * @param array $attrs an array of key value pairs for the attributes |
779 | 801 | */ |
780 | - private function textStartHandler($attrs) { |
|
802 | + private function textStartHandler($attrs) |
|
803 | + { |
|
781 | 804 | array_push($this->print_data_stack, $this->print_data); |
782 | 805 | $this->print_data = true; |
783 | 806 | |
@@ -799,7 +822,8 @@ discard block |
||
799 | 822 | /** |
800 | 823 | * XML </Text> |
801 | 824 | */ |
802 | - private function textEndHandler() { |
|
825 | + private function textEndHandler() |
|
826 | + { |
|
803 | 827 | $this->print_data = array_pop($this->print_data_stack); |
804 | 828 | $this->wt_report->addElement($this->current_element); |
805 | 829 | } |
@@ -813,7 +837,8 @@ discard block |
||
813 | 837 | * |
814 | 838 | * @param array $attrs an array of key value pairs for the attributes |
815 | 839 | */ |
816 | - private function getPersonNameStartHandler($attrs) { |
|
840 | + private function getPersonNameStartHandler($attrs) |
|
841 | + { |
|
817 | 842 | global $WT_TREE; |
818 | 843 | |
819 | 844 | $id = ""; |
@@ -896,7 +921,8 @@ discard block |
||
896 | 921 | * |
897 | 922 | * @param array $attrs an array of key value pairs for the attributes |
898 | 923 | */ |
899 | - private function gedcomValueStartHandler($attrs) { |
|
924 | + private function gedcomValueStartHandler($attrs) |
|
925 | + { |
|
900 | 926 | global $WT_TREE; |
901 | 927 | |
902 | 928 | $id = ""; |
@@ -967,7 +993,8 @@ discard block |
||
967 | 993 | * |
968 | 994 | * @param array $attrs an array of key value pairs for the attributes |
969 | 995 | */ |
970 | - private function repeatTagStartHandler($attrs) { |
|
996 | + private function repeatTagStartHandler($attrs) |
|
997 | + { |
|
971 | 998 | global $WT_TREE; |
972 | 999 | |
973 | 1000 | $this->process_repeats++; |
@@ -1039,7 +1066,8 @@ discard block |
||
1039 | 1066 | /** |
1040 | 1067 | * XML </ RepeatTag> |
1041 | 1068 | */ |
1042 | - private function repeatTagEndHandler() { |
|
1069 | + private function repeatTagEndHandler() |
|
1070 | + { |
|
1043 | 1071 | global $report; |
1044 | 1072 | |
1045 | 1073 | $this->process_repeats--; |
@@ -1118,7 +1146,8 @@ discard block |
||
1118 | 1146 | * |
1119 | 1147 | * @param array $attrs an array of key value pairs for the attributes |
1120 | 1148 | */ |
1121 | - private function varStartHandler($attrs) { |
|
1149 | + private function varStartHandler($attrs) |
|
1150 | + { |
|
1122 | 1151 | if (empty($attrs['var'])) { |
1123 | 1152 | throw new \DomainException('REPORT ERROR var: The attribute "var=" is missing or not set in the XML file on line: ' . xml_get_current_line_number($this->parser)); |
1124 | 1153 | } |
@@ -1159,7 +1188,8 @@ discard block |
||
1159 | 1188 | * |
1160 | 1189 | * @param array $attrs an array of key value pairs for the attributes |
1161 | 1190 | */ |
1162 | - private function factsStartHandler($attrs) { |
|
1191 | + private function factsStartHandler($attrs) |
|
1192 | + { |
|
1163 | 1193 | global $WT_TREE; |
1164 | 1194 | |
1165 | 1195 | $this->process_repeats++; |
@@ -1207,7 +1237,8 @@ discard block |
||
1207 | 1237 | /** |
1208 | 1238 | * XML </Facts> |
1209 | 1239 | */ |
1210 | - private function factsEndHandler() { |
|
1240 | + private function factsEndHandler() |
|
1241 | + { |
|
1211 | 1242 | global $report; |
1212 | 1243 | |
1213 | 1244 | $this->process_repeats--; |
@@ -1290,7 +1321,8 @@ discard block |
||
1290 | 1321 | * |
1291 | 1322 | * @param array $attrs an array of key value pairs for the attributes |
1292 | 1323 | */ |
1293 | - private function setVarStartHandler($attrs) { |
|
1324 | + private function setVarStartHandler($attrs) |
|
1325 | + { |
|
1294 | 1326 | if (empty($attrs['name'])) { |
1295 | 1327 | throw new \DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file'); |
1296 | 1328 | } |
@@ -1364,7 +1396,8 @@ discard block |
||
1364 | 1396 | * |
1365 | 1397 | * @param array $attrs an array of key value pairs for the attributes |
1366 | 1398 | */ |
1367 | - private function ifStartHandler($attrs) { |
|
1399 | + private function ifStartHandler($attrs) |
|
1400 | + { |
|
1368 | 1401 | if ($this->process_ifs > 0) { |
1369 | 1402 | $this->process_ifs++; |
1370 | 1403 | |
@@ -1419,7 +1452,8 @@ discard block |
||
1419 | 1452 | /** |
1420 | 1453 | * XML <if /> end element |
1421 | 1454 | */ |
1422 | - private function ifEndHandler() { |
|
1455 | + private function ifEndHandler() |
|
1456 | + { |
|
1423 | 1457 | if ($this->process_ifs > 0) { |
1424 | 1458 | $this->process_ifs--; |
1425 | 1459 | } |
@@ -1432,7 +1466,8 @@ discard block |
||
1432 | 1466 | * |
1433 | 1467 | * @param array $attrs an array of key value pairs for the attributes |
1434 | 1468 | */ |
1435 | - private function footnoteStartHandler($attrs) { |
|
1469 | + private function footnoteStartHandler($attrs) |
|
1470 | + { |
|
1436 | 1471 | global $WT_TREE; |
1437 | 1472 | |
1438 | 1473 | $id = ""; |
@@ -1459,7 +1494,8 @@ discard block |
||
1459 | 1494 | * XML <Footnote /> end element |
1460 | 1495 | * Print the collected Footnote data |
1461 | 1496 | */ |
1462 | - private function footnoteEndHandler() { |
|
1497 | + private function footnoteEndHandler() |
|
1498 | + { |
|
1463 | 1499 | if ($this->process_footnote) { |
1464 | 1500 | $this->print_data = array_pop($this->print_data_stack); |
1465 | 1501 | $temp = trim($this->current_element->getValue()); |
@@ -1475,7 +1511,8 @@ discard block |
||
1475 | 1511 | /** |
1476 | 1512 | * XML <FootnoteTexts /> element |
1477 | 1513 | */ |
1478 | - private function footnoteTextsStartHandler() { |
|
1514 | + private function footnoteTextsStartHandler() |
|
1515 | + { |
|
1479 | 1516 | $temp = "footnotetexts"; |
1480 | 1517 | $this->wt_report->addElement($temp); |
1481 | 1518 | } |
@@ -1483,7 +1520,8 @@ discard block |
||
1483 | 1520 | /** |
1484 | 1521 | * XML <AgeAtDeath /> element handler |
1485 | 1522 | */ |
1486 | - private function ageAtDeathStartHandler() { |
|
1523 | + private function ageAtDeathStartHandler() |
|
1524 | + { |
|
1487 | 1525 | // This duplicates functionality in FunctionsPrint::format_fact_date() |
1488 | 1526 | global $factrec, $WT_TREE; |
1489 | 1527 | |
@@ -1540,7 +1578,8 @@ discard block |
||
1540 | 1578 | /** |
1541 | 1579 | * XML element Forced line break handler - HTML code |
1542 | 1580 | */ |
1543 | - private function brStartHandler() { |
|
1581 | + private function brStartHandler() |
|
1582 | + { |
|
1544 | 1583 | if ($this->print_data && $this->process_gedcoms === 0) { |
1545 | 1584 | $this->current_element->addText('<br>'); |
1546 | 1585 | } |
@@ -1549,7 +1588,8 @@ discard block |
||
1549 | 1588 | /** |
1550 | 1589 | * XML <sp />element Forced space handler |
1551 | 1590 | */ |
1552 | - private function spStartHandler() { |
|
1591 | + private function spStartHandler() |
|
1592 | + { |
|
1553 | 1593 | if ($this->print_data && $this->process_gedcoms === 0) { |
1554 | 1594 | $this->current_element->addText(' '); |
1555 | 1595 | } |
@@ -1560,7 +1600,8 @@ discard block |
||
1560 | 1600 | * |
1561 | 1601 | * @param array $attrs an array of key value pairs for the attributes |
1562 | 1602 | */ |
1563 | - private function highlightedImageStartHandler($attrs) { |
|
1603 | + private function highlightedImageStartHandler($attrs) |
|
1604 | + { |
|
1564 | 1605 | global $WT_TREE; |
1565 | 1606 | |
1566 | 1607 | $id = ''; |
@@ -1661,7 +1702,8 @@ discard block |
||
1661 | 1702 | * |
1662 | 1703 | * @param array $attrs an array of key value pairs for the attributes |
1663 | 1704 | */ |
1664 | - private function imageStartHandler($attrs) { |
|
1705 | + private function imageStartHandler($attrs) |
|
1706 | + { |
|
1665 | 1707 | global $WT_TREE; |
1666 | 1708 | |
1667 | 1709 | // mixed Position the top corner of this box on the page. the default is the current position |
@@ -1778,7 +1820,8 @@ discard block |
||
1778 | 1820 | * |
1779 | 1821 | * @param array $attrs an array of key value pairs for the attributes |
1780 | 1822 | */ |
1781 | - private function lineStartHandler($attrs) { |
|
1823 | + private function lineStartHandler($attrs) |
|
1824 | + { |
|
1782 | 1825 | // Start horizontal position, current position (default) |
1783 | 1826 | $x1 = "."; |
1784 | 1827 | if (isset($attrs['x1'])) { |
@@ -1833,7 +1876,8 @@ discard block |
||
1833 | 1876 | * |
1834 | 1877 | * @param array $attrs an array of key value pairs for the attributes |
1835 | 1878 | */ |
1836 | - private function listStartHandler($attrs) { |
|
1879 | + private function listStartHandler($attrs) |
|
1880 | + { |
|
1837 | 1881 | global $WT_TREE; |
1838 | 1882 | |
1839 | 1883 | $this->process_repeats++; |
@@ -2212,7 +2256,8 @@ discard block |
||
2212 | 2256 | /** |
2213 | 2257 | * XML <List> |
2214 | 2258 | */ |
2215 | - private function listEndHandler() { |
|
2259 | + private function listEndHandler() |
|
2260 | + { |
|
2216 | 2261 | global $report; |
2217 | 2262 | |
2218 | 2263 | $this->process_repeats--; |
@@ -2291,7 +2336,8 @@ discard block |
||
2291 | 2336 | * The total number is collected from |
2292 | 2337 | * List and Relatives |
2293 | 2338 | */ |
2294 | - private function listTotalStartHandler() { |
|
2339 | + private function listTotalStartHandler() |
|
2340 | + { |
|
2295 | 2341 | if ($this->list_private == 0) { |
2296 | 2342 | $this->current_element->addText($this->list_total); |
2297 | 2343 | } else { |
@@ -2304,7 +2350,8 @@ discard block |
||
2304 | 2350 | * |
2305 | 2351 | * @param array $attrs an array of key value pairs for the attributes |
2306 | 2352 | */ |
2307 | - private function relativesStartHandler($attrs) { |
|
2353 | + private function relativesStartHandler($attrs) |
|
2354 | + { |
|
2308 | 2355 | global $WT_TREE; |
2309 | 2356 | |
2310 | 2357 | $this->process_repeats++; |
@@ -2443,7 +2490,8 @@ discard block |
||
2443 | 2490 | /** |
2444 | 2491 | * XML </ Relatives> |
2445 | 2492 | */ |
2446 | - private function relativesEndHandler() { |
|
2493 | + private function relativesEndHandler() |
|
2494 | + { |
|
2447 | 2495 | global $report, $WT_TREE; |
2448 | 2496 | |
2449 | 2497 | $this->process_repeats--; |
@@ -2518,7 +2566,8 @@ discard block |
||
2518 | 2566 | * |
2519 | 2567 | * Prints the number of generations |
2520 | 2568 | */ |
2521 | - private function generationStartHandler() { |
|
2569 | + private function generationStartHandler() |
|
2570 | + { |
|
2522 | 2571 | $this->current_element->addText($this->generation); |
2523 | 2572 | } |
2524 | 2573 | |
@@ -2527,7 +2576,8 @@ discard block |
||
2527 | 2576 | * |
2528 | 2577 | * Has to be placed in an element (header, pageheader, body or footer) |
2529 | 2578 | */ |
2530 | - private function newPageStartHandler() { |
|
2579 | + private function newPageStartHandler() |
|
2580 | + { |
|
2531 | 2581 | $temp = "addpage"; |
2532 | 2582 | $this->wt_report->addElement($temp); |
2533 | 2583 | } |
@@ -2538,7 +2588,8 @@ discard block |
||
2538 | 2588 | * @param string $tag HTML tag name |
2539 | 2589 | * @param array[] $attrs an array of key value pairs for the attributes |
2540 | 2590 | */ |
2541 | - private function htmlStartHandler($tag, $attrs) { |
|
2591 | + private function htmlStartHandler($tag, $attrs) |
|
2592 | + { |
|
2542 | 2593 | if ($tag === "tempdoc") { |
2543 | 2594 | return; |
2544 | 2595 | } |
@@ -2555,7 +2606,8 @@ discard block |
||
2555 | 2606 | * |
2556 | 2607 | * @param string $tag |
2557 | 2608 | */ |
2558 | - private function htmlEndHandler($tag) { |
|
2609 | + private function htmlEndHandler($tag) |
|
2610 | + { |
|
2559 | 2611 | if ($tag === "tempdoc") { |
2560 | 2612 | return; |
2561 | 2613 | } |
@@ -2573,42 +2625,48 @@ discard block |
||
2573 | 2625 | /** |
2574 | 2626 | * Handle <Input> |
2575 | 2627 | */ |
2576 | - private function inputStartHandler() { |
|
2628 | + private function inputStartHandler() |
|
2629 | + { |
|
2577 | 2630 | // Dummy function, to prevent the default HtmlStartHandler() being called |
2578 | 2631 | } |
2579 | 2632 | |
2580 | 2633 | /** |
2581 | 2634 | * Handle </Input> |
2582 | 2635 | */ |
2583 | - private function inputEndHandler() { |
|
2636 | + private function inputEndHandler() |
|
2637 | + { |
|
2584 | 2638 | // Dummy function, to prevent the default HtmlEndHandler() being called |
2585 | 2639 | } |
2586 | 2640 | |
2587 | 2641 | /** |
2588 | 2642 | * Handle <Report> |
2589 | 2643 | */ |
2590 | - private function reportStartHandler() { |
|
2644 | + private function reportStartHandler() |
|
2645 | + { |
|
2591 | 2646 | // Dummy function, to prevent the default HtmlStartHandler() being called |
2592 | 2647 | } |
2593 | 2648 | |
2594 | 2649 | /** |
2595 | 2650 | * Handle </Report> |
2596 | 2651 | */ |
2597 | - private function reportEndHandler() { |
|
2652 | + private function reportEndHandler() |
|
2653 | + { |
|
2598 | 2654 | // Dummy function, to prevent the default HtmlEndHandler() being called |
2599 | 2655 | } |
2600 | 2656 | |
2601 | 2657 | /** |
2602 | 2658 | * XML </titleEndHandler> |
2603 | 2659 | */ |
2604 | - private function titleEndHandler() { |
|
2660 | + private function titleEndHandler() |
|
2661 | + { |
|
2605 | 2662 | $this->report_root->addTitle($this->text); |
2606 | 2663 | } |
2607 | 2664 | |
2608 | 2665 | /** |
2609 | 2666 | * XML </descriptionEndHandler> |
2610 | 2667 | */ |
2611 | - private function descriptionEndHandler() { |
|
2668 | + private function descriptionEndHandler() |
|
2669 | + { |
|
2612 | 2670 | $this->report_root->addDescription($this->text); |
2613 | 2671 | } |
2614 | 2672 | |
@@ -2620,7 +2678,8 @@ discard block |
||
2620 | 2678 | * @param bool $parents |
2621 | 2679 | * @param int $generations |
2622 | 2680 | */ |
2623 | - private function addDescendancy(&$list, $pid, $parents = false, $generations = -1) { |
|
2681 | + private function addDescendancy(&$list, $pid, $parents = false, $generations = -1) |
|
2682 | + { |
|
2624 | 2683 | global $WT_TREE; |
2625 | 2684 | |
2626 | 2685 | $person = Individual::getInstance($pid, $WT_TREE); |
@@ -2681,7 +2740,8 @@ discard block |
||
2681 | 2740 | * @param bool $children |
2682 | 2741 | * @param int $generations |
2683 | 2742 | */ |
2684 | - private function addAncestors(&$list, $pid, $children = false, $generations = -1) { |
|
2743 | + private function addAncestors(&$list, $pid, $children = false, $generations = -1) |
|
2744 | + { |
|
2685 | 2745 | global $WT_TREE; |
2686 | 2746 | |
2687 | 2747 | $genlist = array($pid); |
@@ -2734,7 +2794,8 @@ discard block |
||
2734 | 2794 | * |
2735 | 2795 | * @return string the value of a gedcom tag from the given gedcom record |
2736 | 2796 | */ |
2737 | - private function getGedcomValue($tag, $level, $gedrec) { |
|
2797 | + private function getGedcomValue($tag, $level, $gedrec) |
|
2798 | + { |
|
2738 | 2799 | global $WT_TREE; |
2739 | 2800 | |
2740 | 2801 | if (empty($gedrec)) { |
@@ -2810,7 +2871,8 @@ discard block |
||
2810 | 2871 | * |
2811 | 2872 | * @return string |
2812 | 2873 | */ |
2813 | - private function substituteVars($expression, $quote) { |
|
2874 | + private function substituteVars($expression, $quote) |
|
2875 | + { |
|
2814 | 2876 | $that = $this; // PHP5.3 cannot access $this inside a closure |
2815 | 2877 | return preg_replace_callback( |
2816 | 2878 | '/\$(\w+)/', |
@@ -18,13 +18,15 @@ |
||
18 | 18 | /** |
19 | 19 | * Class ReportHtmlTextbox |
20 | 20 | */ |
21 | -class ReportHtmlTextbox extends ReportBaseTextbox { |
|
21 | +class ReportHtmlTextbox extends ReportBaseTextbox |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * Render the elements. |
24 | 25 | * |
25 | 26 | * @param ReportHtml $renderer |
26 | 27 | */ |
27 | - public function render($renderer) { |
|
28 | + public function render($renderer) |
|
29 | + { |
|
28 | 30 | // checkFootnote |
29 | 31 | $newelements = array(); |
30 | 32 | $lastelement = array(); |