Add files via upload

This commit is contained in:
Fernando Méndez 2021-04-16 12:57:10 +02:00 committed by GitHub
parent e0ed6b8216
commit 1c41cdb32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 604 additions and 11 deletions

13
panel_admin/add_film.php Normal file
View File

@ -0,0 +1,13 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['add_film']) {
$film = new FormFilm();
$film->processesForm(null, $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "new");
$_SESSION['message'] = $film->getReply();
header("Location: ../panel_admin/index.php?state=mf");
}
?>

View File

@ -0,0 +1,30 @@
<?php
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['delete_film']) {
echo'<div class="column size">
<h2>Editar pelicula</h2>
<form method="post" action="delete_film.php">
<div class="row">
<fieldset id="film_form">
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_REQUEST['id'].'/>
<p>Id: '.$_REQUEST['id'].' </p>
<p>Título: '.$_REQUEST['tittle'].' </p>
<p>Duración: '.$_REQUEST['duration'].' </p>
<p>Idioma: '.$_REQUEST['language'].' </p>
<p>Descripción: '.$_REQUEST['description'].' </p>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
</div>
</div>
</form>
</div>';
}
?>

View File

@ -0,0 +1,12 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['confirm_delete_film']) {
$film = new FormFilm();
$film->processesForm($_REQUEST['id'],null,null,null,null,"del");
$_SESSION['message'] = $film->getReply();
}
header("Location: ../panel_admin/index.php?state=mf");
?>

37
panel_admin/editFilm.php Normal file
View File

@ -0,0 +1,37 @@
<?php
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['edit_film']) {
echo'<div class="column size">
<h2>Editar pelicula</h2>
<form method="post" action="edit_film.php">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<input type="hidden" name="id" value='.$_REQUEST['id'].'/>
<div>
<input type="text" name="tittle" value='.$_REQUEST['tittle'].' />
</div>
<div>
<input type="number" name="duration" id="duration" value='.$_REQUEST['duration'].' />
</div>
<div>
<input type="text" name="language" id="language" value='.$_REQUEST['language'].' />
</div>
<div>
<input type="text" name="description" id="description" value='.$_REQUEST['description'].'/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>';
}
?>

11
panel_admin/edit_film.php Normal file
View File

@ -0,0 +1,11 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['confirm_edit_film']) {
$film = new FormFilm();
$film->processesForm($_REQUEST['id'], $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "edit");
$_SESSION['message'] = $film->getReply();
header("Location: ../panel_admin/index.php?state=mf");
}
?>

View File

@ -1,7 +1,6 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<?php <?php
//General Config File:
include_once('../assets/php/config.php'); include_once('../assets/php/config.php');
require_once('../panel_admin/panelAdmin.php'); require_once('../panel_admin/panelAdmin.php');

View File

@ -0,0 +1,76 @@
<!DOCTYPE HTML>
// TO DO: Delete
<?php
session_start();
require_once('../assets/php/template.php');
$template = new Template();
// IMPORTANTE:
// VERIFICAR QUE ES ADMIN, SI NO, MOSTRAR MENSAJE DE "ERROR"
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Panel -->
<div class="row">
<!-- Left Sidebar -->
<div class="sidebar left">
<ul>
<li>Funcionalidad:</li>
<ul>
<li>Subfuncionalidad</li>
<li>Subfuncionalidad</li>
</ul><br />
<li>Ver como:</li>
<ul>
<li>Usuario no registrado</li>
<li>Usuario registrado</li>
<li>Gerente</li>
</ul><br />
<li>Añadir/Editar/Eliminar:</li>
<ul>
<li>Cines</li>
<li>Películas</li>
<li>Promociones</li>
<li>Gerente</li>
</ul>
</ul>
</div>
<!-- Contents -->
<div class="row">
<div class="column side"></div>
<div class="column middle">
<h2>AQUÍ EL CONTENIDO DE CADA FUNCIONALIDAD.</h2>
<p>Debe variar dinámicamente según el botón del panel izquierdo que se pulse (sin cargar una página diferente, aunque tendrá que recargar el contido, eso ).</p>
<p>Tendréis que rehacer todo el "PANEL" con PHP.</p>
</div>
<div class="column side"></div>
</div>
</div>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

66
panel_admin/validade.php Normal file
View File

