Пример #1
0
 /**
  * declare a child control to the form. The given control should be a child of an other control
  * @param jFormsControl $control
  */
 public function addChildControl($control)
 {
     $this->controls[$control->ref] = $control;
     if ($control->type == 'submit') {
         $this->submits[$control->ref] = $control;
     } else {
         if ($control->type == 'reset') {
             $this->reset = $control;
         } else {
             if ($control->type == 'upload') {
                 $this->uploads[$control->ref] = $control;
             } else {
                 if ($control->type == 'hidden') {
                     $this->hiddens[$control->ref] = $control;
                 } else {
                     if ($control->type == 'htmleditor') {
                         $this->htmleditors[$control->ref] = $control;
                     }
                 }
             }
         }
     }
     $control->setForm($this);
     if (!isset($this->container->data[$control->ref])) {
         if ($control->datatype instanceof jDatatypeDateTime && $control->defaultValue == 'now') {
             $dt = new jDateTime();
             $dt->now();
             $this->container->data[$control->ref] = $dt->toString($control->datatype->getFormat());
         } else {
             $this->container->data[$control->ref] = $control->defaultValue;
         }
     }
 }