1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* webtrees: online genealogy |
4
|
|
|
* Copyright (C) 2019 webtrees development team |
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU General Public License as published by |
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* This program is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU General Public License for more details. |
13
|
|
|
* You should have received a copy of the GNU General Public License |
14
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
15
|
|
|
*/ |
16
|
|
|
namespace Fisharebest\Webtrees\Report; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class ReportBaseFootnote |
20
|
|
|
*/ |
21
|
|
|
class ReportBaseFootnote extends ReportBaseElement |
22
|
|
|
{ |
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
|
|
|
/** @var string A link */ |
59
|
|
|
public $addlink; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Createa an element. |
63
|
|
|
* |
64
|
|
|
* @param string $style |
65
|
|
|
*/ |
66
|
|
|
public function __construct($style = "") |
67
|
|
|
{ |
68
|
|
|
$this->text = ""; |
69
|
|
|
if (!empty($style)) { |
70
|
|
|
$this->styleName = $style; |
71
|
|
|
} else { |
72
|
|
|
$this->styleName = "footnote"; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Set the width to wrap text. |
78
|
|
|
* |
79
|
|
|
* @param $wrapwidth |
80
|
|
|
* @param $cellwidth |
81
|
|
|
* |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
public function setWrapWidth($wrapwidth, $cellwidth) |
85
|
|
|
{ |
86
|
|
|
$this->wrapWidthCell = $cellwidth; |
87
|
|
|
if (strpos($this->numText, "\n") !== false) { |
88
|
|
|
$this->wrapWidthRemaining = $cellwidth; |
89
|
|
|
} else { |
90
|
|
|
$this->wrapWidthRemaining = $wrapwidth; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
return $this->wrapWidthRemaining; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Set the number. |
98
|
|
|
* |
99
|
|
|
* @param $n |
100
|
|
|
* |
101
|
|
|
* @return int |
102
|
|
|
*/ |
103
|
|
|
public function setNum($n) |
104
|
|
|
{ |
105
|
|
|
$this->num = $n; |
106
|
|
|
$this->numText = "$n "; |
107
|
|
|
|
108
|
|
|
return 0; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Add a link. |
113
|
|
|
* |
114
|
|
|
* @param $a |
115
|
|
|
* |
116
|
|
|
* @return int |
117
|
|
|
*/ |
118
|
|
|
public function setAddlink($a) |
119
|
|
|
{ |
120
|
|
|
$this->addlink = $a; |
121
|
|
|
|
122
|
|
|
return 0; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|