@ -0,0 +1,66 @@
<?php
session_start();
require_once('../assets/php/template.php');
$template = new Template();
$action ="";
$id = null;
if(isset($_POST['new'])){
$action = "new";
} else if (isset($_POST['edit'])){
$action = "edit";
$id = $_POST["id"];
} else if (isset($_POST['del'])){
$action = "del";
$id = $_POST["id"];
}
//Login form validate:
require_once('./includes/formFilm.php');
$session = new FormFilm();
$session->processesForm($id, $_POST["title"], $_POST["duration"], $_POST["languaje"],$_POST["description"], $action);
$reply = $session->getReply();
?>
<!DOCTYPE HTML>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
</div>
<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
<?php
echo $reply;
?>
</div>
</div>
<div class="column side"></div>
</div>
</section>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -36,7 +36,7 @@
<fieldset id=\"datos\"> <fieldset id=\"datos\">
<legend>Datos</legend> <legend>Datos</legend>
<div class=\"_price\"> <div class=\"_price\">
<input type=\"number\" name=\"price\" step=\"0.01\"id=\"price\" value=\"". $_POST['price'] ."\"min=\"0\" placeholder=\"Precio de la entrada\" required/> <input type=\"number\" name=\"price\" id=\"price\" value=\"". $_POST['price'] ."\"min=\"0\" placeholder=\"Precio de la entrada\" required/>
</div> </div>
<select name=\"hall\" class=\"button large\">"; <select name=\"hall\" class=\"button large\">";
foreach($formHall->getReply() as $r){ foreach($formHall->getReply() as $r){
@ -89,7 +89,7 @@
<legend>Datos</legend> <legend>Datos</legend>
<input type=\"hidden\" name=\"cinema\" value =\"1\" /> <input type=\"hidden\" name=\"cinema\" value =\"1\" />
<div class=\"_price\"> <div class=\"_price\">
<input type=\"number\" name=\"price\" step=\"0.01\" id=\"price\" min=\"0\" placeholder=\"Precio de la entrada\" required/> <input type=\"number\" name=\"price\" id=\"price\" min=\"0\" placeholder=\"Precio de la entrada\" required/>
</div> </div>
<select name=\"hall\" class=\"button large\">"; <select name=\"hall\" class=\"button large\">";
foreach($formHall->getReply() as $r){ foreach($formHall->getReply() as $r){

View File

@ -0,0 +1,53 @@
<?php
require('../panel_admin/includes/film_dao.php');
class ListFilms{
//Atributes:
private $array;
private $size;
//Constructor:
public function __construct() {
$this->array = array();
$this->updateArray();
}
//Methods:
//Returns the whole session array
public function getArray() {
return $this->array;
}
//Returns the value i from the array
public function getiArray($i) {
if($i < $size){
return $this->array($i);
} else {
return null;
}
}
//Update the array with new values
public function updateArray() {
$bd = new Film_DAO('complucine');
if($bd){
$selectFilms = $bd->allFilmData();
$selectFilms->data_seek(0);
$this->size = 0;
while ($fila = $selectFilms->fetch_assoc()) {
$this->array[]= new Film_DTO($fila['id'], $fila['tittle'], $fila['duration'], $fila['language'], "no hay descripcion en la base de datos");
$this->size++;
}
mysqli_free_result($selectFilms);
}
}
}
?>

View File

@ -0,0 +1,55 @@
<?php
include_once('session_dao.php');
class ListSessions{
//Atributes:
private $array;
private $size;
//Constructor:
public function __construct() {
$this->array = array();
}
//Methods:
//Returns the whole session array
public function getArray() {
return $this->array;
}
//Returns the value i from the array
public function getiArray($i) {
if($i < $size){
return $this->array($i);
} else {
return null;
}
}
//Update the array with new values
public function filterList($cinema, $hall, $date) {
$date = date('Y-m-d', strtotime( $date ) );
$bd = new sessionDAO('complucine');
if($bd){
$selectSession = $bd->selectSession($cinema, $hall, null, $date);
$selectSession->data_seek(0);
$this->size = 0;
while ($fila = $selectSession->fetch_assoc()) {
$this->array[]= new SessionDTO($fila['id'], $fila['idfilm'], $fila['idhall'], $fila['idcinema'], $fila['date'], date('H:i', strtotime( $fila['start_time'])) , $fila['seat_price'], $fila['format']);
$this->size++;
}
mysqli_free_result($selectSession);
}
}
}
?>

View File

@ -0,0 +1,39 @@
<?php
require_once('../assets/php/dao.php');
include_once('room_dto.php');
class RoomDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Room.
public function createRoom($id, $idcinema, $numCol, $numRows){
$sql = sprintf( "INSERT INTO rooms( id, idcinema, numCol, numRows)
VALUES ( '%s', '%s', '%i', '%i')",
$id, $idcinema, $numCol, $numRows );
return $sql;
}
//Returns a query to get the room's data.
public function roomData($id){
$sql = sprintf( "SELECT * FROM rooms WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Room Data Transfer Object.
public function loadRoom($id, $idcinema, $numCol, $numRows){
return new RoomDTO($id, $idcinema, $numCol, $numRows);
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
include_once('room_dto_interface.php');
class RoomDTO implements RoomsDTO {
//Attributes:
private $_id; //Room Id.
private $_idcinema; //Cinema Id
private $_numCol; //Num columns.
private $_numRows; //Num rows.
//Constructor:
function __construct($id, $idcinema, $numCol, $numRows){
$this->_id = $id;
$this->_idcinema = $idcinema;
$this->_numCol = $numCol;
$this->_numRows = $numRows;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setNumRows($numRows){ $this->_numRows = $numRows; }
public function getNumRows(){ return $this->_numRows; }
}
?>

View File

@ -0,0 +1,12 @@
<?php
interface RoomsDTO {
public function setId($id);
public function getId();
public function setIdcinema($idcinema);
public function getIdcinema();
public function setNumCol($numCol);
public function getNumCol();
public function setNumRows($numRows);
public function getNumRows();
}
?>

View File

@ -15,7 +15,7 @@
$startTime = date('H:i:s', strtotime( $startTime ) ); $startTime = date('H:i:s', strtotime( $startTime ) );
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`) $sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`)
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%f', '%s')", VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s')",
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format); $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -75,7 +75,7 @@
$sql = sprintf( "UPDATE `session` $sql = sprintf( "UPDATE `session`
SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s', SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
`start_time` = '%s', `seat_price` = '%f', `format` = '%s' `start_time` = '%s', `seat_price` = '%d', `format` = '%s'
WHERE WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]); $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]);

View File

@ -0,0 +1,30 @@
<?php
class RoomDTO {
//Attributes:
private $_id; //Room Id.
private $_numCol; //Num columns.
private $_numRows; //Num rows.
//Constructor:
function __construct($id, $numCol, $numRows){
$this->_id = $id;
$this->_numCol = $numCol;
$this->_numRows = $numRows;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setNumRows($numRows){ $this->_numRows = $numRows; }
public function getNumRows(){ return $this->_numRows; }
}
?>

View File

@ -0,0 +1,44 @@
<?php
class SessionDTO {
//Attributes:
private $_id; //Session Id.
private $_date; //Session date.
private $_startTime; //Session start time.
private $_seatPrice; //Seat price.
private $_format; //Type of film: 3D | 4D | normal | subtitle | mute.
private $_film; //Object film, ESTO HAY QUE CAMBIARLO? POR UN OBJETO TIPO PELICULA
//Constructor:
function __construct($id, $date, $startTime, $seatPrice, $format, $film){
$this->_id = $id;
$this->_date = $date;
$this->_startTime = $startTime;
$this->_seatPrice = $seatPrice;
$this->_format = $format;
$this->_film = $film;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setDate($date){ $this->_date = $date; }
public function getDate(){ return $this->_date; }
public function setStartTime($startTime){ $this->_startTime = $startTime; }
public function getStartTime(){ return $this->_startTime; }
public function setSeatPrice($seatPrice){ $this->_seatPrice = $seatPrice; }
public function getSeatPrice(){ return $this->_seatPrice; }
public function setFormat($format){ $this->_format = $format; }
public function getFormat(){ return $this->_format; }
public function setFilm($film){ $this->_film = $film; }
public function getFilm(){ return $this->_film; }
}
?>

View File

@ -0,0 +1,4 @@
<h1> Vista de usuario registrado </h1>
<br>
<p> Esta vista aun no esta implementada </p>

View File

@ -0,0 +1,3 @@
<h1> Vista de usuario no registrado </h1>
<br>
<p> Esta vista aun no esta implementada </p>

View File

@ -0,0 +1,74 @@
<?php
session_start();
//Depuración (BORRAR):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//HTML template:
require_once('../assets/php/template.php');
$template = new Template();
$action ="";
$id = null;
if(isset($_POST['new'])){
$action = "new";
} else if (isset($_POST['edit'])){
$action = "edit";
$id = $_POST["id"];
} else if (isset($_POST['del'])){
$action = "del";
$id = $_POST["id"];
}
//Login form validate:
require_once('./includes/formSession.php');
$session = new FormSession();
$session->processesForm($id, $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], $action);
$reply = $session->getReply();
?>
<!DOCTYPE HTML>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
</div>
<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
<?php
echo $reply;
?>
</div>
</div>
<div class="column side"></div>
</div>
</section>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,9 +1,7 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<?php <?php
session_start(); //General Config File:
require_once('../assets/php/config.php');
require_once('../assets/php/template.php');
$template = new template();
// IMPORTANTE: // IMPORTANTE:
// VERIFICAR QUE EL USUARIO HA INICIADO SESIÓN, SI NO, MOSTRAR MENSAJE DE "ERROR" // VERIFICAR QUE EL USUARIO HA INICIADO SESIÓN, SI NO, MOSTRAR MENSAJE DE "ERROR"