xref: /webtrees/app/Report/ReportBaseCell.php (revision ffd703ea1e658c7dcb5e5f1f9ef137a420f2d167)
1a25f0a04SGreg Roach<?php
2dd04c183SGreg Roachnamespace Fisharebest\Webtrees;
3a25f0a04SGreg Roach
4a25f0a04SGreg Roach/**
5a25f0a04SGreg Roach * webtrees: online genealogy
6a25f0a04SGreg Roach * Copyright (C) 2015 webtrees development team
7a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
8a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
9a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
10a25f0a04SGreg Roach * (at your option) any later version.
11a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
12a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
13a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14a25f0a04SGreg Roach * GNU General Public License for more details.
15a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
16a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
17a25f0a04SGreg Roach */
18a25f0a04SGreg Roach
19a25f0a04SGreg Roach/**
20a25f0a04SGreg Roach * Class ReportBaseCell
21a25f0a04SGreg Roach */
22a25f0a04SGreg Roachclass ReportBaseCell extends ReportBaseElement {
23a25f0a04SGreg Roach	/**
24a25f0a04SGreg Roach	 * Allows to center or align the text. Possible values are:<ul><li>left or empty string: left align</li><li>center: center align</li><li>right: right align</li><li>justify: justification (default value when $ishtml=false)</li></ul>
25a25f0a04SGreg Roach	 *
26a25f0a04SGreg Roach	 * @var string
27a25f0a04SGreg Roach	 */
28a25f0a04SGreg Roach	public $align = "";
29a25f0a04SGreg Roach	/**
30a25f0a04SGreg Roach	 * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0.
31a25f0a04SGreg Roach	 * Or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul>
32a25f0a04SGreg Roach	 *
33a25f0a04SGreg Roach	 * @var mixed
34a25f0a04SGreg Roach	 */
35a25f0a04SGreg Roach	public $border;
36a25f0a04SGreg Roach	/**
37a25f0a04SGreg Roach	 * Border color in HTML code
38a25f0a04SGreg Roach	 *
39a25f0a04SGreg Roach	 * @var string
40a25f0a04SGreg Roach	 */
41a25f0a04SGreg Roach	public $bocolor;
42a25f0a04SGreg Roach	/**
43a25f0a04SGreg Roach	 * The HTML color code to fill the background of this cell.
44a25f0a04SGreg Roach	 *
45a25f0a04SGreg Roach	 * @var string
46a25f0a04SGreg Roach	 */
47a25f0a04SGreg Roach	public $bgcolor;
48a25f0a04SGreg Roach	/**
49a25f0a04SGreg Roach	 * Indicates if the cell background must be painted (1) or transparent (0). Default value: 1.
50a25f0a04SGreg Roach	 * If no background color is set then it will not be painted
51a25f0a04SGreg Roach	 *
52a25f0a04SGreg Roach	 * @var int
53a25f0a04SGreg Roach	 */
54a25f0a04SGreg Roach	public $fill;
55a25f0a04SGreg Roach	/**
56a25f0a04SGreg Roach	 * Cell height DEFAULT 0 (expressed in points)
57a25f0a04SGreg Roach	 * The starting height of this cell. If the text wraps the height will automatically be adjusted.
58a25f0a04SGreg Roach	 *
59a25f0a04SGreg Roach	 * @var int
60a25f0a04SGreg Roach	 */
61a25f0a04SGreg Roach	public $height;
62a25f0a04SGreg Roach	/**
63a25f0a04SGreg Roach	 * Left position in user units (X-position). Default is the current position
64a25f0a04SGreg Roach	 *
65a25f0a04SGreg Roach	 * @var mixed
66a25f0a04SGreg Roach	 */
67a25f0a04SGreg Roach	public $left;
68a25f0a04SGreg Roach	/**
69a25f0a04SGreg Roach	 * Indicates where the current position should go after the call.  Possible values are:<ul><li>0: to the right [DEFAULT]</li><li>1: to the beginning of the next line</li><li>2: below</li></ul>
70a25f0a04SGreg Roach	 *
71a25f0a04SGreg Roach	 * @var int
72a25f0a04SGreg Roach	 */
73a25f0a04SGreg Roach	public $newline;
74a25f0a04SGreg Roach	/**
75a25f0a04SGreg Roach	 * The name of the Style that should be used to render the text.
76a25f0a04SGreg Roach	 *
77a25f0a04SGreg Roach	 * @var string
78a25f0a04SGreg Roach	 */
79a25f0a04SGreg Roach	public $styleName;
80a25f0a04SGreg Roach	/**
81a25f0a04SGreg Roach	 * Stretch carachter mode: <ul><li>0 = disabled (default)</li><li>1 = horizontal scaling only if necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if necessary</li><li>4 = forced character spacing</li></ul>
82a25f0a04SGreg Roach	 *
83a25f0a04SGreg Roach	 * @var int
84a25f0a04SGreg Roach	 */
85a25f0a04SGreg Roach	public $stretch;
86a25f0a04SGreg Roach	/**
87a25f0a04SGreg Roach	 * Text color in HTML code
88a25f0a04SGreg Roach	 *
89a25f0a04SGreg Roach	 * @var string
90a25f0a04SGreg Roach	 */
91a25f0a04SGreg Roach	public $tcolor;
92a25f0a04SGreg Roach	/**
93a25f0a04SGreg Roach	 * Top position in user units (Y-position). Default is the current position
94a25f0a04SGreg Roach	 *
95a25f0a04SGreg Roach	 * @var mixed
96a25f0a04SGreg Roach	 */
97a25f0a04SGreg Roach	public $top;
98a25f0a04SGreg Roach	/**
99a25f0a04SGreg Roach	 * URL address
100a25f0a04SGreg Roach	 *
101a25f0a04SGreg Roach	 * @var string
102a25f0a04SGreg Roach	 */
103a25f0a04SGreg Roach	public $url;
104a25f0a04SGreg Roach	/**
105a25f0a04SGreg Roach	 * Cell width DEFAULT 0 (expressed in points)
106a25f0a04SGreg Roach	 * Setting the width to 0 will make it the width from the current location to the right margin.
107a25f0a04SGreg Roach	 *
108a25f0a04SGreg Roach	 * @var int
109a25f0a04SGreg Roach	 */
110a25f0a04SGreg Roach	public $width;
111a25f0a04SGreg Roach
112a25f0a04SGreg Roach	public $reseth;
113a25f0a04SGreg Roach
114a25f0a04SGreg Roach	/**
115a25f0a04SGreg Roach	 * CELL - Element
116a25f0a04SGreg Roach	 *
117a25f0a04SGreg Roach	 * @param integer $width   cell width (expressed in points)
118a25f0a04SGreg Roach	 * @param integer $height  cell height (expressed in points)
119a25f0a04SGreg Roach	 * @param mixed   $border  Border style
120a25f0a04SGreg Roach	 * @param string  $align   Text alignement
121a25f0a04SGreg Roach	 * @param string  $bgcolor Background color code
122a25f0a04SGreg Roach	 * @param string  $style   The name of the text style
123a25f0a04SGreg Roach	 * @param integer $ln      Indicates where the current position should go after the call
124a25f0a04SGreg Roach	 * @param mixed   $top     Y-position
125a25f0a04SGreg Roach	 * @param mixed   $left    X-position
126a25f0a04SGreg Roach	 * @param integer $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
127a25f0a04SGreg Roach	 * @param integer $stretch Stretch carachter mode
128a25f0a04SGreg Roach	 * @param string  $bocolor Border color
129a25f0a04SGreg Roach	 * @param string  $tcolor  Text color
130a25f0a04SGreg Roach	 * @param         $reseth
131a25f0a04SGreg Roach	 */
132e2d2f0ebSGreg Roach	public function __construct(
133a25f0a04SGreg Roach		$width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth
134a25f0a04SGreg Roach	) {
135a25f0a04SGreg Roach		$this->align = $align;
136a25f0a04SGreg Roach		$this->border = $border;
137a25f0a04SGreg Roach		$this->bgcolor = $bgcolor;
138a25f0a04SGreg Roach		$this->bocolor = $bocolor;
139a25f0a04SGreg Roach		$this->fill = $fill;
140a25f0a04SGreg Roach		$this->height = $height;
141a25f0a04SGreg Roach		$this->left = $left;
142a25f0a04SGreg Roach		$this->newline = $ln;
143a25f0a04SGreg Roach		$this->styleName = $style;
144a25f0a04SGreg Roach		$this->text = "";
145a25f0a04SGreg Roach		$this->tcolor = $tcolor;
146a25f0a04SGreg Roach		$this->top = $top;
147a25f0a04SGreg Roach		$this->url = "";
148a25f0a04SGreg Roach		$this->stretch = $stretch;
149a25f0a04SGreg Roach		$this->width = $width;
150a25f0a04SGreg Roach		$this->reseth = $reseth;
151a25f0a04SGreg Roach
152a25f0a04SGreg Roach		return 0;
153a25f0a04SGreg Roach	}
154a25f0a04SGreg Roach
155a25f0a04SGreg Roach	/**
156a25f0a04SGreg Roach	 * Get the cell height
157a25f0a04SGreg Roach	 *
158a25f0a04SGreg Roach	 * @param $renderer
159a25f0a04SGreg Roach	 *
160a25f0a04SGreg Roach	 * @return float
161a25f0a04SGreg Roach	 */
162*ffd703eaSGreg Roach	public function getHeight($renderer) {
163a25f0a04SGreg Roach		return $this->height;
164a25f0a04SGreg Roach	}
165a25f0a04SGreg Roach
166a25f0a04SGreg Roach	/**
167a25f0a04SGreg Roach	 * Sets the current cells URL
168a25f0a04SGreg Roach	 *
169a25f0a04SGreg Roach	 * @param string $url The URL address to save
170a25f0a04SGreg Roach	 *
171a25f0a04SGreg Roach	 * @return integer
172a25f0a04SGreg Roach	 */
173*ffd703eaSGreg Roach	public function setUrl($url) {
174a25f0a04SGreg Roach		$this->url = $url;
175a25f0a04SGreg Roach
176a25f0a04SGreg Roach		return 0;
177a25f0a04SGreg Roach	}
178a25f0a04SGreg Roach
179a25f0a04SGreg Roach	/**
180a25f0a04SGreg Roach	 * Get the cell width
181a25f0a04SGreg Roach	 *
182a25f0a04SGreg Roach	 * @param $renderer
183a25f0a04SGreg Roach	 *
184a25f0a04SGreg Roach	 * @return float
185a25f0a04SGreg Roach	 */
186*ffd703eaSGreg Roach	public function getWidth($renderer) {
187a25f0a04SGreg Roach		return $this->width;
188a25f0a04SGreg Roach	}
189a25f0a04SGreg Roach}
190