Beispiel #1
1
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETRUTACONDUCTOR(:p_id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':p_id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->ruta = $row['ID_RUTA'];
         $this->conductor = $row['ID_CONDUCTOR'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->descripcion = $row['DESCRIPCION'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
Beispiel #2
0
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETPLANIFICACION(:id, :nombre, :distancia, :ruta); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':distancia', $this->distancia);
     oci_bind_by_name($sent, ':ruta', $this->ruta);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }
Beispiel #3
0
 public function getAll()
 {
     $respuesta = array();
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETALLRUTAS(:rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $elemento = new Ruta();
         $elemento->id = $row['ID_RUTA'];
         $elemento->nombre = $row['NOMBRE'];
         $respuesta[] = $elemento;
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return $respuesta;
 }
Beispiel #4
0
<?php

$username = $_POST['user'];
$password = $_POST['pass'];
$rol = 0;
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$id = 0;
$sql = "BEGIN LOGIN(:user, :pass, :rol, :id); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':user', $username);
oci_bind_by_name($sent, ':pass', $password);
oci_bind_by_name($sent, ':rol', $rol);
oci_bind_by_name($sent, ':id', $id);
oci_execute($sent);
$data->free($sent);
$data->close();
if ($rol > 0 && $id > 0) {
    session_start();
    $_SESSION['id'] = $id;
    $_SESSION['user'] = $username;
    $_SESSION['rol'] = $rol;
    header('Location: index.php');
} else {
    header('Location: loginform.php?error=1');
}
Beispiel #5
0
 public function delete($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN DELUSUARIO(:id); END;";
     $sent = oci_parse($data->getConn(), $sql);
     oci_bind_by_name($sent, ':id', $id);
     if (!oci_execute($sent)) {
         return false;
     }
     $data->free($sent);
     $data->close();
     return true;
 }
Beispiel #6
0
 public function update()
 {
     if ($this->factura != "" && $this->proveedor != "" && $this->id != 0) {
         require_once 'DataBase.php';
         $data = new DataBase();
         $data->open();
         $sql = "BEGIN UPDMANTENIMIENTO(:id, :factura, :proveedor, :fecha, :monto, :descripcion, :vehiculo, :tipo); END;";
         $sent = oci_parse($data->getConn(), $sql);
         oci_bind_by_name($sent, ':id', $this->id);
         oci_bind_by_name($sent, ':factura', $this->factura);
         oci_bind_by_name($sent, ':proveedor', $this->proveedor);
         oci_bind_by_name($sent, ':fecha', $this->fecha);
         oci_bind_by_name($sent, ':monto', $this->monto);
         oci_bind_by_name($sent, ':descripcion', $this->descripcion);
         oci_bind_by_name($sent, ':vehiculo', $this->vehiculo);
         oci_bind_by_name($sent, ':tipo', $this->tipoMantenimiento);
         if (!oci_execute($sent)) {
             return false;
         }
         $data->free($sent);
         $data->close();
         return true;
     } else {
         return false;
     }
 }
Beispiel #7
0
 function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETVEHICULO(:id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->id = $row['ID_VEHICULO'];
         $this->placa = $row['PLACA'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->serie = $row['SERIE'];
         $this->motor = $row['MOTOR'];
         $this->anio = $row['ANIO'];
         $this->color = $row['COLOR'];
         $this->marca = $row['MARCA'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
Beispiel #8
0
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN UPDATECONDUCTOR(:id, :nombre, :cui, :direccion, :telefono, :fechanac); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':cui', $this->cui);
     oci_bind_by_name($sent, ':direccion', $this->direccion);
     oci_bind_by_name($sent, ':telefono', $this->telefono);
     oci_bind_by_name($sent, ':fechanac', $this->fechanac);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }