Example #1
0
     }
 }
 if (file_exists("templates/js/" . $_POST['tabla'] . ".js")) {
     unlink("templates/js/" . $_POST['tabla'] . ".js");
 }
 $fp = fopen("templates/js/" . $_POST['tabla'] . ".js", "w");
 fwrite($fp, $jquery);
 fclose($fp);
 //Creacion de controlador basico
 $rstIndex = $database->showIndex($_POST['tabla']);
 $Controller = new Controller();
 $control = $Controller->open_php($_POST['tabla']);
 $control .= $Controller->valPost();
 $control .= $Controller->saveController($_POST['tabla'], $rstIndex[0]);
 $control .= $Controller->listarController($_POST['campoName'], $_POST['mostrarData'], $_POST['tabla']);
 $control .= $Controller->deleteController($_POST['tabla']);
 $control .= $Controller->editController($_POST['tabla']);
 $control .= $Controller->elsePost();
 $control .= $Controller->renderTemplate($_POST['tabla']);
 $control .= $Controller->endPost();
 $control .= $Controller->close_php();
 if (!file_exists("templates/controller/")) {
     if (!mkdir("templates/controller/", 0777, true)) {
         die('Fallo al crear las carpetas...');
     }
 }
 if (file_exists("templates/controller/" . $_POST['tabla'] . "Controller.php")) {
     unlink("templates/controller/" . $_POST['tabla'] . "Controller.php");
 }
 $fp = fopen("templates/controller/" . $_POST['tabla'] . "Controller.php", "x");
 fwrite($fp, $control);