composer package updates
[openemr.git] / vendor / mpdf / mpdf / src / Tag / Tr.php
blobf891df99b6d41964527c4b6e8b3b69a57e2c0b8c
1 <?php
3 namespace Mpdf\Tag;
5 use Mpdf\Css\Border;
7 class Tr extends Tag
10 public function open($attr, &$ahtml, &$ihtml)
13 $this->mpdf->lastoptionaltag = 'TR'; // Save current HTML specified optional endtag
14 $this->cssManager->tbCSSlvl++;
15 $this->mpdf->row++;
16 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr'] ++;
17 $this->mpdf->col = -1;
18 $properties = $this->cssManager->MergeCSS('TABLE', 'TR', $attr);
20 if (!$this->mpdf->simpleTables && (!isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate'])
21 || !$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate'])) {
22 if (!empty($properties['BORDER-LEFT'])) {
23 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-left'][$this->mpdf->row] = $properties['BORDER-LEFT'];
25 if (!empty($properties['BORDER-RIGHT'])) {
26 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-right'][$this->mpdf->row] = $properties['BORDER-RIGHT'];
28 if (!empty($properties['BORDER-TOP'])) {
29 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-top'][$this->mpdf->row] = $properties['BORDER-TOP'];
31 if (!empty($properties['BORDER-BOTTOM'])) {
32 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-bottom'][$this->mpdf->row] = $properties['BORDER-BOTTOM'];
36 if (isset($properties['BACKGROUND-COLOR'])) {
37 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$this->mpdf->row] = $properties['BACKGROUND-COLOR'];
38 } elseif (isset($attr['BGCOLOR'])) {
39 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$this->mpdf->row] = $attr['BGCOLOR'];
42 /* -- BACKGROUNDS -- */
43 if (isset($properties['BACKGROUND-GRADIENT']) && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
44 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$this->mpdf->row] = $properties['BACKGROUND-GRADIENT'];
47 // FIXME: undefined variable $currblk
48 if (!empty($properties['BACKGROUND-IMAGE']) && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
49 $ret = $this->mpdf->SetBackground($properties, $currblk['inner_width']);
50 if ($ret) {
51 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$this->mpdf->row] = $ret;
54 /* -- END BACKGROUNDS -- */
56 if (isset($properties['TEXT-ROTATE'])) {
57 $this->mpdf->trow_text_rotate = $properties['TEXT-ROTATE'];
59 if (isset($attr['TEXT-ROTATE'])) {
60 $this->mpdf->trow_text_rotate = $attr['TEXT-ROTATE'];
63 if ($this->mpdf->tablethead) {
64 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead'][$this->mpdf->row] = true;
66 if ($this->mpdf->tabletfoot) {
67 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'][$this->mpdf->row] = true;
71 public function close(&$ahtml, &$ihtml)
73 if ($this->mpdf->tableLevel) {
74 // If Border set on TR - Update right border
75 if (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-left'][$this->mpdf->row])) {
76 $c = & $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col];
77 if ($c) {
78 if ($this->mpdf->packTableData) {
79 $cell = $this->mpdf->_unpackCellBorder($c['borderbin']);
80 } else {
81 $cell = $c;
83 $cell['border_details']['R'] = $this->mpdf->border_details(
84 $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-right'][$this->mpdf->row]
86 $this->mpdf->setBorder($cell['border'], Border::RIGHT, $cell['border_details']['R']['s']);
87 if ($this->mpdf->packTableData) {
88 $c['borderbin'] = $this->mpdf->_packCellBorder($cell);
89 unset($c['border'], $c['border_details']);
90 } else {
91 $c = $cell;
95 $this->mpdf->lastoptionaltag = '';
96 unset($this->cssManager->tablecascadeCSS[$this->cssManager->tbCSSlvl]);
97 $this->cssManager->tbCSSlvl--;
98 $this->mpdf->trow_text_rotate = '';
99 $this->mpdf->tabletheadjustfinished = false;