diff --git a/Eje8Nr.php b/Eje8Nr.php
new file mode 100644
index 0000000..a863e4d
--- /dev/null
+++ b/Eje8Nr.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+ Trabajar con Productos
+
+
+ Productos
+ Nuevo Producto
+
+
+ Código
+ Producto
+ CB
+ Inventario
+ Estado
+ CategorÃa
+ Update
+ Delete
+
+ ".$producto["prdid"]." ";
+ echo "".$producto["prddsc"]." ";
+ echo "".$producto["prdbrc"]." ";
+ echo "".$producto["prdctd"]." ";
+ echo "".$producto["prdest"]." ";
+ echo "".$producto["ctgid"]." ";
+ echo ' -> ';
+ echo ' x ';
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/Eje9Nr.php b/Eje9Nr.php
new file mode 100644
index 0000000..ba700d1
--- /dev/null
+++ b/Eje9Nr.php
@@ -0,0 +1,166 @@
+ 0,
+ "prddsc" =>"",
+ "prdbrc" =>"",
+ "prdctd" =>0,
+ "prdest" =>"ACT",
+ "ctgid " =>0
+ );
+ $categorias = array();
+ $categorias = obtenerRegistros("select * from categorias where ctgest='ACT';");
+ $mode = "noset";
+ $modeDescription = array(
+ "insert" => "Nuevo Producto",
+ "update" => "Actualizar Producto",
+ "delete" => "Borrar Producto"
+ );
+ if(isset($_GET["action"])){
+ switch($_GET["action"]){
+ case "new":
+ $mode= "insert";
+ if(isset($_POST["btnInsert"])){
+ $sqlinsert = "INSERT INTO `productos` (`prddsc`,`prdbrc`,`prdctd`,`prdest`,`ctgid`) VALUES ('%s','%s',%d,'%s', %d);";
+ $sqlinsert = sprintf($sqlinsert,
+ $_POST["prddsc"],
+ $_POST["prdbrc"],
+ intval($_POST["prdctd"]),
+ $_POST["prdest"],
+ intval($_POST["ctgid"])
+ );
+ insertRegistro($sqlinsert);
+ redirectWithMessage('Registro guardado con exito!', 'Eje8Nr.php');
+ }
+ break;
+ case "upd":
+ if(isset($_POST["btnInsert"])){
+ if(isset($_POST["prdid"])){
+ $strupdate = "UPDATE `productos` SET `prddsc` = '%s', `prdbrc` = '%s', `prdctd` =%d, `prdest` = '%s', `ctgid` = %d WHERE `prdid` = %d;";
+ $strupdate = sprintf($strupdate,
+ $_POST["prddsc"],
+ $_POST["prdbrc"],
+ intval($_POST["prdctd"]),
+ $_POST["prdest"],
+ intval($_POST["ctgid"]),
+ intval($_POST["prdid"])
+ );
+ updateRegistro($strupdate);
+ redirectWithMessage('Producto Actualizado!', 'Eje9Nr.php?action=upd&prdid='.$_POST["prdid"]);
+ }
+ }
+ $mode= "update";
+ $strsql = "select * from productos where prdid = %d;";
+ $strsql = sprintf($strsql,$_GET["prdid"]);
+ $producto = obtenerUnRegistro($strsql);
+ if($producto){
+ $modeDescription[$mode] .= " " . $_GET["prdid"] . " " . $producto["prddsc"];
+ }else{
+ redirectWithMessage('EL producto no existe!', 'Eje8Nr.php');
+ }
+ break;
+ case "del":
+ if(isset($_POST["btnInsert"])){
+ if(isset($_POST["prdid"])){
+ $strDelete = "DELETE `productos` WHERE `prdid` = %d;";
+ $strDelete = sprintf($strDelete,
+ $_POST["prddsc"],
+ $_POST["prdbrc"],
+ intval($_POST["prdctd"]),
+ $_POST["prdest"],
+ intval($_POST["ctgid"]),
+ intval($_POST["prdid"])
+ );
+ updateRegistro($strDelete);
+ redirectWithMessage('Producto Eliminado!', 'Eje9Nr.php?action=del&prdid='.$_POST["prdid"]);
+ }
+ }
+ $mode= "delete";
+ $strsql = "select * from productos where prdid = %d;";
+ $strsql = sprintf($strsql,$_GET["prdid"]);
+ $producto = obtenerUnRegistro($strsql);
+ if($producto){
+ $modeDescription[$mode] .= " " . $_GET["prdid"] . " " . $producto["prddsc"];
+ }else{
+ redirectWithMessage('EL producto no existe!', 'Eje8Nr.php');
+ }
+ break;
+ default:
+ //truquito muy util.
+ redirectWithMessage('No Tiene Acceso a Esta página, redirigiendo.', 'Eje8Nr.php');
+ }
+ }else{
+ // ESTO ES ULTRA IMPORTANTE
+ // PARA REDIRIGIR A OTRA PAGINA
+ // DESDE PHP
+ header("location:Eje8Nr.php");
+ die();
+ }
+?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ejercicio4.php b/Ejercicio4.php
new file mode 100644
index 0000000..7f6f2e0
--- /dev/null
+++ b/Ejercicio4.php
@@ -0,0 +1,65 @@
+ 0 ){
+ arsort($arregloFrecuencias);
+ foreach($arregloFrecuencias as $palabrak=>$freq){
+ $result = "La palabra << $palabrak >> con mayor frecuencia de : $freq";
+ break;
+ }
+ }else{
+ $result="No hay palabras que analizar";
+ }
+ //associative reverse sort
+ //asort();
+ //associative sort
+ //para depuracion
+ //print_r($arregloFrecuencias);
+ //die();
+ }
+?>
+
+
+
+ Ejemplo de Uso de Arreglos Xtreme
+
+
+
+ Stats de Blogs
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Mantenimiento1Nr.php b/Mantenimiento1Nr.php
new file mode 100644
index 0000000..bebec45
--- /dev/null
+++ b/Mantenimiento1Nr.php
@@ -0,0 +1,85 @@
+errno){
+ die("DB no can: " . $conn->error);
+ }
+
+ if(isset($_POST["btnIns"])){
+ $registro = array();
+ $registro["ctgid"] = 0;
+ $registro["ctgdsc"] = $_POST["txtDsc"];
+ $registro["ctgest"] = $_POST["txtGest"];
+
+
+ //Preparar el Insert Statement
+ $sqlstr = "INSERT INTO `nw201501`.`categorias`(`ctgdsc`,`ctgest`)";
+ $sqlstr .= "VALUES ('" . $registro["ctgdsc"] . "', '". $registro["ctgest"] ."');";
+
+ //Ejecutar el Insert Statement
+ $result = $conn->query($sqlstr);
+
+ //Obtener el último codigo generado
+ $lasInsertID= $conn->insert_id;
+
+ //Obtener los registros de la tabla
+ $sqlQuery = "Select * from categorias;";
+ $resulCursor = $conn->query($sqlQuery);
+ //fetch: agarrar de ese cursor la posiciona actual del registro
+ //y assoc el valor del registro asociativo
+ while($registro = $resulCursor->fetch_assoc()){
+ $registros[] = $registro;
+ }
+
+ }
+
+
+
+?>
+
+
+
+
+ Mantenimiento de la tabla CategorÃas
+
+
+ CategorÃas
+
+
+ Descripción
+
+
+
+ Gestión
+
+
+
+
+
+
+
+
+
Datos
+
+
+
+ Codigo
+ Descripción
+ Gestión
+
+ 0){
+ foreach($registros as $registro){
+ echo "".$registro["ctgid"]." ";
+ echo "".$registro["ctgdsc"]." ";
+ echo "".$registro["ctgest"]." ";
+
+ }
+ }
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/ado3.php b/ado3.php
new file mode 100644
index 0000000..abfda51
--- /dev/null
+++ b/ado3.php
@@ -0,0 +1,55 @@
+errno){
+ die($conn->error);
+ }
+ function obtenerRegistros($strsql){
+ GLOBAL $conn;
+ $registros = array();
+ if($strsql != ""){
+ $cursor = $conn->query($strsql);
+ while($registro = $cursor->fetch_assoc()){
+ $registros[] = $registro;
+ }
+ }
+ return $registros;
+ }
+ function obtenerUnRegistro($strsql){
+ GLOBAL $conn;
+ if($strsql != ""){
+ $cursor = $conn->query($strsql);
+ while($registro = $cursor->fetch_assoc()){
+ return $registro;
+ }
+ }
+ return false;
+ }
+ function insertRegistro($strsql){
+ GLOBAL $conn;
+ if($strsql != ""){
+ $result = $conn->query($strsql);
+ if(!$result) return 0;
+ return $conn->insert_id;
+ }
+ return 0;
+ }
+ function updateRegistro($strsql){
+ GLOBAL $conn;
+ if($strsql != ""){
+ $result = $conn->query($strsql);
+ if(!$result) return 0;
+ return true;
+ }
+ return false;
+ }
+
+ function deleteRegistro($strsql) {
+ GLOBAL $conn;
+ if($strsql != ""){
+ $result = $conn->query($strsql);
+ if(!$result) return 0;
+ return true;
+ }
+ return false;
+}
+ ?>
\ No newline at end of file
diff --git a/controllers/error.control.php b/controllers/error.control.php
new file mode 100644
index 0000000..e858095
--- /dev/null
+++ b/controllers/error.control.php
@@ -0,0 +1,23 @@
+"Error 404",
+ "errors"=>array(
+ array("error_msg"=>"Link 1"),
+ array("error_msg"=>"Link 2"),
+ array("error_msg"=>"Link 3"),
+ ),
+ "showErrors" => true
+ )
+ );
+ }
+
+
+ run();
+?>
\ No newline at end of file
diff --git a/controllers/home.control.php b/controllers/home.control.php
new file mode 100644
index 0000000..9d12374
--- /dev/null
+++ b/controllers/home.control.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/controllers/login.control.php b/controllers/login.control.php
new file mode 100644
index 0000000..59c766c
--- /dev/null
+++ b/controllers/login.control.php
@@ -0,0 +1,57 @@
+"Credenciales Incorrectas");
+ }
+ }else{
+ $errores[] = array("errmsg"=>"Credenciales Incorrectas");
+ }
+ }
+
+ if(isset($_GET["returnUrl"])){
+ $returnUrl = urldecode($_GET["returnUrl"]);
+ }
+ //si llega aqui algo sucedio asi que hay que rendizar nuevamente el login
+ $datos = array("txtUser" => $userName,
+ "returnUrl" => $returnUrl,
+ "mostrarErrores" => (count($errores)>0),
+ "errores" => $errores);
+
+ renderizar("login", $datos);
+
+ }
+
+ run();
+?>
\ No newline at end of file
diff --git a/controllers/menu.control.php b/controllers/menu.control.php
new file mode 100644
index 0000000..95f149d
--- /dev/null
+++ b/controllers/menu.control.php
@@ -0,0 +1,43 @@
+"Combo 1 - Cuarto de Libra",
+ "prc_combo"=> 150.00,
+ "enOferta" => true,
+ "extras"=> array(
+ array("comp"=>"Cuarto de Carne"),
+ array("comp"=>"Papas Medianas"),
+ array("comp"=>"Refresco de 16oz"),
+ array("comp"=>"Porción de Postre del dÃa")
+ )
+ );
+ $datos_para_vista["arr_menues"][] = array(
+ "nom_combo"=>"Combo 2 - Toropolada",
+ "prc_combo"=> 250.00,
+ "enOferta" => false,
+ "extras"=> array(
+ array("comp"=>"Libra y Media de Res"),
+ array("comp"=>"Papas Extra Grande"),
+ array("comp"=>"Refresco de 24oz"),
+ array("comp"=>"Postre Completo")
+ )
+ );
+
+
+ renderizar("menu", $datos_para_vista);
+ }
+
+ run();
+?>
\ No newline at end of file
diff --git a/controllers/productos.control.php b/controllers/productos.control.php
new file mode 100644
index 0000000..67481a0
--- /dev/null
+++ b/controllers/productos.control.php
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/controllers/registro.control.php b/controllers/registro.control.php
new file mode 100644
index 0000000..e438398
--- /dev/null
+++ b/controllers/registro.control.php
@@ -0,0 +1,65 @@
+"Correo Electrónico ya Usado!");
+ }else{
+ // geenrar la contraseña salada (salting)
+ $fchingreso = time(); //date("YmdHisu"); //20141104203730069785
+
+ $pswdSalted = "";
+ if($fchingreso % 2 == 0){
+ $pswdSalted = $pswd . $fchingreso;
+ }else{
+ $pswdSalted = $fchingreso . $pswd;
+ }
+
+ $pswdSalted = md5($pswdSalted);
+
+ insertUsuario( $htmlData["txtUserName"],
+ $htmlData["txtEmail"],
+ $fchingreso, $pswdSalted);
+
+ // ingresar
+ /*
+
+ */
+ }
+
+
+ }else{
+ $htmlData["mostrarErrores"] = true;
+ $htmlData["errores"][]=array("errmsg"=>"Contraseñas no coinciden");
+ }
+ }
+
+ renderizar("registro",$htmlData);
+ }
+
+
+ run();
+?>
\ No newline at end of file
diff --git a/controllers/reservacion.control.php b/controllers/reservacion.control.php
new file mode 100644
index 0000000..69bddde
--- /dev/null
+++ b/controllers/reservacion.control.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/controllers/site.mw.php b/controllers/site.mw.php
new file mode 100644
index 0000000..3d00117
--- /dev/null
+++ b/controllers/site.mw.php
@@ -0,0 +1,9 @@
+
diff --git a/controllers/verificar.mw.php b/controllers/verificar.mw.php
new file mode 100644
index 0000000..6209812
--- /dev/null
+++ b/controllers/verificar.mw.php
@@ -0,0 +1,28 @@
+
\ No newline at end of file
diff --git a/ejercicio1.php b/ejercicio1.php
new file mode 100644
index 0000000..cb5ae54
--- /dev/null
+++ b/ejercicio1.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+ Ejercicio 1 PHP
+
+
+ Ejercicio 1 PHP
+
+ Nombre
+
+
+
+
+
+
+
+
+
diff --git a/ejercicio3.php b/ejercicio3.php
new file mode 100644
index 0000000..96a2029
--- /dev/null
+++ b/ejercicio3.php
@@ -0,0 +1,66 @@
+ $contador){
+ if($informacion == $informa){
+ $contador ++;
+ $hasChanged = true;
+ $informaciones[$informacion] = $contador;
+ }
+ }
+ if(!$hasChanged){
+ $informaciones[$informa] = 1;
+ }
+ $_SESSION["informaciones"] = $informaciones;
+ }
+
+
+
+
+
+ if(isset($_POST["btnAgregar"])){
+ nuevaInformacion($_POST["txt1"]);
+
+
+ }
+?>
+
+
+
+
+ Tabla de Información
+
+
+ Ejercicio 3 de Examen
+
+ Nombre
+
+
+
+
+
+
+
+ Datos persistentes en la sesión
+
+ Nombre
+ $Contador){
+ echo "" . $informacion . " ";
+ }
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..69442a4
--- /dev/null
+++ b/index.php
@@ -0,0 +1,37 @@
+
diff --git a/libs/dao.php b/libs/dao.php
new file mode 100644
index 0000000..b336038
--- /dev/null
+++ b/libs/dao.php
@@ -0,0 +1,53 @@
+connect_errno){
+ //die();
+ die($conexion->connect_error);
+ }
+
+ function obtenerRegistros($sqlstr, &$conexion = null){
+ if(!$conexion) global $conexion;
+ $result = $conexion->query($sqlstr);
+ $resultArray = array();
+ foreach($result as $registro){
+ $resultArray[] = $registro;
+ }
+ return $resultArray;
+ }
+
+
+ function obtenerUnRegistro($sqlstr, &$conexion = null){
+ if(!$conexion) global $conexion;
+ $result = $conexion->query($sqlstr);
+ $resultArray = array();
+
+ $resultArray[] = $result->fetch_assoc();
+
+ return $resultArray;
+ }
+
+
+ function ejecutarNonQuery($sqlstr, &$conexion = null){
+ if(!$conexion) global $conexion;
+ $result = $conexion->query($sqlstr);
+ return $conexion->affected_rows;
+ }
+
+ function valstr($str){
+ if(!$conexion) global $conexion;
+ return $conexion->escape_string($str);
+ }
+
+ function getLastInserId(&$conexion = null){
+ global $conexion;
+ return $conexion->insert_id;
+ }
+?>
diff --git a/libs/parameters.php b/libs/parameters.php
new file mode 100644
index 0000000..272faf5
--- /dev/null
+++ b/libs/parameters.php
@@ -0,0 +1,7 @@
+
diff --git a/libs/template_engine.php b/libs/template_engine.php
new file mode 100644
index 0000000..790fa51
--- /dev/null
+++ b/libs/template_engine.php
@@ -0,0 +1,128 @@
+ '(\{\{foreach \w*\}\})',
+ 'endfor' => '(\{\{endfor \w*\}\})',
+ 'if' => '(\{\{if \w*\}\})',
+ 'if_close' => '(\{\{endif \w*\}\})');
+
+ $tag_regexp = "/" . join( "|", $regexp_array ) . "/";
+
+ //split the code with the tags regexp
+ $template_code = preg_split ( $tag_regexp, $htmlTemplate, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+
+ return $template_code;
+ }
+
+?>
diff --git a/libs/utilities.php b/libs/utilities.php
new file mode 100644
index 0000000..e22d923
--- /dev/null
+++ b/libs/utilities.php
@@ -0,0 +1,18 @@
+alert('$message'); window.location='$url';";
+ die();
+ }
+
+ function redirectToUrl($url){
+ header("Location: $url");
+ die();
+ }
+?>
diff --git a/models/productos.model.php b/models/productos.model.php
new file mode 100644
index 0000000..e14b601
--- /dev/null
+++ b/models/productos.model.php
@@ -0,0 +1,18 @@
+
\ No newline at end of file
diff --git a/models/usuarios.model.php b/models/usuarios.model.php
new file mode 100644
index 0000000..3d56f23
--- /dev/null
+++ b/models/usuarios.model.php
@@ -0,0 +1,32 @@
+
\ No newline at end of file
diff --git a/modificar.php b/modificar.php
new file mode 100644
index 0000000..bfd939a
--- /dev/null
+++ b/modificar.php
@@ -0,0 +1,119 @@
+errno){
+ die("DB no can: " . $conn->error);
+ }
+
+ if(isset($_POST["btnIns"])){
+ $registro = array();
+ $registro["ctgid"] = 0;
+ $registro["ctgdsc"] = $_POST["txtDsc"];
+ $registro["ctgest"] = $_POST["txtGest"];
+
+
+ //Preparar el Insert Statement
+ $sqlstr = "INSERT INTO `nw201501`.`categorias`(`ctgdsc`,`ctgest`)";
+ $sqlstr .= "VALUES ('" . $registro["ctgdsc"] . "', '". $registro["ctgest"] ."');";
+
+ //Ejecutar el Insert Statement
+ $result = $conn->query($sqlstr);
+
+ //Obtener el último codigo generado
+ $lasInsertID= $conn->insert_id;
+
+ }
+
+ while($registro = $resulCursor->fetch_assoc()){
+ $registros[] = $registro;
+ }
+
+ //Para modificar registros
+ $codigo="";
+ if(isset($_POST["btnMod"])){
+ $codigo = $_POST["txtid"];
+ $registrom = array();
+
+ $registrom["ctgdsc"] = $_POST["txtDsc"];
+ $registrom["ctgest"] = $_POST["txtGest"];
+
+
+
+ $sqlstr = "UPDATE `nw201501`.`categorias` SET `ctgdsc` = '" .$registrom["ctgdsc"]. "' ,`ctgest`= '" .$registrom["ctgest"]. "' where ctgid='" .$codigo."');";
+
+
+ $result = $conn->query($sqlstr);
+
+ $lasInsertID= $conn->insert_id;
+ }
+
+
+
+ //Obtener los registros de la tabla
+ $sqlQuery = "Select * from categorias;";
+ $resulCursor = $conn->query($sqlQuery);
+ //fetch: agarrar de ese cursor la posiciona actual del registro
+ //y assoc el valor del registro asociativo
+ while($registrom = $resulCursor->fetch_assoc()){
+ $registros[] = $registrom;
+ }
+
+?>
+
+
+
+
+ Mantenimiento de la tabla CategorÃas
+
+
+ CategorÃas
+
+ Código
+
+
+
+ Descripción
+
+
+
+ Gestión
+
+
+
+
+
+
+
+
+
Datos
+
+
+
+ Codigo
+ Descripción
+ Gestión
+
+ 0){
+ foreach($registros as $registro){
+ echo "".$registro["ctgid"]." ";
+ echo "".$registro["ctgdsc"]." ";
+ echo "".$registro["ctgest"]." ";
+
+ }
+ }
+ if(isset($_POST["btnMod"])){
+ foreach($registros as $registrom){
+ echo "".$registrom["ctgid"]." ";
+ echo "".$registrom["ctgdsc"]." ";
+ echo "".$registrom["ctgest"]." ";
+
+ }
+ }
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/public/css/smvc.css b/public/css/smvc.css
new file mode 100644
index 0000000..0ff4ce9
--- /dev/null
+++ b/public/css/smvc.css
@@ -0,0 +1,74 @@
+body{
+ color:#333;
+ font-family: Tahoma, Geneva, sans-serif;
+ font-size:16px;
+ font-size:1em;
+ padding:0.5em 1em;
+ margin:0em;
+}
+
+.menu{
+ list-style:none;
+ padding:0em;
+ margin:0em;
+}
+
+.menu li a{
+ margin:0em;
+ display:block;
+ padding:0.5em;
+ text-align:center;
+ text-decoration:none;
+ color:#888;
+}
+
+.menu li a:hover{
+ color:#222;
+}
+
+.postimage{
+ width:100%;
+ padding:0em;
+ margin:0em;
+ box-shadow: 0em 0em 0.25em #4c4c4c;
+
+}
+
+form{
+ background-color:#DDD;
+ padding:1em;
+}
+label{
+ display:block;
+ font-weight:500;
+}
+input{
+ border:solid #aaa 0.125em;
+ box-sizing:border-box;
+ width:100%;
+ line-height:2em;
+ padding:0.25em;
+ margin:0.5em 0em;
+ font-size:1em;
+}
+
+@media screen and (min-width:481px){
+ .menu{
+ text-align:right;
+ }
+ .menu li{
+ display:inline;
+ }
+ .menu li a{
+ padding:0.5em 1em;
+ display:inline-block;
+ min-width:5em;
+ }
+
+ .postimage{
+ display:block;
+ width:30em;
+ margin:1em auto !important;
+ }
+
+}
diff --git a/public/img/mvcDiagram.svg b/public/img/mvcDiagram.svg
new file mode 100644
index 0000000..9784682
--- /dev/null
+++ b/public/img/mvcDiagram.svg
@@ -0,0 +1,650 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ image/svg+xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tabla2.php b/tabla2.php
new file mode 100644
index 0000000..80d51e7
--- /dev/null
+++ b/tabla2.php
@@ -0,0 +1,96 @@
+errno){
+ die("DB no can: " . $conn->error);
+ }
+
+ if(isset($_POST["btnIns"])){
+ $registro = array();
+ $registro["codigo"] = 0;
+ $registro["descripcion"] = $_POST["txtDsc"];
+ $registro["lugar"] = $_POST["txtLgr"];
+ $registro["fecha"] = $_POST["txtFch"];
+ $registro["contacmail"] = $_POST["txtCrr"];
+ $registro["status"] = $_POST["txtSts"];
+
+ //Preparar el Insert Statement
+ $sqlstr = "INSERT INTO `nw201501`.`charlas` ( `descripcion`, `lugar`, `fecha`, `contacmail`, `status`)";
+ $sqlstr .= "VALUES ( '". $registro["descripcion"] ." ' , '" . $registro["lugar"] . "', '". $registro["fecha"] ."', '" . $registro["contacmail"] . "', '". $registro["status"] ."');";
+
+ //Ejecutar el Insert Statement
+ $result = $conn->query($sqlstr);
+
+ //Obtener el último codigo generado
+ $lasInsertID= $conn->insert_id;
+ }
+ //Obtener los registros de la tabla
+ $sqlQuery = "Select * from charlas;";
+ $resulCursor = $conn->query($sqlQuery);
+ //fetch: agarrar de ese cursor la posiciona actual del registro
+ //y assoc el valor del registro asociativo
+ while($registro = $resulCursor->fetch_assoc()){
+ $registros[] = $registro;
+ }
+
+?>
+
+
+
+
+ Primer Formulario con MySQL Backend
+
+
+ Charlas
+
+ Descripción
+
+
+ Lugar
+
+
+ Fecha
+
+
+ Correo de Contacto
+
+
+ Estado
+
+ Pendiente
+ Confirmado
+ Cancelado
+
+
+
+
+
+
Datos
+
+
+
+ Codigo
+ Descripción
+ Lugar
+ Fecha
+ Correo
+ Estado
+
+ 0){
+ foreach($registros as $registro){
+ echo "".$registro["codigo"]." ";
+ echo "".$registro["descripcion"]." ";
+ echo "".$registro["lugar"]." ";
+ echo "".$registro["fecha"]." ";
+ echo "".$registro["contacmail"]." ";
+ echo "".$registro["status"]." ";
+ }
+ }
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/test.html b/test.html
new file mode 100644
index 0000000..e69de29
diff --git a/test.php b/test.php
new file mode 100644
index 0000000..776284d
--- /dev/null
+++ b/test.php
@@ -0,0 +1,20 @@
+query($sqlstr);
+
+ $resultArray = array();
+ foreach($result as $registro){
+ $resultArray[] = $registro;
+ }
+ print_r($resultArray);
+ //return $resultArray;
+
+?>
\ No newline at end of file
diff --git a/utilities.php b/utilities.php
index 3ccf350..8f86317 100644
--- a/utilities.php
+++ b/utilities.php
@@ -4,5 +4,9 @@ function redirectWithMessage($msg, $redirectTo){
echo " window.location='$redirectTo'; ";
die();
}
+<<<<<<< HEAD
+?>
+=======
?>
+>>>>>>> 9a61c0c213b0194cd434ad35a9cb45ff1630af08
diff --git a/views/error.view.tpl b/views/error.view.tpl
new file mode 100644
index 0000000..5a2840f
--- /dev/null
+++ b/views/error.view.tpl
@@ -0,0 +1,9 @@
+Lo sentimos la página que usted ha
+solicitado no está disponible.
+{{if showErrors}}
+
+ {{foreach errors}}
+ {{error_msg}}
+ {{endfor errors}}
+
+{{endif showErrors}}
\ No newline at end of file
diff --git a/views/home.view.tpl b/views/home.view.tpl
new file mode 100644
index 0000000..7901345
--- /dev/null
+++ b/views/home.view.tpl
@@ -0,0 +1,34 @@
+Desarrollo de Negocios Web
+
+ Este es un simple ejemplo de como podemos utilizar php y los conceptos de un patrón MVC para estructurar un proyecto de negocio web usando un esquema funcional. El patrón "Modelo, Vista Controlador" es utilizando en muchos lenguages de programación por su forma lógica y versatil de organizar el código. Dentro de los beneficios que ofrece el implementarlo se encuentra:
+
+
+ Separación Lógica Módular del Código
+
+
+ Adecuado para trabajo en equipo y con sistemas de versionamiento (git)
+
+
+ Establecimiento de Responsabilidad de Código
+
+
+
+Componentes del MVC
+
+ En este ejemplo se encuentra los siguientes componentes:
+
+
+ index.php Contiene Toda la lógica de enrutamiento, solo por este punto de entrada es que el sistema completo atiende peticiones.
+
+
+ controllers/archivo.control.php Es el controlador llamado por el index.php para coordinar las acciones en el sistema.
+
+
+ models/archivo.model.php Cuando se requiere de acceso a datos, se utilizan estos archivos para encapsular todo acceso a la capa de datos. El controlador es quien se encarga de incluir los modelos necesarios para realizar una acción.
+
+
+ views/archivo.view.tpl Son las vistas o plantillas html con marcado especial que permite al controlador mediante un generador ligar los datos de un modelo con las vista que se muestra al usuario final.
+
+
+
+
diff --git a/views/layout.view.tpl b/views/layout.view.tpl
new file mode 100644
index 0000000..14d6560
--- /dev/null
+++ b/views/layout.view.tpl
@@ -0,0 +1,18 @@
+
+
+
+
+ {{page_title}}
+
+
+
+
+ {{page_title}}
+
+ {{{page_content}}}
+
+
diff --git a/views/login.view.tpl b/views/login.view.tpl
new file mode 100644
index 0000000..50f77e0
--- /dev/null
+++ b/views/login.view.tpl
@@ -0,0 +1,15 @@
+{{if mostrarErrores}}
+
+ {{foreach errores}}
+ {{errmsg}}
+ {{endfor errores}}
+
+{{endif mostrarErrores}}
+
+ Usuario
+
+ Contraseña
+
+
+
+
\ No newline at end of file
diff --git a/views/menu.view.tpl b/views/menu.view.tpl
new file mode 100644
index 0000000..24f6e99
--- /dev/null
+++ b/views/menu.view.tpl
@@ -0,0 +1,14 @@
+{{foreach arr_menues}}
+
+
{{nom_combo}}
+
L{{prc_combo}}
+
+ {{foreach extras}}
+ {{comp}}
+ {{endfor extras}}
+
+
+{{endfor arr_menues}}
\ No newline at end of file
diff --git a/views/productos.view.tpl b/views/productos.view.tpl
new file mode 100644
index 0000000..501b82d
--- /dev/null
+++ b/views/productos.view.tpl
@@ -0,0 +1,15 @@
+Productos
+
+
+ Código
+ Producto
+ Acciones
+
+ {{foreach productos}}
+
+ {{idproducto}}
+ {{nomproducto}}
+ W'll be back!
+
+ {{endfor productos}}
+
\ No newline at end of file
diff --git a/views/registro.view.tpl b/views/registro.view.tpl
new file mode 100644
index 0000000..90bedac
--- /dev/null
+++ b/views/registro.view.tpl
@@ -0,0 +1,18 @@
+{{if mostrarErrores}}
+
+ {{foreach errores}}
+ {{errmsg}}
+ {{endfor errores}}
+
+{{endif mostrarErrores}}
+
+ Nombre Completo
+
+ Correo Electrónico
+
+ Contraseña
+
+ Confirme Contraseña
+
+
+
\ No newline at end of file
diff --git a/views/reservacion.view.tpl b/views/reservacion.view.tpl
new file mode 100644
index 0000000..9062076
--- /dev/null
+++ b/views/reservacion.view.tpl
@@ -0,0 +1,17 @@
+Reservaciones de Mesas
+{{if showErrors}}
+
+ {{foreach errors}}
+ {{error_msg}}
+ {{endfor errors}}
+
+{{endif showErrors}}
+
+ Nombre Completo
+
+
+
+
\ No newline at end of file