$fk_reftable = $fieldisFK[$j][0]; $fk_refcolumn = $fieldisFK[$j][1]; //for FOREIGN KEYS $foreignkey_sql_COL .= ", {$fk_reftable}.{$fk_refcolumn}"; $foreignkey_sql_TBL .= ", {$fk_reftable}"; $foreignkey_sql_WHERE .= " AND " . $fk_reftable . ".id = " . $objectname . "." . $fieldname[$j]; } } //WRITE TO PHP MODELS $modelclass_content = preg_replace('/PATcreatepairingPAT/', $modelcreatepairing, $modelclass_content); $modelclass_content = preg_replace('/PATupdatepairingPAT/', $modelupdatepairing, $modelclass_content); $modelclass_content = preg_replace('/PATforeignkeysqlPAT_COL/', $foreignkey_sql_COL, $modelclass_content); $modelclass_content = preg_replace('/PATforeignkeysqlPAT_TBL/', $foreignkey_sql_TBL, $modelclass_content); $modelclass_content = preg_replace('/PATforeignkeysqlPAT_WHERE/', $foreignkey_sql_WHERE, $modelclass_content); // $fo->CreateFile($modelclass_content, "Model" . ucfirst($objectname) . ".php", $slimmodel_dir); ############################# # SLIM APP CONTENT CREATION ############################# $appmodel_inclusion .= "require 'model/Model" . ucfirst($objectname) . ".php';" . "\r"; $slimrouter_file = $fo->OpenFile('../template/', 'slim_router_codes.php.tmpl', 'r'); $slimrouter_content = $fo->FileContent($slimrouter_file); $slimrouter_content = preg_replace('/PATtablenamePAT/', $objectname, $slimrouter_content); $slimrouter_content = preg_replace('/PATclassnamePAT/', ucfirst($objectname), $slimrouter_content); $slimrouter_content = preg_replace('/PATitemnamePAT/', $itemname, $slimrouter_content); // COMBINE ALL ROUTERS IN ONE STRING $SLIMROUTERS .= $slimrouter_content; ############################# # EMPTY EACH VARIABLES ############################# unset($objectname);
$js_controller_content = preg_replace('/PATjsforDateInitPAT/', $js_forDateInit, $js_controller_content); $js_controller_content = preg_replace('/PATjsforDateTodayPAT/', $js_forDateToday, $js_controller_content); $js_controller_content = preg_replace('/PATjsforDateCodePAT/', $js_forDateCode, $js_controller_content); // $js_controller_content = preg_replace('/PATinjectmodulePAT/', $inject_module, $js_controller_content); $js_controller_content = preg_replace('/PATinjectclassPAT/', $inject_class, $js_controller_content); $js_controller_content = preg_replace('/PATinjectobjectPAT/', $inject_object, $js_controller_content); //2 $html_list_content = preg_replace('/PATitemdetailPAT/', $html_list_detail, $html_list_content); //3 $html_ins_content = preg_replace('/PATinputcomponentsPAT/', $html_ins_inputcomponents, $html_ins_content); //4 $html_upd_content = preg_replace('/PATeditcomponentsPAT/', $html_upd_inputcomponents, $html_upd_content); // - - - - - - //1 $fo->CreateFile($js_controller_content, $objectname . ".js", $jscontrol_dir); $fo->CreateFile($js_service_content, $objectname . ".js", $jsservice_dir); //2 $fo->CreateFile($html_ins_content, "entry.html", $htmlview_dir . $objectname . "/"); //3 $fo->CreateFile($html_list_content, "list.html", $htmlview_dir . $objectname . "/"); //4 $fo->CreateFile($html_upd_content, "edit.html", $htmlview_dir . $objectname . "/"); // - - - - - - // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ############################# # EMPTY EACH VARIABLES ############################# unset($objectname); unset($itemname);