initial commit
This commit is contained in:
46
models/alumno.php
Normal file
46
models/alumno.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
require_once('../db.php');
|
||||
|
||||
class Alumno
|
||||
{
|
||||
private $id;
|
||||
private $rut;
|
||||
private $nombre;
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
public function set_id($id) { $this->id = $id; }
|
||||
public function get_id() { return $this->id; }
|
||||
public function set_rut($rut) { $this->rut = $rut; }
|
||||
public function get_rut() { return $this->rut; }
|
||||
public function set_nombre($nombre) { $this->nombre = $nombre; }
|
||||
public function get_nombre() { return $this->nombre; }
|
||||
|
||||
public function save()
|
||||
{
|
||||
|
||||
$db = new DB();
|
||||
$result = $db->dml
|
||||
(
|
||||
"insert into alumno (rut, nombre) values (?, ?)",
|
||||
$this->rut, $this->nombre
|
||||
);
|
||||
return $result > 0;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$db = new DB();
|
||||
$results = $db->query("select * from alumno");
|
||||
|
||||
$alumnos = [];
|
||||
foreach($results as $result) {
|
||||
$alumno = new Alumno();
|
||||
$alumno->set_id($result['id']);
|
||||
$alumno->set_rut($result['rut']);
|
||||
$alumno->set_nombre($result['nombre']);
|
||||
array_push($alumnos, $alumno);
|
||||
}
|
||||
return $alumnos;
|
||||
}
|
||||
}
|
||||
?>
|
||||
38
models/pedido.php
Normal file
38
models/pedido.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require_once('../db.php');
|
||||
|
||||
class Reserva
|
||||
{
|
||||
private $id;
|
||||
private $fecha;
|
||||
private $estado;
|
||||
private $plato_id;
|
||||
private $cliente_id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_id() { return $this->id; }
|
||||
public function get_fecha() { return $this->fecha; }
|
||||
public function get_estado() { return $this->estado; }
|
||||
public function get_plato_id() { return $this->plato_id; }
|
||||
public function get_cliente_id() { return $this->cliente_id; }
|
||||
public function set_id($id) { $this->id = $id}
|
||||
public function set_fecha($fecha) { $this->fecha = $fecha; }
|
||||
public function set_estado($estado) { $this->estado = $estado; }
|
||||
public function set_plato_id($plato_id) { $this->plato_id = $plato_id; }
|
||||
public function set_cliente_id($cliente_id) { $this->cliente_id = $cliente_id; }
|
||||
|
||||
public function save()
|
||||
{
|
||||
$db = new DB();
|
||||
$result = $db->dml
|
||||
(
|
||||
"insert into plato (id, fecha, estado, plato, cliente) values (?, ?, ?, ?, ?)",
|
||||
$this->id, $this->fecha, $this->estado, $this->plato_id, $this->cliente_id
|
||||
);
|
||||
return $result > 0;
|
||||
}
|
||||
}
|
||||
?>
|
||||
35
models/plato.php
Normal file
35
models/plato.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once('../db.php');
|
||||
|
||||
class Plato
|
||||
{
|
||||
private $id;
|
||||
private $nombre;
|
||||
private $descripcion;
|
||||
private $imagen;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_id() { return $this->id; }
|
||||
public function set_id($id) { $this->id = $id; }
|
||||
public function get_nombre() { return $this->nombre; }
|
||||
public function set_nombre($nombre) { $this->nombre = $nombre; }
|
||||
public function get_descripcion() { return $this->descripcion; }
|
||||
public function set_descripcion($descripcion) { $this->descripcion = $descripcion; }
|
||||
public function get_imagen() { return $this->imagen; }
|
||||
public function set_imagen($imagen) { $this->imagen = $imagen; }
|
||||
|
||||
public function save()
|
||||
{
|
||||
$db = new DB();
|
||||
$result = $db->dml
|
||||
(
|
||||
"insert into plato (id, nombre, descripcion, imagen) values (?, ?, ?, ?)",
|
||||
$this->id, $this->nombre, $this->descripcion, $this->imagen
|
||||
);
|
||||
return $result > 0;
|
||||
}
|
||||
}
|
||||
?>
|
||||
32
models/reserva.php
Normal file
32
models/reserva.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once('../db.php');
|
||||
|
||||
class Reserva
|
||||
{
|
||||
private $id;
|
||||
private $fecha;
|
||||
private $cliente_id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_id() { return $this->id; }
|
||||
public function set_id($id) { $this->id = $id; }
|
||||
public function get_fecha() { return $this->fecha; }
|
||||
public function set_fecha($fecha) { $this->fecha = $fecha; }
|
||||
public function get_cliente_id() { return $this->cliente_id; }
|
||||
public function set_cliente_id($cliente_id) { $this->cliente_id = $cliente_id; }
|
||||
|
||||
public function save()
|
||||
{
|
||||
$db = new DB();
|
||||
$result = $db->dml
|
||||
(
|
||||
"insert into reserva (id, fecha, cliente) values (?, ?, ?)",
|
||||
$this->id, $this->fecha, $this->cliente_id
|
||||
);
|
||||
return $result > 0;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user