add methods for password fields
[php-utility-classes.git] / include / cbsm / util / document.php-class
... / ...
CommitLineData
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
22class 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 //
30 // private $xmheader
31 // the default XML header
32 //
33 // private $xhtmldtype
34 // the XHTML doctype to use by default
35 //
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 //
49 // function appendImage($src, [$alt_text])
50 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
51 // returns the new child
52 //
53 // function appendFormDiv($action, $method, $name)
54 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
55 // returns an HTML <div> that is a child of the new child
56 //
57 // function appendInputHidden($name, $value)
58 // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
59 // returns the new child
60 //
61 // function appendInputText($name, $maxlength, $size, [$id], [$value])
62 // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
63 // returns the new child
64 //
65 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
66 // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
67 // returns the new child
68 //
69 // function appendInputRadio($name, $id, $value, $checked)
70 // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
71 // returns the new child
72 //
73 // function appendInputCheckbox($name, $id, $value, $checked)
74 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
75 // returns the new child
76 //
77 // function appendInputSubmit($value)
78 // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
79 // returns the new child
80 //
81 // function appendButton($value, $onclick = null)
82 // appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
83 // returns the new child
84 //
85 // function appendTextArea($name, $columns, $rows, [$id], [$value])
86 // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
87 // returns the new child
88 //
89 // function appendElementSelect($name, [$id], [$options], [$default])
90 // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
91 // returns the new child
92 //
93 // function appendElementOption($key, $desc, [$selected])
94 // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
95 // returns the new child
96 //
97 // function appendLabel($for_id, $value)
98 // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
99 // returns the new child
100 //
101 // function appendText($text)
102 // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
103 // returns the new child
104 //
105 // function appendComment($comment_data)
106 // appends a DOMDocument::createComment() as a child of this document (see there for params)
107 // returns the new child
108 //
109 // function appendHTMLMarkup($htmldata, [$parentNode])
110 // appends a representation of the HTML data as children of the given parent node, by default this document
111 // NO return value!
112 //
113 // function appendXMLMarkup($xmldata, [$parentNode])
114 // appends a representation of the XML data as children of the given parent node, by default this document
115 // NO return value!
116 //
117 // function appendJSElement($jsdata)
118 // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
119 // NO return value!
120 //
121 // function appendCOMElement($module, $attributes)
122 // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
123 // returns the new child
124 //
125 // function createElementLink($target, [$value])
126 // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
127 //
128 // function createElementImage($src, [$alt_text])
129 // returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
130 //
131 // function createElementForm($action, $method, $name)
132 // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
133 // with the given action, method, and name
134 //
135 // function createElementInputHidden($name, $value)
136 // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
137 //
138 // function createElementInputText($name, $maxlength, $size, [$id], [$value])
139 // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
140 // and optionally id and value
141 //
142 // function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
143 // returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
144 // and optionally id and value
145 //
146 // function createElementInputRadio($name, $id, $value, $checked)
147 // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
148 // checked state
149 //
150 // function createElementInputCheckbox($name, $id, $value, $checked)
151 // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
152 // checked state
153 //
154 // function createElementInputSubmit($value)
155 // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
156 //
157 // function createElementButton($value, $onclick = null)
158 // returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
159 //
160 // function createElementTextArea($name, $columns, $rows, [$id], [$value])
161 // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
162 // and optionally id and value
163 //
164 // function createElementSelect($name, [$id], [$options], [$default])
165 // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
166 // array of options (key => description) and key of the by-default selected entry
167 //
168 // function createElementOption($key, $desc, [$selected])
169 // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
170 // and optionally bool that tells if the entry is selected
171 //
172 // function createElementLabel($for_id, $value)
173 // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
174 //
175 // function createElementJS($jsdata)
176 // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
177 //
178 // function createCOMElement($module, $attributes)
179 // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
180 // given name=>value array as attributes
181
182 function __construct($version = '1.0', $encoding = 'utf-8') {
183 // make sure the default DOMDocument constructor runs
184 parent::__construct($version, $encoding);
185 $this->registerNodeClass('DOMElement', 'ExtendedElement');
186 $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
187 }
188
189 function appendElement($name, $value = '') {
190 return $this->appendChild($this->createElement($name, $value));
191 }
192 function appendElementXML($name, $xmldata) {
193 $aelem = $this->appendChild($this->createElement($name));
194 $aelem->appendXMLMarkup($xmldata);
195 //$aelem->appendChild($this->createXMLFragment($xmldata));
196 return $aelem;
197 }
198 function appendLink($target, $value = '') {
199 return $this->appendChild($this->createElementLink($target, $value));
200 }
201 function appendImage($src, $alt_text = '') {
202 return $this->appendChild($this->createElementImage($src, $alt_text));
203 }
204 function appendFormDiv($action, $method, $name) {
205 $formelem = $this->appendChild($this->createElementForm($action, $method, $name));
206 return $formelem->appendElement('div');
207 }
208 function appendInputHidden($name, $value) {
209 return $this->appendChild($this->createElementInputHidden($name, $value));
210 }
211 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
212 return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
213 }
214 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
215 return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
216 }
217 function appendInputRadio($name, $id, $value, $checked) {
218 return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
219 }
220 function appendInputCheckbox($name, $id, $value, $checked) {
221 return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
222 }
223 function appendInputSubmit($value) {
224 return $this->appendChild($this->createElementInputSubmit($value));
225 }
226 function appendButton($value, $onclick = null) {
227 return $this->appendChild($this->createElementButton($value, $onclick));
228 }
229 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
230 return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
231 }
232 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
233 return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
234 }
235 function appendElementOption($key, $desc, $selected = false) {
236 return $this->appendChild($this->createElementOption($key, $desc, $selected));
237 }
238 function appendLabel($for_id, $value) {
239 return $this->appendChild($this->createElementLabel($for_id, $value));
240 }
241 function appendText($text) {
242 return $this->appendChild($this->createTextNode($text));
243 }
244 function appendComment($comment_data) {
245 return $this->appendChild($this->createComment($comment_data));
246 }
247 function appendJSElement($jsdata) {
248 $this->appendChild($this->createElementJS($jsdata));
249 }
250 function appendCOMElement($module, $attributes) {
251 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
252 }
253
254 function appendHTMLMarkup($htmldata, $parentNode = null) {
255 if (is_null($parentNode)) { $parentNode =& $this; }
256 // XXX: just a workaround for now!
257 $parentNode->appendChild($this->createCDATASection($htmldata));
258 }
259
260 function appendXMLMarkup($xmldata, $parentNode = null) {
261 if (is_null($parentNode)) { $parentNode =& $this; }
262 $tmpdoc = new ExtendedDocument;
263 $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
264 $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
265 $tmpxml .= '<root>'.$xmldata.'</root>';
266 $tmpdoc->loadXML($tmpxml);
267 foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
268 $parentNode->appendChild($this->importNode($child, true));
269 }
270 }
271
272 function createElementLink($target, $value = '') {
273 $link = $this->createElement('a', $value);
274 $link->setAttribute('href', $target); // XXX: take care of & etc. in links
275 return $link;
276 }
277
278 function createElementImage($src, $alt_text = '') {
279 $link = $this->createElement('img');
280 $link->setAttribute('src', $src);
281 $link->setAttribute('alt', $alt_text);
282 return $link;
283 }
284
285 function createElementForm($action, $method, $name) {
286 $formelem = $this->createElement('form');
287 $formelem->setAttribute('action', $action);
288 $formelem->setAttribute('method', $method);
289 $formelem->setAttribute('name', $name);
290 return $formelem;
291 }
292
293 function createElementInputHidden($name, $value) {
294 $hidden = $this->createElement('input');
295 $hidden->setAttribute('type', 'hidden');
296 $hidden->setAttribute('name', $name);
297 $hidden->setAttribute('value', $value);
298 return $hidden;
299 }
300
301 function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
302 $txfield = $this->createElement('input');
303 $txfield->setAttribute('type', 'text');
304 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
305 $txfield->setAttribute('name', $name);
306 $txfield->setAttribute('maxlength', $maxlength);
307 $txfield->setAttribute('size', $size);
308 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
309 return $txfield;
310 }
311
312 function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
313 $txfield = $this->createElement('input');
314 $txfield->setAttribute('type', 'password');
315 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
316 $txfield->setAttribute('name', $name);
317 $txfield->setAttribute('maxlength', $maxlength);
318 $txfield->setAttribute('size', $size);
319 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
320 return $txfield;
321 }
322
323 function createElementInputRadio($name, $id, $value, $checked) {
324 $radio = $this->createElement('input');
325 $radio->setAttribute('type', 'radio');
326 $radio->setAttribute('name', $name);
327 $radio->setAttribute('id', $id);
328 $radio->setAttribute('value', $value);
329 if ($checked) { $radio->setAttribute('checked', ''); }
330 return $radio;
331 }
332
333 function createElementInputCheckbox($name, $id, $value, $checked) {
334 $cbox = $this->createElement('input');
335 $cbox->setAttribute('type', 'checkbox');
336 $cbox->setAttribute('name', $name);
337 $cbox->setAttribute('id', $id);
338 $cbox->setAttribute('value', $value);
339 if ($checked) { $cbox->setAttribute('checked', ''); }
340 return $cbox;
341 }
342
343 function createElementInputSubmit($value) {
344 $submitbtn = $this->createElement('input');
345 $submitbtn->setAttribute('type', 'submit');
346 $submitbtn->setAttribute('value', $value);
347 return $submitbtn;
348 }
349
350 function createElementButton($value, $onclick = null) {
351 $btn = $this->createElement('input');
352 $btn->setAttribute('type', 'button');
353 $btn->setAttribute('value', $value);
354 if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
355 return $btn;
356 }
357
358 function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
359 $txtarea = $this->createElement('textarea', $value);
360 $txtarea->setAttribute('name', $name);
361 $txtarea->setAttribute('cols', $columns);
362 $txtarea->setAttribute('rows', $rows);
363 if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
364 return $txtarea;
365 }
366
367 function createElementSelect($name, $id = null, $options = array(), $default = null) {
368 $select = $this->createElement('select');
369 $select->setAttribute('name', $name);
370 if (!is_null($id)) { $select->setAttribute('id', $id); }
371 foreach ($options as $key => $desc) {
372 $select->appendElementOption($key, $desc, ($key == $default));
373 }
374 return $select;
375 }
376
377 function createElementOption($key, $desc, $selected = false) {
378 $option = $this->createElement('option', $desc);
379 $option->setAttribute('value', $key);
380 if ($selected) { $option->setAttribute('selected', ''); }
381 return $option;
382 }
383
384 function createElementLabel($for_id, $value) {
385 $label = $this->createElement('label', $value);
386 $label->setAttribute('for', $for_id);
387 return $label;
388 }
389
390 function createElementJS($jsdata) {
391 $jselem = $this->createElement('script');
392 $jselem->setAttribute('type', 'text/javascript');
393 $jselem->appendChild($this->createCDATASection($jsdata));
394 return $jselem;
395 }
396
397 function createCOMElement($module, $attributes) {
398 $com_elem = $this->createElementNS(COM_NS, $module);
399 if (is_array($attributes) && count($attributes)) {
400 foreach ($attributes as $name=>$value) {
401 $com_elem->setAttribute($name, $value);
402 }
403 }
404 return $com_elem;
405 }
406}
407
408class ExtendedElement extends DOMElement {
409 // ExtendedElement PHP class
410 // this extends the general PHP DOM Element class to simplify some usual constructs
411 //
412 // function appendElement($name, [$value])
413 // appends a DOMDocument::createElement() as a child of this element (see there for params)
414 // returns the new child
415 //
416 // function appendElementXML($name, $xmldata)
417 // appends a DOMDocument::createElement() with the given name as a child of this element,
418 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
419 // returns the new child
420 //
421 // function appendLink($target, [$value])
422 // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
423 // returns the new child
424 //
425 // function appendImage($src, [$alt_text])
426 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
427 // returns the new child
428 //
429 // function appendFormDiv($action, $method, $name)
430 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
431 // returns an HTML <div> that is a child of the new child
432 //
433 // function appendInputHidden($name, $value)
434 // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
435 // returns the new child
436 //
437 // function appendInputText($name, $maxlength, $size, [$id], [$value])
438 // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
439 // returns the new child
440 //
441 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
442 // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
443 // returns the new child
444 //
445 // function appendInputRadio($name, $id, $value, $checked)
446 // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
447 // returns the new child
448 //
449 // function appendInputCheckbox($name, $id, $value, $checked)
450 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
451 // returns the new child
452 //
453 // function appendInputSubmit($value)
454 // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
455 // returns the new child
456 //
457 // function appendButton($value, $onclick = null)
458 // appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
459 // returns the new child
460 //
461 // function appendTextArea($name, $columns, $rows, [$id], [$value])
462 // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
463 // returns the new child
464 //
465 // function appendElementSelect($name, [$id], [$options], [$default])
466 // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
467 // returns the new child
468 //
469 // function appendElementOption($key, $desc, [$selected])
470 // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
471 // returns the new child
472 //
473 // function appendLabel($for_id, $value)
474 // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
475 // returns the new child
476 //
477 // function appendText($text)
478 // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
479 // returns the new child
480 //
481 // function appendComment($comment_data)
482 // appends a DOMDocument::createComment() as a child of this element (see there for params)
483 // returns the new child
484 //
485 // function appendHTMLMarkup($htmldata)
486 // appends a representation of the HTML data as children of this element
487 // NO return value!
488 //
489 // function appendXMLMarkup($xmldata)
490 // appends a representation of the XML data as children of this element
491 // NO return value!
492 //
493 // function appendJSElement($jsdata)
494 // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
495 // NO return value!
496 //
497 // function appendCOMElement($module, $attributes)
498 // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
499 // returns the new child
500
501 function appendElement($name, $value = '') {
502 return $this->appendChild($this->ownerDocument->createElement($name, $value));
503 }
504 function appendElementXML($name, $xmldata) {
505 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
506 $aelem->appendXMLMarkup($xmldata);
507 return $aelem;
508 }
509 function appendLink($target, $value = '') {
510 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
511 }
512 function appendImage($src, $alt_text = '') {
513 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
514 }
515 function appendFormDiv($action, $method, $name) {
516 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
517 return $formelem->appendElement('div');
518 }
519 function appendInputHidden($name, $value) {
520 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
521 }
522 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
523 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
524 }
525 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
526 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
527 }
528 function appendInputRadio($name, $id, $value, $checked) {
529 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
530 }
531 function appendInputCheckbox($name, $id, $value, $checked) {
532 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
533 }
534 function appendInputSubmit($value) {
535 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
536 }
537 function appendButton($value, $onclick = null) {
538 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
539 }
540 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
541 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
542 }
543 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
544 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
545 }
546 function appendElementOption($key, $desc, $selected = false) {
547 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
548 }
549 function appendLabel($for_id, $value) {
550 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
551 }
552 function appendText($text) {
553 return $this->appendChild($this->ownerDocument->createTextNode($text));
554 }
555 function appendComment($comment_data) {
556 return $this->appendChild($this->ownerDocument->createComment($comment_data));
557 }
558 function appendHTMLMarkup($htmldata) {
559 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
560 }
561 function appendXMLMarkup($xmldata) {
562 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
563 }
564 function appendJSElement($jsdata) {
565 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
566 }
567 function appendCOMElement($module, $attributes) {
568 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
569 }
570}
571
572class ExtendedDocumentFragment extends DOMDocumentFragment {
573 // ExtendedDocumentFragment PHP class
574 // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
575 //
576 // function appendElement($name, [$value])
577 // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
578 // returns the new child
579 //
580 // function appendElementXML($name, $xmldata)
581 // appends a DOMDocument::createElement() with the given name as a child of this fragment,
582 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
583 // returns the new child
584 //
585 // function appendLink($target, [$value])
586 // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
587 // returns the new child
588 //
589 // function appendImage($src, [$alt_text])
590 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
591 // returns the new child
592 //
593 // function appendFormDiv($action, $method, $name)
594 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
595 // returns an HTML <div> that is a child of the new child
596 //
597 // function appendInputHidden($name, $value)
598 // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
599 // returns the new child
600 //
601 // function appendInputText($name, $maxlength, $size, [$id], [$value])
602 // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
603 // returns the new child
604 //
605 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
606 // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
607 // returns the new child
608 //
609 // function appendInputRadio($name, $id, $value, $checked)
610 // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
611 // returns the new child
612 //
613 // function appendInputCheckbox($name, $id, $value, $checked)
614 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
615 // returns the new child
616 //
617 // function appendInputSubmit($value)
618 // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
619 // returns the new child
620 //
621 // function appendButton($value, $onclick = null)
622 // appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
623 // returns the new child
624 //
625 // function appendTextArea($name, $columns, $rows, [$id], [$value])
626 // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
627 // returns the new child
628 //
629 // function appendElementSelect($name, [$id], [$options], [$default])
630 // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
631 // returns the new child
632 //
633 // function appendElementOption($key, $desc, [$selected])
634 // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
635 // returns the new child
636 //
637 // function appendLabel($for_id, $value)
638 // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
639 // returns the new child
640 //
641 // function appendText($text)
642 // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
643 // returns the new child
644 //
645 // function appendComment($comment_data)
646 // appends a DOMDocument::createComment() as a child of this fragment (see there for params)
647 // returns the new child
648 //
649 // function appendHTMLMarkup($htmldata)
650 // appends a representation of the HTML data as children of this fragment
651 // NO return value!
652 //
653 // function appendXMLMarkup($xmldata)
654 // appends a representation of the XML data as children of this fragment
655 // NO return value!
656 //
657 // function appendJSElement($jsdata)
658 // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
659 // NO return value!
660 //
661 // function appendCOMElement($module, $attributes)
662 // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
663 // returns the new child
664
665 function appendElement($name, $value = '') {
666 return $this->appendChild($this->ownerDocument->createElement($name, $value));
667 }
668 function appendElementXML($name, $xmldata) {
669 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
670 $aelem->appendXMLMarkup($xmldata);
671 return $aelem;
672 }
673 function appendLink($target, $value = '') {
674 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
675 }
676 function appendImage($src, $alt_text = '') {
677 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
678 }
679 function appendFormDiv($action, $method, $name) {
680 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
681 return $formelem->appendElement('div');
682 }
683 function appendInputHidden($name, $value) {
684 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
685 }
686 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
687 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
688 }
689 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
690 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
691 }
692 function appendInputRadio($name, $id, $value, $checked) {
693 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
694 }
695 function appendInputCheckbox($name, $id, $value, $checked) {
696 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
697 }
698 function appendInputSubmit($value) {
699 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
700 }
701 function appendButton($value, $onclick = null) {
702 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
703 }
704 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
705 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
706 }
707 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
708 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
709 }
710 function appendElementOption($key, $desc, $selected = false) {
711 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
712 }
713 function appendLabel($for_id, $value) {
714 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
715 }
716 function appendText($text) {
717 return $this->appendChild($this->ownerDocument->createTextNode($text));
718 }
719 function appendComment($comment_data) {
720 return $this->appendChild($this->ownerDocument->createComment($comment_data));
721 }
722 function appendHTMLMarkup($htmldata) {
723 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
724 }
725 function appendXMLMarkup($xmldata) {
726 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
727 }
728 function appendJSElement($jsdata) {
729 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
730 }
731 function appendCOMElement($module, $attributes) {
732 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
733 }
734}
735?>