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 generate()
 {
     $this->appendSuperHeader();
     $this->generateTableClassLocations();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
 function generate()
 {
     $this->appendSuperHeader();
     $this->generateHtmlConstants();
     $this->generatePageConstants();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
 function generate()
 {
     $this->appendSuperHeader();
     $this->appendAppHeader();
     $this->appendToCode($this->getGenManagerHeader());
     $this->appendToCode($this->generateManagerCode());
     $this->appendAppFooter();
     $this->appendSuperFoooter();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
 function generate()
 {
     $thisPlugInLoader = new plugInLoader();
     $thisTable = $this->getTableObject();
     $arguments = "";
     $arguments['db'] = $thisTable->getDatabase();
     $arguments['table'] = $thisTable->getTableName();
     $arguments['variables'] = $thisTable->getFieldNameArray();
     $arguments['functions'] = array();
     $arguments['className'] = strtolower($thisTable->getTableName()) . ucfirst(strtolower(NAME_DATA_CONTAINER));
     $generatedCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_CLASS_GENERATOR_NAME, PLUGIN_PHP_CLASS_GENERATOR_CLASS, $arguments);
     $this->appendToCode($generatedCode);
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
 function generate()
 {
     $this->appendSuperHeader();
     $this->appendAppHeader();
     $code = "";
     $code .= "<?php\n";
     $code .= "include_once(CONFIG_FILE);\n";
     $code .= "include_once(CLASS_" . strtoupper($this->getTableName()) . "_GENMANAGER);\n";
     $code .= "?>\n";
     $this->appendToCode($code);
     $this->appendToCode($this->generateManagerCode());
     $this->appendAppFooter();
     $this->appendSuperFoooter();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
Exemple #7
0
    $thisLine = rtrim(ltrim($lines[$a]));
    if ($thisLine != "") {
        if ($generateKind == "php") {
            $newCode .= "\t\t\t\$code .= \"";
            $thisLine = str_replace("\"", "\\\"", $thisLine);
            $thisLine = str_replace("\$", "\\\$", $thisLine);
            $newCode .= rtrim(ltrim($thisLine));
            $newCode .= "\\n\";\n";
        } else {
            if ($generateKind == "javascript") {
                $newCode .= "document.write('";
                $newCode .= rtrim(ltrim($thisLine));
                $newCode .= "');\n";
            }
        }
    }
}
$newCode .= "\n\t\t\t// Returning Generated Code\n";
$newCode .= "\t\t\treturn \$code;\n\n";
$newCode .= "\t\t} // end of generate() method \n\n";
$newCode .= "\t} // end of " . $generatorName . " class\n";
$newCode .= "?>";
if ($generateKind == "php") {
    //$newCode .= "\$code .= \"\";\n";
} else {
    if ($generateKind == "javascript") {
        $newCode .= "</script>\n\n";
    }
}
$beautifulCode = codeBeautifier::beautify($newCode);
highlight_string($beautifulCode);