xref: /webtrees/app/Report/ReportHtmlLine.php (revision a25f0a04682c4c39c1947220c90af4118c713952)
1<?php
2namespace 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		// TODO Non verticle or horizontal lines can use a series of divs absolutely positioned
44		// Vertical line
45		if ($this->x1 == $this->x2) {
46			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";
47		}
48		// Horizontal line
49		if ($this->y1 == $this->y2) {
50			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";
51		}
52		// Keep max Y updated
53		// One or the other will be higher... lasy mans way...
54		$renderer->addMaxY($this->y1);
55		$renderer->addMaxY($this->y2);
56	}
57}
58