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