function generate() { $this->appendSuperHeader(); $code = ""; $tables = $this->getTablesArray(); $code .= $this->getCodeStarter(); for ($a = 0; $a < count($tables); $a++) { $thisTable = new table($tables[$a], $this->getDb()); $fields = $thisTable->getFieldNameArray(); $code .= $this->getLineEnder(); $code .= "// " . $thisTable->getTableName() . " Table" . $this->getLineEnder(); $code .= "define(\"TABLE_" . strtoupper($tables[$a]) . "\",\"" . $thisTable->getTableName() . "\");" . $this->getLineEnder(); $code .= "// Primary Key for Table " . $thisTable->getTableName() . $this->getLineEnder(); $code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_PK\",\"" . $thisTable->getPrimaryKey() . "\");" . $this->getLineEnder(); $code .= "// Field Name Mapping for Table " . $thisTable->getTableName() . $this->getLineEnder(); for ($b = 0; $b < count($fields); $b++) { $code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$b]) . "\",\"" . $fields[$b] . "\");" . $this->getLineEnder(); } $code .= "// Display Labels of Field for Table " . $thisTable->getTableName() . $this->getLineEnder(); for ($c = 0; $c < count($fields); $c++) { $code .= "define(\"LABEL_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$c]) . "\",\"" . ucfirst(strtolower($fields[$c])) . "\");" . $this->getLineEnder(); } $code .= $this->getLineEnder(); } $code .= $this->getCodeEnder(); $this->appendToCode($code); $beautifulCode = codeBeautifier::beautify($this->getSourceCode()); return $beautifulCode; }
function selectKeywordGenerator($table, $db, $selectedFieldsArray = "", $orderByArray = "", $orderDirection = "", $startLimit = "", $numOfRows = "", $distinct = "", $wherePk = "") { $thisTable = new table($table, $db); $fieldNames = $thisTable->getFieldNameArray(); $whereString = " WHERE "; $fieldCount = count($fieldNames); for ($c = 0; $c < $fieldCount; $c++) { $whereString .= $fieldNames[$c] . " like '%\$thisKeyword%' "; if ($c != $fieldCount - 1) { $whereString .= " OR "; } } $this->setWhereString($whereString); $this->constructSQL($thisTable); }
<?php include_once "//var/www/gip/app/settings/gipConfiguration.inc.php"; include_once INC_SUPERHEADER; include_once CLASS_TABLE; $arguments = array(); $arguments['db'] = requestUtils::getRequestObject('db'); $arguments['table'] = requestUtils::getRequestObject('table'); $arguments['headerText'] = ""; $arguments['footerText'] = ""; $thisTable = new table($arguments['table'], $arguments['db']); $fieldNames = $thisTable->getFieldNameArray(); ?> <h2>Please choose what you want in your Insert Code?</h2> <form name="libraryPreInsertForm" method="POST" action="simpleInsertScriptGenerator.php"> <input type="hidden" name="table" value="<?php echo $arguments['table']; ?> "> <input type="hidden" name="db" value="<?php echo $arguments['db']; ?> "> <table> <tr valign=top> <td><h3>Header : </h3></td> <td><input type="checkbox" name="header" value="" checked> </td> </tr>
<?php include_once "//var/www/gip/app/settings/gipConfiguration.inc.php"; include_once INC_SUPERHEADER; include_once CLASS_TABLE; include_once CLASS_PLUGIN_LOADER; $thisPlugInLoader = new plugInLoader(); $arguments = array(); $arguments['db'] = requestUtils::getRequestObject('db'); $arguments['table'] = requestUtils::getRequestObject('table'); $arguments['headerText'] = ""; $arguments['footerText'] = ""; $thisTable = new table($arguments['table'], $arguments['db']); $allFields = $thisTable->getFieldNameArray(); $fields = requestUtils::getRequestObject("chosenFieldName"); for ($a = 0; $a < count($allFields); $a++) { $fieldSize[$allFields[$a]] = requestUtils::getRequestObject("size" . $allFields[$a]); $fieldType[$allFields[$a]] = requestUtils::getRequestObject("inputType" . $allFields[$a]); $fieldLabel[$allFields[$a]] = requestUtils::getRequestObject("label" . $allFields[$a]); } $arguments['chosenFields'] = requestUtils::getRequestObject('chosenFieldName'); $arguments['fieldSize'] = $fieldSize; $arguments['fieldType'] = $fieldType; $arguments['label'] = $fieldLabel; $arguments['formType'] = requestUtils::getRequestObject('formType'); $generatedCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_SIMPLE_WEB_ENTER_FORM_GENERATOR_NAME, PLUGIN_PHP_SIMPLE_WEB_ENTER_FORM_GENERATOR_CLASS, $arguments); highlight_string($generatedCode);
<?php include_once "//var/www/gip/app/settings/gipConfiguration.inc.php"; include_once INC_SUPERHEADER; include_once CLASS_PLUGIN_LOADER; include_once CLASS_TABLE; $thisPlugInLoader = new plugInLoader(); $arguments = array(); $thisDb = requestUtils::getRequestObject('db'); $thisTable = requestUtils::getRequestObject('table'); $tableObject = new table($thisTable, $thisDb); $arguments['variables'] = $tableObject->getFieldNameArray(); $arguments['functions'] = array(); $arguments['className'] = strtolower($thisTable) . ucfirst(strtolower(NAME_DATA_CONTAINER)); $generatedCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_CLASS_GENERATOR_NAME, PLUGIN_PHP_CLASS_GENERATOR_CLASS, $arguments); highlight_string($generatedCode);