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 ReportBaseFootnote 21 */ 22class ReportBaseFootnote extends ReportBaseElement { 23 /** 24 * The name of the style for this element 25 * 26 * @var string 27 */ 28 public $styleName = ""; 29 30 /** 31 * Numbers for the links 32 * 33 * @var int 34 */ 35 public $num; 36 37 /** 38 * The text that will be printed with the number 39 * 40 * @var string 41 */ 42 public $numText = ""; 43 44 /** 45 * Remaining width of a cell 46 * 47 * @var float User unit (points) 48 */ 49 public $wrapWidthRemaining; 50 51 /** 52 * Original width of a cell 53 * 54 * @var float User unit (points) 55 */ 56 public $wrapWidthCell; 57 58 public $addlink; 59 60 /** 61 * @param string $style 62 */ 63 function __construct($style = "") { 64 $this->text = ""; 65 if (!empty($style)) { 66 $this->styleName = $style; 67 } else { 68 $this->styleName = "footnote"; 69 } 70 71 return 0; 72 } 73 74 /** 75 * @param $t 76 * 77 * @return integer 78 */ 79 function addText($t) { 80 $t = trim($t, "\r\n\t"); 81 $t = str_replace(array("<br>", " "), array("\n", " "), $t); 82 $t = strip_tags($t); 83 $t = htmlspecialchars_decode($t); 84 $this->text .= $t; 85 86 return 0; 87 } 88 89 /** 90 * @param $wrapwidth 91 * @param $cellwidth 92 * 93 * @return mixed 94 */ 95 function setWrapWidth($wrapwidth, $cellwidth) { 96 $this->wrapWidthCell = $cellwidth; 97 if (strpos($this->numText, "\n") !== false) { 98 $this->wrapWidthRemaining = $cellwidth; 99 } else { 100 $this->wrapWidthRemaining = $wrapwidth; 101 } 102 103 return $this->wrapWidthRemaining; 104 } 105 106 /** 107 * @param $n 108 * 109 * @return integer 110 */ 111 function setNum($n) { 112 $this->num = $n; 113 $this->numText = "$n "; 114 115 return 0; 116 } 117 118 /** 119 * @param $a 120 * 121 * @return integer 122 */ 123 function setAddlink($a) { 124 $this->addlink = $a; 125 126 return 0; 127 } 128} 129