summaryrefslogtreecommitdiff
path: root/app/Report/ReportBaseElement.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-02-01 00:01:36 +0000
committerGreg Roach <fisharebest@gmail.com>2015-02-02 17:34:31 +0000
commita25f0a04682c4c39c1947220c90af4118c713952 (patch)
treef7e9c2c630a50dd3e5dd76ce501dff4b1d8d4c26 /app/Report/ReportBaseElement.php
parent4d2a5476ceb1c11dc1fd146bfb0be077baa5fb01 (diff)
downloadwebtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.gz
webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.bz2
webtrees-a25f0a04682c4c39c1947220c90af4118c713952.zip
Refactor classes to use namespaces, as per PSR-4. Replace GPL2 with GPL3.
Diffstat (limited to 'app/Report/ReportBaseElement.php')
-rw-r--r--app/Report/ReportBaseElement.php136
1 files changed, 136 insertions, 0 deletions
diff --git a/app/Report/ReportBaseElement.php b/app/Report/ReportBaseElement.php
new file mode 100644
index 0000000000..5e09630ecf
--- /dev/null
+++ b/app/Report/ReportBaseElement.php
@@ -0,0 +1,136 @@
+<?php
+namespace Webtrees;
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2015 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Class ReportBaseElement
+ */
+class ReportBaseElement {
+ /**
+ * @var string
+ */
+ public $text = "";
+
+ /**
+ * Element renderer
+
+
+
+*
+*@param ReportHtml|PDF $renderer
+
+
+
+*
+*@return void
+ */
+ function render($renderer) {
+ //-- to be implemented in inherited classes
+ }
+
+ /**
+ * @param ReportHtml|PDF $renderer
+
+
+
+*
+*@return float
+ */
+ function getHeight($renderer) {
+ return 0.0;
+ }
+
+ /**
+ * @param ReportHtml|PDF $renderer
+
+
+
+*
+*@return float
+ */
+ function getWidth($renderer) {
+ return 0.0;
+ }
+
+ /**
+ * @param string $t
+ *
+ * @return integer
+ */
+ function addText($t) {
+ global $wt_report, $reportTitle, $reportDescription;
+
+ $t = trim($t, "\r\n\t");
+ $t = str_replace(array("<br>", "&nbsp;"), array("\n", " "), $t);
+ $t = strip_tags($t);
+ $t = htmlspecialchars_decode($t);
+ $this->text .= $t;
+
+ // Adding the title and description to the Document Properties
+ if ($reportTitle) {
+ $wt_report->addTitle($t);
+ } elseif ($reportDescription) {
+ $wt_report->addDescription($t);
+ }
+
+ return 0;
+ }
+
+ /**
+ * @return integer
+ */
+ function addNewline() {
+ $this->text .= "\n";
+
+ return 0;
+ }
+
+ /**
+ * @return string
+ */
+ function getValue() {
+ return $this->text;
+ }
+
+ /**
+ * @param $wrapwidth
+ * @param $cellwidth
+ *
+ * @return integer
+ */
+ function setWrapWidth($wrapwidth, $cellwidth) {
+ return 0;
+ }
+
+ /**
+ * @param $renderer
+ *
+ * @return void
+ */
+ function renderFootnote($renderer) {
+ // To be implemented in inherited classes
+ }
+
+ /**
+ * @param $text
+ *
+ * @return void
+ */
+ function setText($text) {
+ $this->text = $text;
+ }
+}