7 class Select
extends Tag
10 public function open($attr, &$ahtml, &$ihtml)
12 $this->mpdf
->lastoptionaltag
= ''; // Save current HTML specified optional endtag
13 $this->mpdf
->InlineProperties
['SELECT'] = $this->mpdf
->saveInlineProperties();
14 $properties = $this->cssManager
->MergeCSS('', 'SELECT', $attr);
15 if (isset($properties['FONT-FAMILY'])) {
16 $this->mpdf
->SetFont($properties['FONT-FAMILY'], $this->mpdf
->FontStyle
, 0, false);
18 if (isset($properties['FONT-SIZE'])) {
19 $mmsize = $this->sizeConverter
->convert($properties['FONT-SIZE'], $this->mpdf
->default_font_size
/ Mpdf
::SCALE
);
20 $this->mpdf
->SetFontSize($mmsize * Mpdf
::SCALE
, false);
22 if (isset($attr['SPELLCHECK']) && strtolower($attr['SPELLCHECK']) === 'true') {
23 $this->mpdf
->selectoption
['SPELLCHECK'] = true;
26 if (isset($properties['COLOR'])) {
27 $this->mpdf
->selectoption
['COLOR'] = $this->colorConverter
->convert($properties['COLOR'], $this->mpdf
->PDFAXwarnings
);
29 $this->mpdf
->specialcontent
= 'type=select';
30 if (isset($attr['DISABLED'])) {
31 $this->mpdf
->selectoption
['DISABLED'] = $attr['DISABLED'];
33 if (isset($attr['READONLY'])) {
34 $this->mpdf
->selectoption
['READONLY'] = $attr['READONLY'];
36 if (isset($attr['REQUIRED'])) {
37 $this->mpdf
->selectoption
['REQUIRED'] = $attr['REQUIRED'];
39 if (isset($attr['EDITABLE'])) {
40 $this->mpdf
->selectoption
['EDITABLE'] = $attr['EDITABLE'];
42 if (isset($attr['TITLE'])) {
43 $this->mpdf
->selectoption
['TITLE'] = $attr['TITLE'];
45 if (isset($attr['MULTIPLE'])) {
46 $this->mpdf
->selectoption
['MULTIPLE'] = $attr['MULTIPLE'];
48 if (isset($attr['SIZE']) && $attr['SIZE'] > 1) {
49 $this->mpdf
->selectoption
['SIZE'] = $attr['SIZE'];
51 if ($this->mpdf
->useActiveForms
) {
52 if (isset($attr['NAME'])) {
53 $this->mpdf
->selectoption
['NAME'] = $attr['NAME'];
55 if (isset($attr['ONCHANGE'])) {
56 $this->mpdf
->selectoption
['ONCHANGE'] = $attr['ONCHANGE'];
61 public function close(&$ahtml, &$ihtml)
63 $this->mpdf
->ignorefollowingspaces
= false;
64 $this->mpdf
->lastoptionaltag
= '';
67 if (isset($this->mpdf
->selectoption
['SELECTED'])) {
68 $texto = $this->mpdf
->selectoption
['SELECTED'];
70 if (isset($this->mpdf
->selectoption
['SELECTED-OTLDATA'])) {
71 $OTLdata = $this->mpdf
->selectoption
['SELECTED-OTLDATA'];
74 if ($this->mpdf
->useActiveForms
) {
75 $w = $this->mpdf
->selectoption
['MAXWIDTH'];
77 $w = $this->mpdf
->GetStringWidth($texto, true, $OTLdata);
82 $objattr['type'] = 'select';
83 $objattr['text'] = $texto;
84 $objattr['OTLdata'] = $OTLdata;
85 if (isset($this->mpdf
->selectoption
['NAME'])) {
86 $objattr['fieldname'] = $this->mpdf
->selectoption
['NAME'];
88 if (isset($this->mpdf
->selectoption
['READONLY'])) {
89 $objattr['readonly'] = true;
91 if (isset($this->mpdf
->selectoption
['REQUIRED'])) {
92 $objattr['required'] = true;
94 if (isset($this->mpdf
->selectoption
['SPELLCHECK'])) {
95 $objattr['spellcheck'] = true;
97 if (isset($this->mpdf
->selectoption
['EDITABLE'])) {
98 $objattr['editable'] = true;
100 if (isset($this->mpdf
->selectoption
['ONCHANGE'])) {
101 $objattr['onChange'] = $this->mpdf
->selectoption
['ONCHANGE'];
103 if (isset($this->mpdf
->selectoption
['ITEMS'])) {
104 $objattr['items'] = $this->mpdf
->selectoption
['ITEMS'];
106 if (isset($this->mpdf
->selectoption
['MULTIPLE'])) {
107 $objattr['multiple'] = $this->mpdf
->selectoption
['MULTIPLE'];
109 if (isset($this->mpdf
->selectoption
['DISABLED'])) {
110 $objattr['disabled'] = $this->mpdf
->selectoption
['DISABLED'];
112 if (isset($this->mpdf
->selectoption
['TITLE'])) {
113 $objattr['title'] = $this->mpdf
->selectoption
['TITLE'];
115 if (isset($this->mpdf
->selectoption
['COLOR'])) {
116 $objattr['color'] = $this->mpdf
->selectoption
['COLOR'];
118 if (isset($this->mpdf
->selectoption
['SIZE'])) {
119 $objattr['size'] = $this->mpdf
->selectoption
['SIZE'];
122 if (isset($objattr['size']) && $objattr['size'] > 1) {
123 $rows = $objattr['size'];
126 $objattr['fontfamily'] = $this->mpdf
->FontFamily
;
127 $objattr['fontsize'] = $this->mpdf
->FontSizePt
;
129 $objattr['width'] = $w +
($this->form
->form_element_spacing
['select']['outer']['h'] * 2)
130 +
($this->form
->form_element_spacing
['select']['inner']['h'] * 2) +
($this->mpdf
->FontSize
* 1.4);
132 $objattr['height'] = ($this->mpdf
->FontSize
* $rows) +
($this->form
->form_element_spacing
['select']['outer']['v'] * 2)
133 +
($this->form
->form_element_spacing
['select']['inner']['v'] * 2);
135 $e = "\xbb\xa4\xactype=select,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
137 // Output it to buffers
138 if ($this->mpdf
->tableLevel
) { // *TABLES*
139 $this->mpdf
->_saveCellTextBuffer($e, $this->mpdf
->HREF
);
140 $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['s'] +
= $objattr['width']; // *TABLES*
143 $this->mpdf
->_saveTextBuffer($e, $this->mpdf
->HREF
);
146 $this->mpdf
->selectoption
= [];
147 $this->mpdf
->specialcontent
= '';
149 if ($this->mpdf
->InlineProperties
['SELECT']) {
150 $this->mpdf
->restoreInlineProperties($this->mpdf
->InlineProperties
['SELECT']);
152 unset($this->mpdf
->InlineProperties
['SELECT']);