PrintInstructions(); } if (!defined('__QCUBED__')) { print "Error: __QCUBED__ setting is not defined. Make sure {$qcubedBaseDir} is the correct QCubed base directory\n"; PrintInstructions(); } } $settingsFile = __CONFIGURATION__ . '/codegen_settings.xml'; if (!is_file($settingsFile)) { print "Error: Could not locate codegen settings file: {$settingsFile} does not exist\n"; PrintInstructions(); } require __QCUBED__ . '/codegen/QCodeGen.class.php'; ///////////////////// // Run Code Gen QCodeGen::Run($settingsFile); ///////////////////// if ($strErrors = QCodeGen::$RootErrors) { printf("The following ROOT ERRORS were reported:\r\n%s\r\n\r\n", $strErrors); } else { printf("CodeGen settings (as evaluted from %s):\r\n%s\r\n\r\n", $settingsFile, QCodeGen::GetSettingsXml()); } foreach (QCodeGen::$CodeGenArray as $objCodeGen) { printf("%s\r\n---------------------------------------------------------------------\r\n", $objCodeGen->GetTitle()); printf("%s\r\n", $objCodeGen->GetReportLabel()); printf("%s\r\n", $objCodeGen->GenerateAll()); if ($strErrors = $objCodeGen->Errors) { printf("The following errors were reported:\r\n%s\r\n", $strErrors); } print "\r\n"; }
Usage: ' . $strCommandName . ' CODEGEN_SETTINGS Where CODEGEN_SETTINGS is the absolute filepath of the codegen_settings.xml file, containing the code generator settings. For more information, please go to http://qcu.be '; exit; } if ($_SERVER['argc'] != 2) { PrintInstructions(); } ///////////////////// // Run Code Gen QCodeGen::Run($_SERVER['argv'][1]); ///////////////////// if ($strErrors == QCodeGen::$RootErrors) { printf("The following ROOT ERRORS were reported:\r\n%s\r\n\r\n", $strErrors); } else { printf("CodeGen settings (as evaluted from %s):\r\n%s\r\n\r\n", $_SERVER['argv'][1], QCodeGen::GetSettingsXml()); } foreach (QCodeGen::$CodeGenArray as $objCodeGen) { printf("%s\r\n---------------------------------------------------------------------\r\n", $objCodeGen->GetTitle()); printf("%s\r\n", $objCodeGen->GetReportLabel()); printf("%s\r\n", $objCodeGen->GenerateAll()); if ($strErrors = $objCodeGen->Errors) { printf("The following errors were reported:\r\n%s\r\n", $strErrors); } print "\r\n"; }
///////////////////////////////////////////////////// // Run CodeGen, using the path to the codegen settings "settings.xml" file // Change below if your settings.xml file is in a different location ///////////////////////////////////////////////////// $strSettingsXmlFilePath = __DEVTOOLS_CLI__ . '/settings/codegen.xml'; /*if (!file_exists($strSettingsXmlFilePath) || !is_file($strSettingsXmlFilePath)) { _p('<div class="error">', false); _p('The Qcodo Web-based CodeGen tool expects the codegen settings <strong>"codegen.xml"</strong> file to be located at:<br/><strong>', false); _p($strSettingsXmlFilePath); _p('</strong><br/><br/>', false); _p('Either ensure that the <strong>"codegen.xml"</strong> exists there (recommended) or alternatively to update:<br/>', false); _p('<strong>' . __FILE__ . '</strong><br/> to reflect the correct path (not as recommended).</pre>', false); _p('</div></body></html>', false); exit(); }*/ QCodeGen::Run($strSettingsXmlFilePath); function DisplayMonospacedText($strText) { $strText = QApplication::HtmlEntities($strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace("\r", '', $strText); $strText = str_replace("\n", '<br/>', $strText); _p($strText, false); } ////////////////// // Output the Page ////////////////// ?> <?php if ($strErrors = QCodeGen::$RootErrors) {
<?php require_once '../qcubed.inc.php'; // Load in the QCodeGen Class require __QCUBED__ . '/codegen/QCodeGen.class.php'; // code generators include __QCUBED_CORE__ . '/codegen/controls/_class_paths.inc.php'; // Security check for ALLOW_REMOTE_ADMIN // To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below QApplication::CheckRemoteAdmin(); ///////////////////////////////////////////////////// // Run CodeGen, using the ./codegen_settings.xml file ///////////////////////////////////////////////////// QCodeGen::Run(__CONFIGURATION__ . '/codegen_settings.xml'); function DisplayMonospacedText($strText) { $strText = QApplication::HtmlEntities($strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace("\r", '', $strText); $strText = str_replace("\n", '<br/>', $strText); _p($strText, false); } $strPageTitle = "QCubed Development Framework - Code Generator"; require __CONFIGURATION__ . '/header.inc.php'; ?> <h1>Code Generator</h1> <div class="headerLine"><span><strong>PHP Version:</strong> <?php _p(PHP_VERSION); ?> ; <strong>Zend Engine Version:</strong> <?php
$objParameters = new QCliParameterProcessor('codegen', 'Qcodo Code Generator v' . QCODO_VERSION); // Optional Parameters for Path to Codegen Settings $strDefaultPath = __DEVTOOLS_CLI__ . '/settings/codegen.xml'; // Small cleanup on the text $strDefaultPath = str_replace('/html/../', '/', $strDefaultPath); $strDefaultPath = str_replace('/docroot/../', '/', $strDefaultPath); $strDefaultPath = str_replace('/wwwroot/../', '/', $strDefaultPath); $strDefaultPath = str_replace('/www/../', '/', $strDefaultPath); $objParameters->AddNamedParameter('s', 'settings-path', QCliParameterType::Path, $strDefaultPath, 'path to the Codegen Settings XML file; defaults to ' . $strDefaultPath); $objParameters->Run(); // Pull the Parameter Values $strSettingsXmlPath = $objParameters->GetValue('s'); try { ///////////////////// // Run Code Gen QCodeGen::Run($strSettingsXmlPath); ///////////////////// if ($strErrors = QCodeGen::$RootErrors) { printf("The following ROOT ERRORS were reported:\r\n%s\r\n\r\n", $strErrors); } else { printf("CodeGen settings (as evaluted from %s):\r\n%s\r\n\r\n", $_SERVER['argv'][1], QCodeGen::GetSettingsXml()); } foreach (QCodeGen::$CodeGenArray as $objCodeGen) { printf("%s\r\n---------------------------------------------------------------------\r\n", $objCodeGen->GetTitle()); printf("%s\r\n", $objCodeGen->GetReportLabel()); printf("%s\r\n", $objCodeGen->GenerateAll()); if ($strErrors = $objCodeGen->Errors) { printf("The following errors were reported:\r\n%s\r\n", $strErrors); } print "\r\n"; }
<?php // Include prepend.inc to load Qcodo require '../includes/prepend.inc.php'; /* if you DO NOT have "includes/" in your include_path */ // require('prepend.inc.php'); /* if you DO have "includes/" in your include_path */ // Load in the QCodeGen Class require __QCODO__ . '/codegen/QCodeGen.class.php'; // Security check for ALLOW_REMOTE_ADMIN // To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below QApplication::CheckRemoteAdmin(); ///////////////////////////////////////////////////// // Run CodeGen, using the ./codegen_settings.xml file ///////////////////////////////////////////////////// QCodeGen::Run(dirname(__FILE__) . '/codegen_settings.xml'); function DisplayMonospacedText($strText) { $strText = QApplication::HtmlEntities($strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace(' ', ' ', $strText); $strText = str_replace("\r", '', $strText); $strText = str_replace("\n", '<br/>', $strText); _p($strText, false); } ////////////////// // Output the Page ////////////////// ?> <html> <head> <title>Qcodo Development Framework - Code Generator</title>
/** * Dialog button has been clicked. Save the options, or Save, codegen, and then reload. * * @param $strFormId * @param $strControlId * @param $mixParam */ public function ButtonClick($strFormId, $strControlId, $mixParam) { if ($mixParam == 'save') { $this->UpdateControlInfo(); $this->WriteParams(); } elseif ($mixParam == 'saveRefresh') { $this->UpdateControlInfo(); $this->WriteParams(); QCodeGen::Run(__CONFIGURATION__ . '/codegen_settings.xml'); foreach (QCodeGen::$CodeGenArray as $objCodeGen) { $objCodeGen->GenerateAll(); // silently codegen } QApplication::Redirect($_SERVER['PHP_SELF']); } $this->Close(); }