xref: /webtrees/app/Report/ReportHtmlLine.php (revision b90d8acc82ea3080403ec948fc3f1106a64e74cc)
1<?php
2namespace Fisharebest\Webtrees;
3
4/**
5 * webtrees: online genealogy
6 * Copyright (C) 2015 webtrees development team
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * Class ReportHtmlLine
21 */
22class ReportHtmlLine extends ReportBaseLine {
23	/**
24	 * HTML line renderer
25	 *
26	 * @param ReportHtml $renderer
27	 *
28	 * @return void
29	 */
30	function render($renderer) {
31		if ($this->x1 == '.') {
32			$this->x1 = $renderer->getX();
33		}
34		if ($this->y1 == '.') {
35			$this->y1 = $renderer->getY();
36		}
37		if ($this->x2 == '.') {
38			$this->x2 = $renderer->getRemainingWidth();
39		}
40		if ($this->y2 == '.') {
41			$this->y2 = $renderer->getY();
42		}
43		// Vertical line
44		if ($this->x1 == $this->x2) {
45			echo "<div style=\"position:absolute;overflow:hidden;border-", $renderer->alignRTL, ":solid black 1pt;", $renderer->alignRTL, ":", $this->x1, "pt;top:", $this->y1 + 1, "pt;width:1pt;height:", $this->y2 - $this->y1, "pt;\"> </div>\n";
46		}
47		// Horizontal line
48		if ($this->y1 == $this->y2) {
49			echo "<div style=\"position:absolute;overflow:hidden;border-top:solid black 1pt;", $renderer->alignRTL, ":", $this->x1, "pt;top:", $this->y1 + 1, "pt;width:", $this->x2 - $this->x1, "pt;height:1pt;\"> </div>\n";
50		}
51		// Keep max Y updated
52		// One or the other will be higher... lasy mans way...
53		$renderer->addMaxY($this->y1);
54		$renderer->addMaxY($this->y2);
55	}
56}
57