public function index($args = NULL)
 {
     $args['datos'] = modelClass::getAll();
     if (is_array($args['datos'])) {
         viewClass::renderHTML('index.php', $args);
     } else {
         viewClass::renderHTML('error.php', $args);
     }
 }
 public function index($args = NULL)
 {
     //funcion que va a hacer el index
     $args['datos'] = modelClass::getAll();
     if (is_array($args['datos'])) {
         // pregunta si es un arreglo o comprueba si es un arreglo
         viewClass::renderHTML('index.php', $args);
         // se va a la clase view y me muestra el render HTML index.php
     } else {
         viewClass::renderHTML('error.php', $args);
         //se va a la clase view y muestr ale render html error.php
     }
 }
 public function delete()
 {
     $args['formAction'] = 'index.php?action=delete&id=' . $_GET['id'];
     if ($_SERVER['REQUEST_METHOD'] === 'GET' and isset($_GET['id']) and is_numeric($_GET['id'])) {
         viewClass::renderHTML('delete.php', $args);
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['confirmation']) and $_POST['confirmation'] === 'true') {
             $rsp = modelClass::deleteMatricula($_GET['id']);
             if ($rsp === true) {
                 $args['success'] = 'El registro ' . $_GET['id'] . ' fue eliminado exitosamente';
             } else {
                 //$args['error'] = 'NO SE PUDO BORRAR PORQUE EL REGISTRO ESTA SIENDO USADO';
                 $this->index($args);
                 viewClass::renderHTML('error.php', $args);
             }
             $this->index($args);
         }
     }
 }
 public function delete()
 {
     $args['formAction'] = 'index.php?action=delete&id=' . $_GET['id'];
     if ($_SERVER['REQUEST_METHOD'] === 'GET' and isset($_GET['id']) and is_numeric($_GET['id'])) {
         viewClass::renderHTML('delete.php', $args);
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['confirmation']) and $_POST['confirmation'] === 'true') {
             $rsp = modelClass::delMatricula($_GET['id']);
             if ($rsp === true) {
                 $args['success'] = 'The Record: <strong> ' . $_GET['id'] . '</strong> Was Succesfully DELETED!. ';
             } else {
                 $args['error'] = $rsp;
                 viewClass::renderHTML('error.php', $args);
             }
             $this->index($args);
         }
     }
 }
 public function delete()
 {
     $args['formAction'] = 'index.php?action=delete&amp;id_apre=' . $_GET['id_apre'];
     if ($_SERVER['REQUEST_METHOD'] === 'GET' and isset($_GET['id_apre']) and is_numeric($_GET['id_apre'])) {
         viewClass::renderHTML('delete.php', $args);
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['confirmation']) and $_POST['confirmation'] === 'true') {
             $rsp = modelClass::deletematricula($_GET['id_apre']);
             if ($rsp === true) {
                 $args['success'] = 'El registro ' . $_GET['id_apre'] . ' fue eliminado exitosamente';
                 $this->index($args);
             } else {
                 $args['error'] = $rsp;
                 viewClass::renderHTML('error.php', $args);
             }
         }
     }
 }
 public function delete()
 {
     $args['formAction'] = 'index.php?action=delete&amp;id=' . $_GET['id'];
     if ($_SERVER['REQUEST_METHOD'] === 'GET' and isset($_GET['id']) and is_numeric($_GET['id'])) {
         viewClass::renderHTML('delete.php', $args);
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['confirmation']) and $_POST['confirmation'] === 'true') {
             $rsp = modelClass::deleteCiudad($_GET['id']);
             if ($rsp === true) {
                 $args['success'] = 'El Registro ' . $_GET['id'] . ' Fue ELIMINADO Exitosamente. ';
             } else {
                 $args['error'] = $rsp;
                 viewClass::renderHTML('error.php', $args);
             }
             $this->index($args);
         }
     }
 }
 public function create()
 {
     $args['depto'] = modelClass::getDepto();
     $template = 'create.php';
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $rsp = modelClass::newCity($_POST['codCity'], $_POST['nameCity'], $_POST['txtDepto'], $_POST['txtHabi']);
         if ($rsp === true) {
             $args['success'] = 'El registro fue realizado exitosamente';
             $this->index($args);
         } else {
             $args['error'] = $rsp->getMessage();
             $args['formAction'] = 'index.php=create';
             $args = array_merge($args, $_POST);
             viewClass::renderHTML($template, $args);
         }
     } else {
         $args['formAction'] = 'index.php?action=create';
         viewClass::renderHTML($template, $args);
     }
 }
 public function create()
 {
     $args['ciudad'] = modelClass::showCity();
     $args['ti'] = modelClass::showTypeId();
     $args['rh'] = modelClass::getRh();
     $template = 'create.php';
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $rsp = modelClass::NewApre($_POST['txtId'], $_POST['txtName'], $_POST['txtLastName'], $_POST['txtPhone'], $_POST['txtCity'], $_POST['txtRh'], $_POST['txtTypeId'], $_POST['txtGender'], $_POST['txtAge']);
         if ($rsp === true) {
             $args['success'] = 'El registro fue realizado exitosamente';
             $this->index($args);
         } else {
             $args['error'] = $rsp->getMessage();
             $args['formAction'] = 'index.php=create';
             $args = array_merge($args, $_POST);
             viewClass::renderHTML($template, $args);
         }
     } else {
         $args['formAction'] = 'index.php?action=create';
         viewClass::renderHTML($template, $args);
     }
 }
 public function create()
 {
     $args['Localidad'] = modelClass::getLocalidad();
     $args['idUser'] = modelClass::getIdUSuario();
     $template = 'create.php';
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $rsp = modelClass::NewDatoUser($_POST['txtId'], $_POST['txtIdUser'], $_POST['txtName'], $_POST['txtLastName'], $_POST['txtDir'], $_POST['txtTel'], $_POST['txtLocalidad']);
         if ($rsp === true) {
             $args['success'] = 'El registro fue realizado exitosamente';
             $this->index($args);
         } else {
             $args['error'] = $rsp->getMessage();
             $args['formAction'] = 'index.php=create';
             $args = array_merge($args, $_POST);
             viewClass::renderHTML($template, $args);
         }
     } else {
         $args['formAction'] = 'index.php?action=create';
         viewClass::renderHTML($template, $args);
     }
 }