1<?php
2
3namespace Mpdf\Tag;
4
5class THead extends Tag
6{
7
8	public function open($attr, &$ahtml, &$ihtml)
9	{
10		$this->mpdf->lastoptionaltag = 'THEAD'; // Save current HTML specified optional endtag
11		$this->cssManager->tbCSSlvl++;
12		$this->mpdf->tablethead = 1;
13		$this->mpdf->tabletfoot = 0;
14		$properties = $this->cssManager->MergeCSS('TABLE', 'THEAD', $attr);
15		if (isset($properties['FONT-WEIGHT'])) {
16			$this->mpdf->thead_font_weight = '';
17			if (strtoupper($properties['FONT-WEIGHT']) === 'BOLD') {
18				$this->mpdf->thead_font_weight = 'B';
19			}
20		}
21
22		if (isset($properties['FONT-STYLE'])) {
23			$this->mpdf->thead_font_style = '';
24			if (strtoupper($properties['FONT-STYLE']) === 'ITALIC') {
25				$this->mpdf->thead_font_style = 'I';
26			}
27		}
28		if (isset($properties['FONT-VARIANT'])) {
29			$this->mpdf->thead_font_smCaps = '';
30			if (strtoupper($properties['FONT-VARIANT']) === 'SMALL-CAPS') {
31				$this->mpdf->thead_font_smCaps = 'S';
32			}
33		}
34
35		if (isset($properties['VERTICAL-ALIGN'])) {
36			$this->mpdf->thead_valign_default = $properties['VERTICAL-ALIGN'];
37		}
38		if (isset($properties['TEXT-ALIGN'])) {
39			$this->mpdf->thead_textalign_default = $properties['TEXT-ALIGN'];
40		}
41	}
42
43	public function close(&$ahtml, &$ihtml)
44	{
45		$this->mpdf->lastoptionaltag = '';
46		unset($this->cssManager->tablecascadeCSS[$this->cssManager->tbCSSlvl]);
47		$this->cssManager->tbCSSlvl--;
48		$this->mpdf->tablethead = 0;
49		$this->mpdf->tabletheadjustfinished = true;
50		$this->mpdf->ResetStyles();
51		$this->mpdf->thead_font_weight = '';
52		$this->mpdf->thead_font_style = '';
53		$this->mpdf->thead_font_smCaps = '';
54
55		$this->mpdf->thead_valign_default = '';
56		$this->mpdf->thead_textalign_default = '';
57	}
58}
59