1a25f0a04SGreg Roach<?php 2a25f0a04SGreg Roach/** 3a25f0a04SGreg Roach * webtrees: online genealogy 4*1062a142SGreg Roach * Copyright (C) 2018 webtrees development team 5a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify 6a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by 7a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8a25f0a04SGreg Roach * (at your option) any later version. 9a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful, 10a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12a25f0a04SGreg Roach * GNU General Public License for more details. 13a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License 14a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15a25f0a04SGreg Roach */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Report; 17a25f0a04SGreg Roach 18a25f0a04SGreg Roach/** 19a25f0a04SGreg Roach * Class ReportBaseCell 20a25f0a04SGreg Roach */ 21a25f0a04SGreg Roachclass ReportBaseCell extends ReportBaseElement { 22a25f0a04SGreg Roach /** 23a25f0a04SGreg 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> 24a25f0a04SGreg Roach * 25a25f0a04SGreg Roach * @var string 26a25f0a04SGreg Roach */ 277a6ee1acSGreg Roach public $align = ''; 28a25f0a04SGreg Roach /** 29a25f0a04SGreg Roach * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0. 30a25f0a04SGreg 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> 31a25f0a04SGreg Roach * 32a25f0a04SGreg Roach * @var mixed 33a25f0a04SGreg Roach */ 34a25f0a04SGreg Roach public $border; 35a25f0a04SGreg Roach /** 36a25f0a04SGreg Roach * Border color in HTML code 37a25f0a04SGreg Roach * 38a25f0a04SGreg Roach * @var string 39a25f0a04SGreg Roach */ 40a25f0a04SGreg Roach public $bocolor; 41a25f0a04SGreg Roach /** 42a25f0a04SGreg Roach * The HTML color code to fill the background of this cell. 43a25f0a04SGreg Roach * 44a25f0a04SGreg Roach * @var string 45a25f0a04SGreg Roach */ 46a25f0a04SGreg Roach public $bgcolor; 47a25f0a04SGreg Roach /** 48a25f0a04SGreg Roach * Indicates if the cell background must be painted (1) or transparent (0). Default value: 1. 49a25f0a04SGreg Roach * If no background color is set then it will not be painted 50a25f0a04SGreg Roach * 51a25f0a04SGreg Roach * @var int 52a25f0a04SGreg Roach */ 53a25f0a04SGreg Roach public $fill; 54a25f0a04SGreg Roach /** 55a25f0a04SGreg Roach * Cell height DEFAULT 0 (expressed in points) 56a25f0a04SGreg Roach * The starting height of this cell. If the text wraps the height will automatically be adjusted. 57a25f0a04SGreg Roach * 58a25f0a04SGreg Roach * @var int 59a25f0a04SGreg Roach */ 60a25f0a04SGreg Roach public $height; 61a25f0a04SGreg Roach /** 62a25f0a04SGreg Roach * Left position in user units (X-position). Default is the current position 63a25f0a04SGreg Roach * 64a25f0a04SGreg Roach * @var mixed 65a25f0a04SGreg Roach */ 66a25f0a04SGreg Roach public $left; 67a25f0a04SGreg Roach /** 68a25f0a04SGreg 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> 69a25f0a04SGreg Roach * 70a25f0a04SGreg Roach * @var int 71a25f0a04SGreg Roach */ 72a25f0a04SGreg Roach public $newline; 73a25f0a04SGreg Roach /** 74a25f0a04SGreg Roach * The name of the Style that should be used to render the text. 75a25f0a04SGreg Roach * 76a25f0a04SGreg Roach * @var string 77a25f0a04SGreg Roach */ 78a25f0a04SGreg Roach public $styleName; 79a25f0a04SGreg Roach /** 80a25f0a04SGreg 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> 81a25f0a04SGreg Roach * 82a25f0a04SGreg Roach * @var int 83a25f0a04SGreg Roach */ 84a25f0a04SGreg Roach public $stretch; 85a25f0a04SGreg Roach /** 86a25f0a04SGreg Roach * Text color in HTML code 87a25f0a04SGreg Roach * 88a25f0a04SGreg Roach * @var string 89a25f0a04SGreg Roach */ 90a25f0a04SGreg Roach public $tcolor; 91a25f0a04SGreg Roach /** 92a25f0a04SGreg Roach * Top position in user units (Y-position). Default is the current position 93a25f0a04SGreg Roach * 94a25f0a04SGreg Roach * @var mixed 95a25f0a04SGreg Roach */ 96a25f0a04SGreg Roach public $top; 97a25f0a04SGreg Roach /** 98a25f0a04SGreg Roach * URL address 99a25f0a04SGreg Roach * 100a25f0a04SGreg Roach * @var string 101a25f0a04SGreg Roach */ 102a25f0a04SGreg Roach public $url; 103a25f0a04SGreg Roach /** 104a25f0a04SGreg Roach * Cell width DEFAULT 0 (expressed in points) 105a25f0a04SGreg Roach * Setting the width to 0 will make it the width from the current location to the right margin. 106a25f0a04SGreg Roach * 107a25f0a04SGreg Roach * @var int 108a25f0a04SGreg Roach */ 109a25f0a04SGreg Roach public $width; 110a25f0a04SGreg Roach 11176692c8bSGreg Roach /** @var int Unknown */ 112a25f0a04SGreg Roach public $reseth; 113a25f0a04SGreg Roach 114a25f0a04SGreg Roach /** 115a25f0a04SGreg Roach * CELL - Element 116a25f0a04SGreg Roach * 117cbc1590aSGreg Roach * @param int $width cell width (expressed in points) 118cbc1590aSGreg Roach * @param int $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 123cbc1590aSGreg Roach * @param int $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 126cbc1590aSGreg Roach * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 127cbc1590aSGreg Roach * @param int $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; 1447a6ee1acSGreg Roach $this->text = ''; 145a25f0a04SGreg Roach $this->tcolor = $tcolor; 146a25f0a04SGreg Roach $this->top = $top; 1477a6ee1acSGreg 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 */ 162ffd703eaSGreg 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 * 171cbc1590aSGreg Roach * @return int 172a25f0a04SGreg Roach */ 173ffd703eaSGreg 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 */ 186ffd703eaSGreg Roach public function getWidth($renderer) { 187a25f0a04SGreg Roach return $this->width; 188a25f0a04SGreg Roach } 189a25f0a04SGreg Roach} 190