public function toScaffStep6($datForm, $rewrite = false) { if ($this->MYFORM_validate($datForm, array('modnom'))) { $_SESSION['temp_scaff_info']['modnom'] = $datForm['modnom']; $_SESSION['temp_scaff_info']['moddesc'] = $datForm['moddesc']; $_SESSION['temp_scaff_info']['namefolder'] = $datForm['namefolder']; $folder = dirname(dirname(__FILE__)) . DS . $datForm['namefolder'] . DS; $errorRewrite = false; if ($rewrite == true) { $d = dir($folder); while (false !== ($entry = $d->read())) { if ($entry != '..' && $entry != '.') { if (!unlink($folder . $entry)) { $errorRewrite = true; break; } } } $d->close(); if (!rmdir($folder)) { $errorRewrite = true; } } if (!$errorRewrite) { if (!file_exists($folder)) { if (@mkdir($folder, 0644)) { $writeError = false; $fillScaffold = new fillScaffold(); $contIndex = scaffold::scaffReadTemplate(TPL_PATH . 'scaffold' . DS . 'index.tpl', array('{scaff_mod_name}' => $_SESSION['temp_scaff_info']['modnom'], '{scaff_mod_desc}' => $_SESSION['temp_scaff_info']['moddesc'], '{name_table_scaff}' => $_SESSION['temp_scaff_info']['table_name'])); $link = @fopen($folder . 'index.php', 'w'); if ($link) { fwrite($link, $contIndex); fclose($link); } else { $writeError = true; } $contHandler = scaffold::scaffReadTemplate(TPL_PATH . 'scaffold' . DS . 'handlerEvent.tpl', array('{name_table_scaff}' => $_SESSION['temp_scaff_info']['table_name'], '{fields_required_list_array}' => $fillScaffold->getFillAreaContent('fields_required_list_array'), '{fields_assign_to_save}' => $fillScaffold->getFillAreaContent('fields_assign_to_save'), '{height_window_form}' => $fillScaffold->getFillAreaContent('height_window_form'))); $link = fopen($folder . 'handlerEvent.php', 'w'); if ($link) { fwrite($link, $contHandler); fclose($link); } else { $writeError = true; } $contDataModel = scaffold::scaffReadTemplate(TPL_PATH . 'scaffold' . DS . 'dataModel.tpl', array('{name_table_scaff}' => $_SESSION['temp_scaff_info']['table_name'], '{fields_table_scaff}' => $fillScaffold->getFillAreaContent('fields_table_scaff'), '{form_reg_list_fields}' => $fillScaffold->getFillAreaContent('form_reg_list_fields'), '{sql_list_scaff}' => $fillScaffold->getFillAreaContent('sql_list_scaff'), '{getqueryform}' => $fillScaffold->getFillAreaContent('getqueryform'), '{real_names_in_query}' => $fillScaffold->getFillAreaContent('real_names_in_query'), '{setexportdata}' => $fillScaffold->getFillAreaContent('setexportdata'), '{setpagination}' => $fillScaffold->getFillAreaContent('setpagination'), '{setuseordermethod}' => $fillScaffold->getFillAreaContent('setuseordermethod'), '{eliminar}' => $fillScaffold->getFillAreaContent('eliminar'), '{editar}' => $fillScaffold->getFillAreaContent('editar'), '{eliminar_mul}' => $fillScaffold->getFillAreaContent('eliminar_mul'), '{width_list}' => $fillScaffold->getFillAreaContent('width_list'), '{width_fields}' => $fillScaffold->getFillAreaContent('width_fields'), '{another_tables}' => $fillScaffold->getFillAreaContent('another_tables'), '{another_tables_are_defined}' => $fillScaffold->getFillAreaContent('another_tables_are_defined'))); $link = fopen($folder . 'dataModel.php', 'w'); if ($link) { fwrite($link, $contDataModel); fclose($link); } else { $writeError = true; } if (!$writeError) { $this->closeModalWindow(2); $this->messageBox(OPF_myLang::getPhrase('OPF_SCAFF_45') . ' <b>essentials' . DS . $datForm['namefolder'] . DS . '</b> ', 'INFO'); } else { $this->messageBox(OPF_myLang::getPhrase('OPF_SCAFF_44') . ' "' . $folder . '"', 'error'); unset($_SESSION['temp_scaff_info']); } } else { $this->messageBox(OPF_myLang::getPhrase('OPF_SCAFF_6') . ' "' . $folder . '"', 'error'); } } else { $this->messageBox(OPF_myLang::getPhrase('OPF_SCAFF_7_A') . ' <b>' . 'essentials' . DS . $datForm['namefolder'] . DS . '</b> ' . OPF_myLang::getPhrase('OPF_SCAFF_7_B') . ' ' . OPF_myLang::getPhrase('OPF_SCAFF_7_C'), 'help', array(OPF_myLang::getPhrase('YES') => 'toScaffStep6', OPF_myLang::getPhrase('NO')), $datForm, true); } } else { $this->messageBox(OPF_myLang::getPhrase('OPF_SCAFF_8_A') . ' <b>' . $folder . '</b> ' . OPF_myLang::getPhrase('OPF_SCAFF_8_B'), 'error'); } } else { $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMPOS_REQUERIDOS'), 5, 'error'); } return $this->response; }