Пример #1
0
 public function getAll($where = "", $order = "")
 {
     $obj = new CategoriaModel();
     return $obj->getAll($where, $order);
 }
Пример #2
0
 public function crear()
 {
     HelperFunctions::comprobarSesion();
     if (!$_POST) {
         // Sino hay post mostramos el formulario
         $provincias = ProvinciaModel::getAll();
         $categorias = CategoriaModel::getAll();
         $filenames = ["generic/formpersona", "usuario/formulario"];
         $datos = array('destino' => 'usuario/crear', 'submit' => 'Crear', 'provincialist' => $provincias, 'categorialist' => $categorias);
         View::renderMulti($filenames, $datos);
     } else {
         $_POST = HelperFunctions::sanear($_POST);
         $provincias = ProvinciaModel::getAll();
         $categorias = CategoriaModel::getAll();
         $errores = [];
         $err = UsuarioModel::insert();
         if ($err === true) {
             header("Location: " . URL . "usuario");
         } elseif ($err !== true && is_array($err)) {
             $errores = $err;
             $filenames = ["generic/formpersona", "usuario/formulario"];
             $datos = array('destino' => 'usuario/crear', 'submit' => 'Crear', 'provincialist' => $provincias, 'categorialist' => $categorias, 'persona' => $_POST, 'errores' => $errores);
             View::renderMulti($filenames, $datos);
         } else {
             $filenames = ["generic/formpersona", "usuario/formulario"];
             $datos = array('destino' => 'usuario/crear', 'submit' => 'Crear', 'provincialist' => $provincias, 'categorialist' => $categorias, 'persona' => $_POST, 'errores' => $errores);
             View::renderMulti($filenames, $datos);
         }
     }
 }