function generateEnterForm() { $thisTable = $this->getTableObject(); $thisHtmlFormBuilder = new htmlFormElementBuilder(); if ($this->getFormType() == "enter") { $actionName = LANG_BASIC_ENTER; $scriptName = "insertNew"; } else { if ($this->getFormType() == "edit") { $actionName = LANG_BASIC_UPDATE; $scriptName = "update"; } } $code = ""; $code .= "<h2>" . $actionName . " " . ucfirst($thisTable->getTableName()) . "</h2>" . $this->getLineEnder(); $code .= "<form name=\"" . strtolower($thisTable->getTableName()) . ucfirst($actionName) . "Form\" method=\"POST\" action=\"" . $scriptName . ucfirst(strtolower($thisTable->getTableName())) . ".php\">" . $this->getLineEnder() . $this->getLineEnder(); $code .= "<table cellspacing=\"2\" cellpadding=\"2\" border=\"0\" width=\"100%\">" . $this->getLineEnder(); $chosenFields = $this->getChosenFields(); $fieldSizes = $this->getFieldSizeArray(); $fieldTypes = $this->getFieldTypeArray(); $fieldLabels = $this->getFieldLabelArray(); for ($a = 0; $a < count($chosenFields); $a++) { $fieldName = $chosenFields[$a]; if ($this->getFormType() == "enter") { $defaultValue = ""; } else { if ($this->getFormType() == "edit") { $defaultValue = "<? echo \$this" . ucfirst($fieldName) . "; ?>"; } } $code .= $this->getCodeTab() . "<tr valign=\"top\" height=\"20\">" . $this->getLineEnder(); $code .= $this->getCodeTab() . $this->getCodeTab(); $code .= "<td align=\"right\"> <b> " . $fieldLabels[$fieldName] . " </b> </td>" . $this->getLineEnder(); $code .= $this->getCodeTab() . $this->getCodeTab(); $code .= "<td> "; $code .= rtrim(ltrim($thisHtmlFormBuilder->buildAndPrintFormElement($fieldTypes[$fieldName], NAME_FORM_FIELD_PREFIX . ucfirst($fieldName) . NAME_FORM_FIELD_SUFFIX, $defaultValue, $fieldSizes[$fieldName]))); $code .= " </td> "; $code .= $this->getLineEnder(); $code .= $this->getCodeTab() . "</tr>" . $this->getLineEnder(); } $code .= "</table>" . $this->getLineEnder() . $this->getLineEnder(); $code .= "<input type=\"submit\" name=\"submit" . ucfirst($actionName) . ucfirst($thisTable->getTableName()) . "Form\" value=\"" . ucfirst($actionName) . " " . ucfirst($thisTable->getTableName()) . "\">" . $this->getLineEnder(); $code .= "<input type=\"reset\" name=\"resetForm\" value=\"" . LANG_BASIC_CLEAR_FORM . "\">" . $this->getLineEnder() . $this->getLineEnder(); $code .= "</form>" . $this->getLineEnder(); $this->appendToCode($code); }
$arguments = array(); $generateWhatForm = requestUtils::getRequestObject('formType'); $arguments['db'] = requestUtils::getRequestObject('db'); $arguments['table'] = requestUtils::getRequestObject('table'); $arguments['headerText'] = ""; $arguments['footerText'] = ""; if ($generateWhatForm == "enter") { $scriptToGo = PAGE_GENERATOR_PHP_GFRAMEWORK_ENTER_FORM; } else { if ($generateWhatForm == "edit") { $scriptToGo = PAGE_GENERATOR_PHP_GFRAMEWORK_ENTER_FORM; } } $thisTable = new table($arguments['table'], $arguments['db']); $fieldNames = $thisTable->getFieldNameArray(); $thisHtmlFormBBuilder = new htmlFormElementBuilder(); ?> <h2><?php echo LANG_SIMPLE_FORM_MAKER_CHOOSE_FIELDS; ?> <?php echo $arguments['table']; ?> </h2> <?php echo LANG_SIMPLE_FORM_MAKER_CHECK_BOXES; ?> <b><?php echo $arguments['table']; ?> </b>.<br><br>