Esempio n. 1
0
 /**
  * Construct a new table element with the specified caption, if given.
  * Which it really ought to be, as unlabeled tables are confusing and bad.
  * @param string $caption Caption for the table. (Optional)
  */
 public function __construct($caption = null)
 {
     $this->tagName = 'table';
     if ($caption) {
         $c = new CustomContainerElement('caption');
         $c->appendChild(new TextElement($caption));
         parent::appendChild($c);
     }
 }
Esempio n. 2
0
 /**
  * Construct a new fieldset element, with the specified set of children if
  * actually specified, or empty if not.
  * @param string $legend  Descriptive text for this fieldset. (Optional)
  * @param array $children Children to add to the fieldset initially.
  *                        (Optional)
  */
 public function __construct($legend = null, $children = array())
 {
     $this->tagName = 'fieldset';
     if ($legend && is_string($legend)) {
         $l = new CustomContainerElement('legend');
         $l->appendChild(new TextElement($legend));
         $this->appendChild($l);
     }
     foreach ($children as $c) {
         $this->appendChild($c);
     }
 }