xref: /webtrees/app/Report/ReportHtmlLine.php (revision cbc1590a8c715aa2d88bd745610b899587bd9563)
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	public function render($renderer) {
29		if ($this->x1 == '.') {
30			$this->x1 = $renderer->getX();
31		}
32		if ($this->y1 == '.') {
33			$this->y1 = $renderer->getY();
34		}
35		if ($this->x2 == '.') {
36			$this->x2 = $renderer->getRemainingWidth();
37		}
38		if ($this->y2 == '.') {
39			$this->y2 = $renderer->getY();
40		}
41		// Vertical line
42		if ($this->x1 == $this->x2) {
43			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";
44		}
45		// Horizontal line
46		if ($this->y1 == $this->y2) {
47			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";
48		}
49		// Keep max Y updated
50		// One or the other will be higher... lasy mans way...
51		$renderer->addMaxY($this->y1);
52		$renderer->addMaxY($this->y2);
53	}
54}
55