Example #1
0
 function renderStTag()
 {
     self::$sForm[] = $this;
     self::$sCount = count(self::$sForm);
     $out = array();
     foreach ($this->form->getHTMLProp() as $k => $v) {
         $out[] = "{$k}=\"{$v}\"";
     }
     $fields = $this->form->getFields();
     $labelTags = $this->find(array(array("type" => "label")));
     foreach ($labelTags as $tag) {
         if ($tag instanceof Html) {
             foreach ($tag->source as $source) {
                 if (isset($fields[$source])) {
                     $fields[$source]->getLabelAttStatic($tag->opt, $tag->type, $tag->content);
                 } else {
                     $tag->opt['style'] = "display:none;";
                 }
             }
         }
     }
     $inputTags = $this->find(array(array("type" => "hint")));
     foreach ($inputTags as $tag) {
         if ($tag instanceof Html) {
             foreach ($tag->source as $source) {
                 if (isset($fields[$source])) {
                     $fields[$source]->getHintAttStatic($tag->opt, $tag->type, $tag->content);
                 } else {
                     $tag->opt['style'] = "display:none;";
                 }
             }
         }
     }
     $inputTags = $this->find(array(array("type" => "input")));
     foreach ($inputTags as $tag) {
         if ($tag instanceof Html) {
             foreach ($tag->source as $source) {
                 if (isset($fields[$source])) {
                     $fields[$source]->getInputAttStatic($tag->opt, $tag->type, $tag->content);
                     unset($fields[$source]);
                 } else {
                     $tag->opt['style'] = "display:none;";
                 }
             }
         }
     }
     foreach ($fields as $n => $f) {
         if (!$f instanceof Button) {
             $this->addChild($label = new DynHtml("label", [], [], "", $n));
             $f->getLabelAttStatic($label->opt, $label->type, $label->content);
         }
         $this->addChild($input = new DynHtml("input", [], [], "", $n));
         $f->getInputAttStatic($input->opt, $input->type, $input->content);
     }
     return "<form " . implode(" ", $out) . "><?php \$form = " . $this->var->toPHP() . "; \$form->process(); ?>";
 }