Example #1
0
 function draw()
 {
     global $fsecuence;
     $errors = errorobject::errorParams();
     // return "<tr class=\"form_row".($fsecuence%2==0 ? "_odd":"_even")."\"><td class=\"form_row_caption\"><span class=\"form_caption\"  ".($errors[$this->name] ? "style=\"color: red;\"" : "" ).">".$this->caption."</span><br />".$this->description."</td></tr><tr><td class=\"form_row_field\"><textarea name=\"".$this->name."\"  ".($errors[$this->name] ? "style=\"border: solid 2px red;margin:-2px;\"" : "" ).">".$this->value."</textarea></td></tr>";
     $oFCKeditor = new FCKeditor($this->name);
     $oFCKeditor->BasePath = '/FCKeditor/';
     $oFCKeditor->Value = $this->value;
     $oFCKeditor->Height = $this->height;
     $oFCKeditor->Width = $this->width;
     $out .= $oFCKeditor->CreateHTML();
     return "<tr class=\"form_row" . ($fsecuence % 2 == 0 ? "_odd" : "_even") . "\"><td colspan=\"2\" class=\"form_row_field\">" . $out . "</td></tr>";
 }
Example #2
0
 function draw()
 {
     $o = $this->popMailBox();
     if (get_class($o) != "scaffold") {
         $sc = new scaffold($o->__table);
         $o->__datafields = $sc->__datafields;
     }
     $this->name = md5($this->name);
     $out .= "<form id=\"" . $this->name . "\"  class=\"" . $this->css_form . "\" method=\"post\" action=\"" . $this->action . "\">";
     $out .= "<input type=\"hidden\" name=\"" . $this->name . "_id" . "\" value=\"" . $o->id . "\" >";
     $out .= "<table>";
     $count = 1;
     $errors = errorobject::errorParams();
     foreach ($o as $k => $v) {
         if (strpos($k, "__") === false) {
             if ($this->__hidden[$k] == true) {
                 $out .= ($count % 2 == 0 ? "<tr>" : "") . "<td colspan=\"2\"><input type=\"hidden\" name=\"" . $k . "\" value=\"" . $v . "\"></td></tr>";
             } else {
                 $out .= ($count % 2 == 0 ? "<tr>" : "") . "<td class=\"dataform_title\"><b>" . ($this->__headers[$k] ? $this->__headers[$k] : $k) . "</b></td><td class=\"dataform\" style=\"padding-right:33px;\">";
                 if (is_array($this->__fieldobjects[$k])) {
                     $do = $this->__fieldobjects[$k]["object"];
                     $list = $do->getList();
                     $key = $this->__fieldobjects[$k]["property"];
                     $sout = "<select  " . ($errors[$k] ? "class=\"dataform_error\"" : "") . " name=\"" . $k . "\"><option value=\"0\">---</option>";
                     for ($li = 0; $li < count($list); $li++) {
                         if ($list[$li]["id"] != $v) {
                             $sout .= "<option value=\"" . $list[$li]["id"] . "\">" . $list[$li][$key] . "</option>";
                         } else {
                             $sout .= "<option value=\"" . $list[$li]["id"] . "\" selected style=\"font-weight:bold\">" . $list[$li][$key] . "</option>";
                         }
                     }
                     $sout .= "</select>";
                     $out .= $sout . "</td>" . ($count % 2 == 0 ? "</tr>" : "") . "";
                     $count++;
                     continue;
                 }
                 if (is_array($this->__fieldwidgets[$k])) {
                     if (is_object($this->__fieldwidgets[$k]["entity"]) === false) {
                         $ef = $this->__fieldwidgets[$k]["entityfield"];
                         $eo = new $this->__fieldwidgets[$k]["entity"]();
                         $eo->{$ef} = $v;
                         $w = new $this->__fieldwidgets[$k]["widget"]();
                         $w->drop($eo);
                     } else {
                         $eo = $this->__fieldwidgets[$k]["entity"];
                         $do = new dataobject();
                         foreach ($rows[$i] as $w => $s) {
                             $do->{$w} = $s;
                         }
                         $eo->drop($do);
                         $w = new $this->__fieldwidgets[$k]["widget"]();
                         $w->drop($eo);
                     }
                     $out .= $w->draw() . "</td>" . ($count % 2 == 0 ? "</tr>" : "") . "";
                     $count++;
                     continue;
                 }
                 switch ($o->__datafields[$k]) {
                     case "bool":
                         $out .= "<input " . ($fc == 0 ? "id=\"first\"" : "") . " " . ($errors[$k] ? "class=\"dataform_error\"" : "") . " type=\"checkbox\" name=\"" . $k . "\" " . ($v == true ? "checked" : "") . " />&nbsp;</input>";
                         break;
                     case "int":
                         $out .= "<input  " . ($fc == 0 ? "id=\"first\"" : "") . " " . ($errors[$k] ? "class=\"dataform_error\"" : "") . " type=\"text\" " . ($this->__disabled[$k] ? "readonly=\"readonly\"" : "") . " name=\"" . $k . "\" value=\"" . $v . "\" size=\"10\"/>";
                         break;
                     case "float":
                         $out .= "<input " . ($fc == 0 ? "id=\"first\"" : "") . " " . ($errors[$k] ? "class=\"dataform_error\"" : "") . " type=\"text\" " . ($this->__disabled[$k] ? "readonly=\"readonly\"" : "") . " name=\"" . $k . "\" value=\"" . $v . "\" size=\"10\"/>";
                         break;
                     case "varchar":
                         $out .= "<input " . ($fc == 0 ? "id=\"first\"" : "") . "  " . ($errors[$k] ? "class=\"dataform_error\"" : "") . "type=\"text\" " . ($this->__disabled[$k] ? "readonly=\"readonly\"" : "") . " name=\"" . $k . "\" value=\"" . $v . "\" size=\"30\"/>";
                         break;
                     case "text":
                         $out .= "<textarea  " . ($fc == 0 ? "id=\"first\"" : "") . " " . ($errors[$k] ? "class=\"dataform_error\"" : "") . "cols=\"40\" rows=\"4\" name=\"" . $k . "\">" . $v . "</textarea>";
                         break;
                         $fc++;
                         // hack para obtener foco en el primer field del formulario
                 }
             }
             $count++;
             $out .= "</td>" . ($count % 2 == 0 ? "</tr>" : "") . "";
         }
     }
     $out .= "\n\t\t<script>\n\t\tfunction getFocus()\n\t\t{\n\t\t\t\tf = document.getElementById('first').focus();\n\t\t}\n\t\tgetFocus();\n\t\t</script>";
     $out .= "<tr><td colspan=\"2\"><button onclick=\"document.getElementById('" . $this->name . "').submit();\"><img src=\"icons/16x16/resultset_next.png\">" . $this->submit . "</button> </td></tr></table></form>";
     return $out;
 }