コード例 #1
0
 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;
 }
コード例 #2
0
 function generate()
 {
     $this->appendSuperHeader();
     $this->generateTableClassLocations();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
コード例 #3
0
 function generate()
 {
     $this->appendSuperHeader();
     $this->generateHtmlConstants();
     $this->generatePageConstants();
     $beautifulCode = codeBeautifier::beautify($this->getSourceCode());
     return $beautifulCode;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: generateEjbCode.php プロジェクト: juddy/GIP
<?php

include_once "//var/www/gip/app/settings/gipConfiguration.inc.php";
include_once INC_SUPERHEADER;
include_once CLASS_PLUGIN_LOADER;
include_once CLASS_PHP_CODE_BEAUTIFIER;
$thisCodeBeautifier = new codeBeautifier();
$thisPlugInLoader = new plugInLoader();
$fieldNames = $_REQUEST['fieldNames'];
for ($a = 0; $a < count($fieldNames); $a++) {
    $fieldTypes[$fieldNames[$a]] = $_REQUEST["fieldType" . $fieldNames[$a]];
    $fieldLabels[$fieldNames[$a]] = $_REQUEST["label" . $fieldNames[$a]];
}
$arguments['db'] = $_REQUEST['db'];
$arguments['table'] = $_REQUEST['table'];
$arguments['fieldTypes'] = $fieldTypes;
$arguments['fieldLabels'] = $fieldLabels;
$arguments['packageRoot'] = $_REQUEST['packageRoot'];
$generatedCode = $thisPlugInLoader->loadPlugIn(PLUGIN_JAVA_EJB_BEAN_GENERATOR_NAME, PLUGIN_JAVA_EJB_BEAN_GENERATOR_CLASS, $arguments);
echo "<h2>EJB INFO Bean</h2>";
$thisCodeBeautifier->printBeautifulJavaCode($generatedCode);
echo "<hr>";
$generatedCode1 = $thisPlugInLoader->loadPlugIn(PLUGIN_JAVA_EJB_GENERATOR_NAME, PLUGIN_JAVA_EJB_GENERATOR_CLASS, $arguments);
echo "<h2>EJB</h2>";
$thisCodeBeautifier->printBeautifulJavaCode($generatedCode1);
echo "<hr>";
$generatedCode2 = $thisPlugInLoader->loadPlugIn(PLUGIN_JAVA_EJB_LOCAL_GENERATOR_NAME, PLUGIN_JAVA_EJB_LOCAL_GENERATOR_CLASS, $arguments);
echo "<h2>EJB LOCAL</h2>";
$thisCodeBeautifier->printBeautifulJavaCode($generatedCode2);
echo "<hr>";
echo "<h2>EJB LOCAL HOME</h2>";
コード例 #8
0
ファイル: generateAllSql.php プロジェクト: juddy/GIP
<?php

include_once "//var/www/gip/app/settings/gipConfiguration.inc.php";
include_once INC_SUPERHEADER;
include_once CLASS_PLUGIN_LOADER;
include_once CLASS_PHP_CODE_BEAUTIFIER;
$thisCodeBeautifier = new codeBeautifier();
$thisPlugInLoader = new plugInLoader();
$arguments['db'] = $_REQUEST['db'];
$arguments['table'] = $_REQUEST['table'];
/*
$insertSQL = $thisPlugInLoader->loadPlugIn(
PLUGIN_SQL_INSERT_GENERATOR_NAME,
PLUGIN_SQL_INSERT_GENERATOR_CLASS,
$arguments
);


echo "<h2>Insert SQL</h2>";
$thisCodeBeautifier->printBeautifulSQL($insertSQL);
echo "<hr>";


$updateSQL = $thisPlugInLoader->loadPlugIn(
PLUGIN_SQL_UPDATE_GENERATOR_NAME,
PLUGIN_SQL_UPDATE_GENERATOR_CLASS,
$arguments
);


echo "<h2>Update SQL</h2>";
コード例 #9
0
ファイル: convertCode.php プロジェクト: juddy/GIP
    $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);