Commit | Line | Data |
---|---|---|
cea5b93a RK |
1 | <?php |
2 | /* ***** BEGIN LICENSE BLOCK ***** | |
3 | * | |
4 | * The contents of this file are subject to Austrian copyright reegulations | |
5 | * ("Urheberrecht"); you may not use this file except in compliance with | |
6 | * those laws. | |
7 | * This contents and any derived work, if it gets distributed in any way, | |
8 | * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, | |
9 | * either express or implied. | |
10 | * | |
11 | * The Original Code is KaiRo's extended DOM document classes. | |
12 | * | |
13 | * The Initial Developer of the Original Code is | |
14 | * KaiRo - Robert Kaiser. | |
15 | * Portions created by the Initial Developer are Copyright (C) 2010 | |
16 | * the Initial Developer. All Rights Reserved. | |
17 | * | |
18 | * Contributor(s): Robert Kaiser <kairo@kairo.at> | |
19 | * | |
20 | * ***** END LICENSE BLOCK ***** */ | |
21 | ||
22 | class ExtendedDocument extends DOMDocument { | |
23 | // ExtendedDocument PHP class | |
24 | // this extends the general PHP DOM Document class to simplify some usual constructs | |
25 | // | |
26 | // function __construct([$version], [$encoding]) | |
27 | // CONSTRUCTOR | |
28 | // construct a new DOM Document that uses our element definitions | |
29 | // | |
ae41c41b RK |
30 | // private $xmheader |
31 | // the default XML header | |
32 | // | |
33 | // private $xhtmldtype | |
34 | // the XHTML doctype to use by default | |
35 | // | |
cea5b93a RK |
36 | // function appendElement($name, [$value]) |
37 | // appends a DOMDocument::createElement() as a child of this document (see there for params) | |
38 | // returns the new child | |
39 | // | |
40 | // function appendElementXML($name, $xmldata) | |
41 | // appends a DOMDocument::createElement() with the given name as a child of this document, | |
42 | // with an ExtendedDocument::createXMLFragment() of the given XML data inside | |
43 | // returns the new child | |
44 | // | |
45 | // function appendLink($target, [$value]) | |
46 | // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params) | |
47 | // returns the new child | |
48 | // | |
ae41c41b RK |
49 | // function appendFormDiv($action, $method, $name) |
50 | // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params) | |
51 | // returns an HTML <div> that is a child of the new child | |
52 | // | |
53 | // function appendInputHidden($name, $value) | |
54 | // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params) | |
55 | // returns the new child | |
56 | // | |
57 | // function appendInputText($name, $maxlength, $size, [$id], [$value]) | |
58 | // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params) | |
59 | // returns the new child | |
60 | // | |
61 | // function appendInputRadio($name, $id, $value, $checked) | |
62 | // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params) | |
63 | // returns the new child | |
64 | // | |
65 | // function appendInputCheckbox($name, $id, $value, $checked) | |
66 | // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params) | |
67 | // returns the new child | |
68 | // | |
69 | // function appendInputSubmit($value) | |
70 | // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params) | |
71 | // returns the new child | |
72 | // | |
bf91764c RK |
73 | // function appendTextArea($name, $columns, $rows, [$id], [$value]) |
74 | // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params) | |
75 | // returns the new child | |
76 | // | |
77 | // function appendElementSelect($name, [$id], [$options], [$default]) | |
78 | // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params) | |
79 | // returns the new child | |
80 | // | |
81 | // function appendElementOption($key, $desc, [$selected]) | |
82 | // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params) | |
83 | // returns the new child | |
84 | // | |
ae41c41b RK |
85 | // function appendLabel($for_id, $value) |
86 | // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params) | |
87 | // returns the new child | |
88 | // | |
cea5b93a RK |
89 | // function appendText($text) |
90 | // appends a DOMDocument::createTextNode() as a child of this document (see there for params) | |
91 | // returns the new child | |
92 | // | |
ae41c41b RK |
93 | // function appendHTMLMarkup($htmldata, [$parentNode]) |
94 | // appends a representation of the HTML data as children of the given parent node, by default this document | |
95 | // NO return value! | |
96 | // | |
97 | // function appendXMLMarkup($xmldata, [$parentNode]) | |
98 | // appends a representation of the XML data as children of the given parent node, by default this document | |
cea5b93a RK |
99 | // NO return value! |
100 | // | |
101 | // function appendJSElement($jsdata) | |
102 | // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params) | |
103 | // NO return value! | |
104 | // | |
cea5b93a RK |
105 | // function createElementLink($target, [$value]) |
106 | // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value | |
107 | // | |
ae41c41b RK |
108 | // function createElementForm($action, $method, $name) |
109 | // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form> | |
110 | // with the given action, method, and name | |
111 | // | |
112 | // function createElementInputHidden($name, $value) | |
113 | // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value | |
114 | // | |
115 | // function createElementInputText($name, $maxlength, $size, [$id], [$value]) | |
116 | // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size, | |
117 | // and optionally id and value | |
118 | // | |
119 | // function createElementInputRadio($name, $id, $value, $checked) | |
120 | // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and | |
121 | // checked state | |
122 | // | |
123 | // function createElementInputCheckbox($name, $id, $value, $checked) | |
124 | // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and | |
125 | // checked state | |
126 | // | |
127 | // function createElementInputSubmit($value) | |
128 | // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given name and value | |
129 | // | |
bf91764c RK |
130 | // function createElementTextArea($name, $columns, $rows, [$id], [$value]) |
131 | // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows, | |
132 | // and optionally id and value | |
133 | // | |
134 | // function createElementSelect($name, [$id], [$options], [$default]) | |
135 | // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id, | |
136 | // array of options (key => description) and key of the by-default selected entry | |
137 | // | |
138 | // function createElementOption($key, $desc, [$selected]) | |
139 | // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content) | |
140 | // and optionally bool that tells if the entry is selected | |
141 | // | |
ae41c41b RK |
142 | // function createElementLabel($for_id, $value) |
143 | // returns an ExtendedElement that is an HTML <label> with the given 'for' and value | |
cea5b93a RK |
144 | // |
145 | // function createElementJS($jsdata) | |
146 | // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside | |
147 | ||
148 | function __construct($version = '1.0', $encoding = 'utf-8') { | |
149 | // make sure the default DOMDocument constructor runs | |
150 | parent::__construct($version, $encoding); | |
151 | $this->registerNodeClass('DOMElement', 'ExtendedElement'); | |
bf91764c | 152 | $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment'); |
cea5b93a RK |
153 | } |
154 | ||
155 | function appendElement($name, $value = '') { | |
156 | return $this->appendChild($this->createElement($name, $value)); | |
157 | } | |
158 | function appendElementXML($name, $xmldata) { | |
159 | $aelem = $this->appendChild($this->createElement($name)); | |
ae41c41b RK |
160 | $aelem->appendXMLMarkup($xmldata); |
161 | //$aelem->appendChild($this->createXMLFragment($xmldata)); | |
cea5b93a RK |
162 | return $aelem; |
163 | } | |
164 | function appendLink($target, $value = '') { | |
165 | return $this->appendChild($this->createElementLink($target, $value)); | |
166 | } | |
ae41c41b RK |
167 | function appendFormDiv($action, $method, $name) { |
168 | $formelem = $this->appendChild($this->createElementForm($action, $method, $name)); | |
169 | return $formelem->appendElement('div'); | |
170 | } | |
171 | function appendInputHidden($name, $value) { | |
172 | return $this->appendChild($this->createElementInputHidden($name, $value)); | |
173 | } | |
174 | function appendInputText($name, $maxlength, $size, $id = null, $value = null) { | |
175 | return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value)); | |
176 | } | |
177 | function appendInputRadio($name, $id, $value, $checked) { | |
178 | return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked)); | |
179 | } | |
180 | function appendInputCheckbox($name, $id, $value, $checked) { | |
181 | return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked)); | |
182 | } | |
183 | function appendInputSubmit($value) { | |
184 | return $this->appendChild($this->createElementInputSubmit($value)); | |
185 | } | |
bf91764c RK |
186 | function appendTextArea($name, $columns, $rows, $id = null, $value = null) { |
187 | return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value)); | |
188 | } | |
189 | function appendElementSelect($name, $id = null, $options = array(), $default = null) { | |
190 | return $this->appendChild($this->createElementSelect($name, $id, $options, $default)); | |
191 | } | |
192 | function appendElementOption($key, $desc, $selected = false) { | |
193 | return $this->appendChild($this->createElementOption($key, $desc, $selected)); | |
194 | } | |
ae41c41b RK |
195 | function appendLabel($for_id, $value) { |
196 | return $this->appendChild($this->createElementLabel($for_id, $value)); | |
197 | } | |
cea5b93a RK |
198 | function appendText($text) { |
199 | return $this->appendChild($this->createTextNode($text)); | |
200 | } | |
cea5b93a RK |
201 | function appendJSElement($jsdata) { |
202 | $this->appendChild($this->createElementJS($jsdata)); | |
203 | } | |
204 | ||
ae41c41b RK |
205 | function appendHTMLMarkup($htmldata, $parentNode = null) { |
206 | if (is_null($parentNode)) { $parentNode =& $this; } | |
207 | // XXX: just a workaround for now! | |
208 | $parentNode->appendChild($this->createCDATASection($htmldata)); | |
209 | } | |
210 | ||
211 | function appendXMLMarkup($xmldata, $parentNode = null) { | |
212 | if (is_null($parentNode)) { $parentNode =& $this; } | |
213 | $tmpdoc = new ExtendedDocument; | |
214 | $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n"; | |
215 | $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n"; | |
216 | $tmpxml .= '<root>'.$xmldata.'</root>'; | |
217 | $tmpdoc->loadXML($tmpxml); | |
218 | foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) { | |
219 | $parentNode->appendChild($this->importNode($child, true)); | |
220 | } | |
cea5b93a RK |
221 | } |
222 | ||
223 | function createElementLink($target, $value = '') { | |
224 | $link = $this->createElement('a', $value); | |
bf91764c | 225 | $link->setAttribute('href', $target); // XXX: take care of & etc. in links |
cea5b93a RK |
226 | return $link; |
227 | } | |
228 | ||
ae41c41b RK |
229 | function createElementForm($action, $method, $name) { |
230 | $formelem = $this->createElement('form'); | |
231 | $formelem->setAttribute('action', $action); | |
232 | $formelem->setAttribute('method', $method); | |
233 | $formelem->setAttribute('name', $name); | |
234 | return $formelem; | |
235 | } | |
236 | ||
237 | function createElementInputHidden($name, $value) { | |
238 | $hidden = $this->createElement('input'); | |
239 | $hidden->setAttribute('type', 'hidden'); | |
240 | $hidden->setAttribute('name', $name); | |
241 | $hidden->setAttribute('value', $value); | |
242 | return $hidden; | |
243 | } | |
244 | ||
245 | function createElementInputText($name, $maxlength, $size, $id = null, $value = null) { | |
246 | $txfield = $this->createElement('input'); | |
247 | $txfield->setAttribute('type', 'text'); | |
248 | if (!is_null($id)) { $txfield->setAttribute('id', $id); } | |
249 | $txfield->setAttribute('name', $name); | |
250 | $txfield->setAttribute('maxlength', $maxlength); | |
251 | $txfield->setAttribute('size', $size); | |
252 | if (!is_null($value)) { $txfield->setAttribute('value', $value); } | |
253 | return $txfield; | |
254 | } | |
255 | ||
256 | function createElementInputRadio($name, $id, $value, $checked) { | |
257 | $radio = $this->createElement('input'); | |
258 | $radio->setAttribute('type', 'radio'); | |
259 | $radio->setAttribute('name', $name); | |
260 | $radio->setAttribute('id', $id); | |
261 | $radio->setAttribute('value', $value); | |
262 | if ($checked) { $radio->setAttribute('checked', ''); } | |
263 | return $radio; | |
264 | } | |
265 | ||
266 | function createElementInputCheckbox($name, $id, $value, $checked) { | |
267 | $cbox = $this->createElement('input'); | |
268 | $cbox->setAttribute('type', 'checkbox'); | |
269 | $cbox->setAttribute('name', $name); | |
270 | $cbox->setAttribute('id', $id); | |
271 | $cbox->setAttribute('value', $value); | |
272 | if ($checked) { $cbox->setAttribute('checked', ''); } | |
273 | return $cbox; | |
274 | } | |
275 | ||
276 | function createElementInputSubmit($value) { | |
277 | $submitbtn = $this->createElement('input'); | |
278 | $submitbtn->setAttribute('type', 'submit'); | |
279 | $submitbtn->setAttribute('value', $value); | |
280 | return $submitbtn; | |
281 | } | |
282 | ||
bf91764c RK |
283 | function createElementTextArea($name, $columns, $rows, $id = null, $value = null) { |
284 | $txtarea = $this->createElement('textarea', $value); | |
285 | $txtarea->setAttribute('name', $name); | |
286 | $txtarea->setAttribute('cols', $columns); | |
287 | $txtarea->setAttribute('rows', $rows); | |
288 | if (!is_null($id)) { $txtarea->setAttribute('id', $id); } | |
289 | return $txtarea; | |
290 | } | |
291 | ||
292 | function createElementSelect($name, $id = null, $options = array(), $default = null) { | |
293 | $select = $this->createElement('select'); | |
294 | $select->setAttribute('name', $name); | |
295 | if (!is_null($id)) { $select->setAttribute('id', $id); } | |
296 | foreach ($options as $key => $desc) { | |
297 | $select->appendElementOption($key, $desc, ($key == $default)); | |
298 | } | |
299 | return $select; | |
300 | } | |
301 | ||
302 | function createElementOption($key, $desc, $selected = false) { | |
303 | $option = $this->createElement('option', $desc); | |
304 | $option->setAttribute('value', $key); | |
305 | if ($selected) { $option->setAttribute('selected', ''); } | |
306 | return $option; | |
307 | } | |
308 | ||
ae41c41b RK |
309 | function createElementLabel($for_id, $value) { |
310 | $label = $this->createElement('label', $value); | |
311 | $label->setAttribute('for', $for_id); | |
312 | return $label; | |
cea5b93a RK |
313 | } |
314 | ||
315 | function createElementJS($jsdata) { | |
316 | $jselem = $this->createElement('script'); | |
317 | $jselem->setAttribute('type', 'text/javascript'); | |
318 | $jselem->appendChild($this->createCDATASection($jsdata)); | |
319 | return $jselem; | |
320 | } | |
321 | } | |
322 | ||
323 | class ExtendedElement extends DOMElement { | |
324 | // ExtendedElement PHP class | |
325 | // this extends the general PHP DOM Element class to simplify some usual constructs | |
326 | // | |
327 | // function appendElement($name, [$value]) | |
328 | // appends a DOMDocument::createElement() as a child of this element (see there for params) | |
329 | // returns the new child | |
330 | // | |
331 | // function appendElementXML($name, $xmldata) | |
332 | // appends a DOMDocument::createElement() with the given name as a child of this element, | |
333 | // with an ExtendedDocument::createXMLFragment() of the given XML data inside | |
334 | // returns the new child | |
335 | // | |
336 | // function appendLink($target, [$value]) | |
337 | // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params) | |
338 | // returns the new child | |
339 | // | |
ae41c41b RK |
340 | // function appendFormDiv($action, $method, $name) |
341 | // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params) | |
342 | // returns an HTML <div> that is a child of the new child | |
343 | // | |
344 | // function appendInputHidden($name, $value) | |
345 | // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params) | |
346 | // returns the new child | |
347 | // | |
348 | // function appendInputText($name, $maxlength, $size, [$id], [$value]) | |
349 | // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params) | |
350 | // returns the new child | |
351 | // | |
352 | // function appendInputRadio($name, $id, $value, $checked) | |
353 | // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params) | |
354 | // returns the new child | |
355 | // | |
356 | // function appendInputCheckbox($name, $id, $value, $checked) | |
357 | // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params) | |
358 | // returns the new child | |
359 | // | |
360 | // function appendInputSubmit($value) | |
361 | // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params) | |
362 | // returns the new child | |
363 | // | |
bf91764c RK |
364 | // function appendTextArea($name, $columns, $rows, [$id], [$value]) |
365 | // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params) | |
366 | // returns the new child | |
367 | // | |
368 | // function appendElementSelect($name, [$id], [$options], [$default]) | |
369 | // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params) | |
370 | // returns the new child | |
371 | // | |
372 | // function appendElementOption($key, $desc, [$selected]) | |
373 | // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params) | |
374 | // returns the new child | |
375 | // | |
ae41c41b RK |
376 | // function appendLabel($for_id, $value) |
377 | // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params) | |
378 | // returns the new child | |
379 | // | |
cea5b93a RK |
380 | // function appendText($text) |
381 | // appends a DOMDocument::createTextNode() as a child of this element (see there for params) | |
382 | // returns the new child | |
383 | // | |
ae41c41b RK |
384 | // function appendHTMLMarkup($htmldata) |
385 | // appends a representation of the HTML data as children of this element | |
386 | // NO return value! | |
387 | // | |
388 | // function appendXMLMarkup($xmldata) | |
389 | // appends a representation of the XML data as children of this element | |
cea5b93a RK |
390 | // NO return value! |
391 | // | |
392 | // function appendJSElement($jsdata) | |
393 | // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params) | |
394 | // NO return value! | |
395 | ||
396 | function appendElement($name, $value = '') { | |
397 | return $this->appendChild($this->ownerDocument->createElement($name, $value)); | |
398 | } | |
399 | function appendElementXML($name, $xmldata) { | |
400 | $aelem = $this->appendChild($this->ownerDocument->createElement($name)); | |
ae41c41b | 401 | $aelem->appendXMLMarkup($xmldata); |
cea5b93a RK |
402 | return $aelem; |
403 | } | |
404 | function appendLink($target, $value = '') { | |
405 | return $this->appendChild($this->ownerDocument->createElementLink($target, $value)); | |
406 | } | |
ae41c41b RK |
407 | function appendFormDiv($action, $method, $name) { |
408 | $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); | |
409 | return $formelem->appendElement('div'); | |
410 | } | |
411 | function appendInputHidden($name, $value) { | |
412 | return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value)); | |
413 | } | |
414 | function appendInputText($name, $maxlength, $size, $id = null, $value = null) { | |
415 | return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value)); | |
416 | } | |
417 | function appendInputRadio($name, $id, $value, $checked) { | |
418 | return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked)); | |
419 | } | |
420 | function appendInputCheckbox($name, $id, $value, $checked) { | |
421 | return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked)); | |
422 | } | |
423 | function appendInputSubmit($value) { | |
424 | return $this->appendChild($this->ownerDocument->createElementInputSubmit($value)); | |
425 | } | |
bf91764c RK |
426 | function appendTextArea($name, $columns, $rows, $id = null, $value = null) { |
427 | return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value)); | |
428 | } | |
429 | function appendElementSelect($name, $id = null, $options = array(), $default = null) { | |
430 | return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default)); | |
431 | } | |
432 | function appendElementOption($key, $desc, $selected = false) { | |
433 | return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected)); | |
434 | } | |
435 | function appendLabel($for_id, $value) { | |
436 | return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value)); | |
437 | } | |
438 | function appendText($text) { | |
439 | return $this->appendChild($this->ownerDocument->createTextNode($text)); | |
440 | } | |
441 | function appendHTMLMarkup($htmldata) { | |
442 | $this->ownerDocument->appendHTMLMarkup($htmldata, $this); | |
443 | } | |
444 | function appendXMLMarkup($xmldata) { | |
445 | $this->ownerDocument->appendXMLMarkup($xmldata, $this); | |
446 | } | |
447 | function appendJSElement($jsdata) { | |
448 | $this->appendChild($this->ownerDocument->createElementJS($jsdata)); | |
449 | } | |
450 | } | |
451 | ||
452 | class ExtendedDocumentFragment extends DOMDocumentFragment { | |
453 | // ExtendedDocumentFragment PHP class | |
454 | // this extends the general PHP DOM Document Fragment class to simplify some usual constructs | |
455 | // | |
456 | // function appendElement($name, [$value]) | |
457 | // appends a DOMDocument::createElement() as a child of this fragment (see there for params) | |
458 | // returns the new child | |
459 | // | |
460 | // function appendElementXML($name, $xmldata) | |
461 | // appends a DOMDocument::createElement() with the given name as a child of this fragment, | |
462 | // with an ExtendedDocument::createXMLFragment() of the given XML data inside | |
463 | // returns the new child | |
464 | // | |
465 | // function appendLink($target, [$value]) | |
466 | // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params) | |
467 | // returns the new child | |
468 | // | |
469 | // function appendFormDiv($action, $method, $name) | |
470 | // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params) | |
471 | // returns an HTML <div> that is a child of the new child | |
472 | // | |
473 | // function appendInputHidden($name, $value) | |
474 | // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params) | |
475 | // returns the new child | |
476 | // | |
477 | // function appendInputText($name, $maxlength, $size, [$id], [$value]) | |
478 | // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params) | |
479 | // returns the new child | |
480 | // | |
481 | // function appendInputRadio($name, $id, $value, $checked) | |
482 | // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params) | |
483 | // returns the new child | |
484 | // | |
485 | // function appendInputCheckbox($name, $id, $value, $checked) | |
486 | // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params) | |
487 | // returns the new child | |
488 | // | |
489 | // function appendInputSubmit($value) | |
490 | // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params) | |
491 | // returns the new child | |
492 | // | |
493 | // function appendTextArea($name, $columns, $rows, [$id], [$value]) | |
494 | // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params) | |
495 | // returns the new child | |
496 | // | |
497 | // function appendElementSelect($name, [$id], [$options], [$default]) | |
498 | // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params) | |
499 | // returns the new child | |
500 | // | |
501 | // function appendElementOption($key, $desc, [$selected]) | |
502 | // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params) | |
503 | // returns the new child | |
504 | // | |
505 | // function appendLabel($for_id, $value) | |
506 | // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params) | |
507 | // returns the new child | |
508 | // | |
509 | // function appendText($text) | |
510 | // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params) | |
511 | // returns the new child | |
512 | // | |
513 | // function appendHTMLMarkup($htmldata) | |
514 | // appends a representation of the HTML data as children of this fragment | |
515 | // NO return value! | |
516 | // | |
517 | // function appendXMLMarkup($xmldata) | |
518 | // appends a representation of the XML data as children of this fragment | |
519 | // NO return value! | |
520 | // | |
521 | // function appendJSElement($jsdata) | |
522 | // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params) | |
523 | // NO return value! | |
524 | ||
525 | function appendElement($name, $value = '') { | |
526 | return $this->appendChild($this->ownerDocument->createElement($name, $value)); | |
527 | } | |
528 | function appendElementXML($name, $xmldata) { | |
529 | $aelem = $this->appendChild($this->ownerDocument->createElement($name)); | |
530 | $aelem->appendXMLMarkup($xmldata); | |
531 | return $aelem; | |
532 | } | |
533 | function appendLink($target, $value = '') { | |
534 | return $this->appendChild($this->ownerDocument->createElementLink($target, $value)); | |
535 | } | |
536 | function appendFormDiv($action, $method, $name) { | |
537 | $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); | |
538 | return $formelem->appendElement('div'); | |
539 | } | |
540 | function appendInputHidden($name, $value) { | |
541 | return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value)); | |
542 | } | |
543 | function appendInputText($name, $maxlength, $size, $id = null, $value = null) { | |
544 | return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value)); | |
545 | } | |
546 | function appendInputRadio($name, $id, $value, $checked) { | |
547 | return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked)); | |
548 | } | |
549 | function appendInputCheckbox($name, $id, $value, $checked) { | |
550 | return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked)); | |
551 | } | |
552 | function appendInputSubmit($value) { | |
553 | return $this->appendChild($this->ownerDocument->createElementInputSubmit($value)); | |
554 | } | |
555 | function appendTextArea($name, $columns, $rows, $id = null, $value = null) { | |
556 | return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value)); | |
557 | } | |
558 | function appendElementSelect($name, $id = null, $options = array(), $default = null) { | |
559 | return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default)); | |
560 | } | |
561 | function appendElementOption($key, $desc, $selected = false) { | |
562 | return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected)); | |
563 | } | |
ae41c41b RK |
564 | function appendLabel($for_id, $value) { |
565 | return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value)); | |
566 | } | |
cea5b93a RK |
567 | function appendText($text) { |
568 | return $this->appendChild($this->ownerDocument->createTextNode($text)); | |
569 | } | |
ae41c41b RK |
570 | function appendHTMLMarkup($htmldata) { |
571 | $this->ownerDocument->appendHTMLMarkup($htmldata, $this); | |
572 | } | |
573 | function appendXMLMarkup($xmldata) { | |
574 | $this->ownerDocument->appendXMLMarkup($xmldata, $this); | |
cea5b93a RK |
575 | } |
576 | function appendJSElement($jsdata) { | |
577 | $this->appendChild($this->ownerDocument->createElementJS($jsdata)); | |
578 | } | |
579 | } | |
580 | ?> |