function copyConfigFiles($configurationFileName, $projectConfigRoot) { $commonConfigLocation = FILES_TO_COPY_PHP_TEMPLATE_FRAMEWORK . FILE_SEPARATOR . "config"; fileSystemUtils::xcopy($commonConfigLocation, $projectConfigRoot); //$replacementPairs = ""; //$replacementPairs[] = new pair("{APPLICATION_NAME}",$appName); //fileSystemUtils::xReplaceStringInFiles($rootDirectory,$replacementPairs); }
function xReplaceStringInFiles($rootDirectory, $replacementPairs) { if (!is_dir($rootDirectory)) { return 0; } else { $handle = @dir($rootDirectory); while (@($entry = $handle->read()) !== false) { if ($entry != "." && $entry != ".." && $entry != "cvs" && $entry != "CVS") { if (is_dir("{$source}/{$entry}") && $dest !== $source . FILE_SEPARATOR . $entry) { fileSystemUtils::xReplaceStringInFiles($source . FILE_SEPARATOR . $entry, $replacementPairs); } else { stringUtils::replaceStringInFileAndSaveFile($rootDirectory . FILE_SEPARATOR . $entry, $replacementPairs); } } } $handle->close(); return 1; } }
</td> <td><?php echo LANG_BASIC_AUTHOR; ?> </td> <td><?php echo LANG_BASIC_RUN; ?> </td> </tr> <?php for ($a = 0; $a < count($plugins); $a++) { $thisPlugIn = $plugins[$a]; $fileString = fileSystemUtils::getStringFromFile($thisPlugIn); preg_match_all('/<DESCRIPTION>(.+)<\\/DESCRIPTION>/', $fileString, $descMatch); preg_match_all('/<PARAMETERS>(.+)<\\/PARAMETERS>/', $fileString, $parameterMatch); preg_match_all('/<AUTHOR>(.+)<\\/AUTHOR>/', $fileString, $authorMatch); preg_match_all('/<PLUGINNAME>(.+)<\\/PLUGINNAME>/', $fileString, $nameMatch); preg_match_all('/<LOADER>(.+)<\\/LOADER>/', $fileString, $loaderMatch); $description = $descMatch[1][0]; $author = $authorMatch[1][0]; $name = $nameMatch[1][0]; $loader = isset($loaderMatch[1][0]) ? $loaderMatch[1][0] : ""; $parameters = isset($parameterMatch[1][0]) ? $parameterMatch[1][0] : ""; if ($author == "") { $author = LANG_BASIC_ANONYMOUS; } if ($description == "") { $description = LANG_BASIC_NOT_AVAILABLE;
$thisGenEdit = requestUtils::getRequestObject('edit'); $thisGenDelete = requestUtils::getRequestObject('delete'); $thisGenList = requestUtils::getRequestObject('lister'); $thisGenSearch = requestUtils::getRequestObject('search'); $thisGenView = requestUtils::getRequestObject('viewRecord'); $thisCopyCommon = requestUtils::getRequestObject('copyCommon'); $thisGenIndex = "y"; $thisLanguage = requestUtils::getRequestObject('language'); $thisTables = requestUtils::getRequestObject('tableName'); $headerText = requestUtils::getRequestObject('headerText'); $footerText = requestUtils::getRequestObject('footerText'); $headerText = "include_once(\"../common/dbConnection.php\");\ninclude_once(\"../common/header.php\");"; $footerText = "include_once(\"../common/footer.php\");"; $thisDb = requestUtils::getRequestObject('db'); $thisTable = requestUtils::getRequestObject('table'); $thisFileUtils = new fileSystemUtils(); $arguments['db'] = requestUtils::getRequestObject('db'); echo "Generated Code Root : <b>{$thisGeneratePath} </b> <br><br>"; $thisFileUtils->makeDirectoryRecursive($thisGeneratePath); if (!$thisFileUtils->doesDirectoryExists($thisGeneratePath)) { ?> The path that you have entered to be the root for your code Generation does not exist on your system. Code Genie cannot proceed. Please make sure that the directory <b><?php echo $thisGeneratePath; ?> </b> exists on the file System. <br><br> <?php exit; } else { if (count($thisTables) == 0) { ?> You did not select any tables for Auto Code Generation. You need to select at least one table. Please go back and choose again.
<?php include_once "//var/www/gip/app/settings/gipConfiguration.inc.php"; include_once INC_SUPERHEADER; include_once CLASS_PLUGIN_LOADER; include_once CLASS_FILESYSTEM_UTILS; include_once CLASS_DATABASE; $thisFileSystemUtils = new fileSystemUtils(); $thisPlugInLoader = new plugInLoader(); $thisDatabase = new database(); $thisDb = requestUtils::getRequestObject('db'); echo "Db : {$thisDb} <br>"; $thisDatabase->useDatabase($thisDb); $dbTables = $thisDatabase->getDbTables(); $arguments = array(); for ($a = 0; $a < count($dbTables); $a++) { $arguments['db'] = requestUtils::getRequestObject('db'); $arguments['table'] = requestUtils::getRequestObject('table'); echo "<pre>"; print_r($arguments); echo "</pre>"; echo "<hr>"; $generatedEnterFormCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_ENTER_FORM_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_ENTER_FORM_GENERATOR_CLASS, $arguments); $generatedInsertCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_INSERT_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_INSERT_GENERATOR_CLASS, $arguments); $generatedEditFormCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_EDIT_FORM_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_EDIT_FORM_GENERATOR_CLASS, $arguments); $generatedUpdateCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_UPDATE_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_UPDATE_GENERATOR_CLASS, $arguments); $generatedViewRecordCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_INSERT_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_INSERT_GENERATOR_CLASS, $arguments); $newWebPath = GENERATED_FILES_FOLDER . FILE_SEPARATOR . strtolower($_SESSION['db']) . FILE_SEPARATOR . "web" . FILE_SEPARATOR . "generatedForms" . FILE_SEPARATOR . strtolower($arguments['table']); $newAppPath = GENERATED_FILES_FOLDER . FILE_SEPARATOR . strtolower($_SESSION['db']) . FILE_SEPARATOR . "app" . FILE_SEPARATOR . "classes" . FILE_SEPARATOR . strtolower($arguments['table']); $newEnterFileName = $newWebPath . FILE_SEPARATOR . "enterNew" . ucfirst($arguments['table']) . ".php"; $newInsertFileName = $newWebPath . FILE_SEPARATOR . "insert" . ucfirst($arguments['table']) . ".php";
function replaceStringInFileAndSaveFile($fullFileName, $replacementPairs) { $fileString = fileSystemUtils::getStringFromFile($fullFileName); $newString = stringUtils::replaceAndGetNewString($fileString, $replacementPairs); return fileSystemUtils::saveStringInFile($fullFileName, $newString); }
$thisGenDao = requestUtils::getRequestObject('genDao'); $thisGenManager = requestUtils::getRequestObject('genManager'); $thisInfoObject = requestUtils::getRequestObject('infoObject'); $thisManager = requestUtils::getRequestObject('manager'); $thisDao = requestUtils::getRequestObject('dao'); $thisConstants = requestUtils::getRequestObject('constants'); $thisCopyCommon = requestUtils::getRequestObject('copyCommon'); $thisFrontEnd = requestUtils::getRequestObject('frontEnd'); $thisLanguage = requestUtils::getRequestObject('language'); $thisTables = requestUtils::getRequestObject('tableName'); $thisDb = requestUtils::getRequestObject('db'); $thisTable = requestUtils::getRequestObject('table'); $headerText = requestUtils::getRequestObject('headerText'); $footerText = requestUtils::getRequestObject('footerText'); $tableSideBar = ""; $thisFileUtils = new fileSystemUtils(); $thisCommonFileCopier = new gipCommonFileCopier(); if ($thisConfigFile == ".conf.php") { $thisConfigFile = DEFAULT_CONFIGURATION_FILE_NAME . ".conf.php"; } $arguments['db'] = $thisDb; $mainIndexes = array(); echo "All Code will be generated in path <font color=red><b>" . $thisGeneratePath . "</b></font><br><br>"; $thisFileUtils->makeDirectoryRecursive($thisGeneratePath); if (!$thisFileUtils->doesDirectoryExists($thisGeneratePath)) { ?> The path that you have entered to be the root for your code Generation does not exist on your system. Code Genie cannot proceed. Please make sure that the directory <b><?php echo $thisGeneratePath; ?> </b> exists on the file System. <br><br> <?php