From 1c41cdb32f2d4f34174b3020cbf45e90ff6c0933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernando=20M=C3=A9ndez?=
<45081533+FerMdez@users.noreply.github.com>
Date: Fri, 16 Apr 2021 12:57:10 +0200
Subject: [PATCH] Add files via upload
---
panel_admin/add_film.php | 13 ++++
panel_admin/deleteFilm.php | 30 ++++++++
panel_admin/delete_film.php | 12 +++
panel_admin/editFilm.php | 37 +++++++++
panel_admin/edit_film.php | 11 +++
panel_admin/index.php | 5 +-
panel_admin/template_index.php | 76 +++++++++++++++++++
panel_admin/validade.php | 66 ++++++++++++++++
panel_manager/edit_sessions.php | 4 +-
panel_manager/includes/listFilms.php | 53 +++++++++++++
panel_manager/includes/listSessions.php | 55 ++++++++++++++
panel_manager/includes/room_dao.php | 39 ++++++++++
panel_manager/includes/room_dto.php | 37 +++++++++
panel_manager/includes/room_dto_interface.php | 12 +++
panel_manager/includes/session_dao.php | 4 +-
panel_manager/room_dto.php | 30 ++++++++
panel_manager/session_dto.php | 44 +++++++++++
panel_manager/user_registered_view.php | 4 +
panel_manager/user_unregistered_view.php | 3 +
panel_manager/validate.php | 74 ++++++++++++++++++
panel_user/index.php | 6 +-
21 files changed, 604 insertions(+), 11 deletions(-)
create mode 100644 panel_admin/add_film.php
create mode 100644 panel_admin/deleteFilm.php
create mode 100644 panel_admin/delete_film.php
create mode 100644 panel_admin/editFilm.php
create mode 100644 panel_admin/edit_film.php
create mode 100644 panel_admin/template_index.php
create mode 100644 panel_admin/validade.php
create mode 100644 panel_manager/includes/listFilms.php
create mode 100644 panel_manager/includes/listSessions.php
create mode 100644 panel_manager/includes/room_dao.php
create mode 100644 panel_manager/includes/room_dto.php
create mode 100644 panel_manager/includes/room_dto_interface.php
create mode 100644 panel_manager/room_dto.php
create mode 100644 panel_manager/session_dto.php
create mode 100644 panel_manager/user_registered_view.php
create mode 100644 panel_manager/user_unregistered_view.php
create mode 100644 panel_manager/validate.php
diff --git a/panel_admin/add_film.php b/panel_admin/add_film.php
new file mode 100644
index 0000000..a334ac8
--- /dev/null
+++ b/panel_admin/add_film.php
@@ -0,0 +1,13 @@
+processesForm(null, $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "new");
+ $_SESSION['message'] = $film->getReply();
+ header("Location: ../panel_admin/index.php?state=mf");
+ }
+
+?>
\ No newline at end of file
diff --git a/panel_admin/deleteFilm.php b/panel_admin/deleteFilm.php
new file mode 100644
index 0000000..0e2eb31
--- /dev/null
+++ b/panel_admin/deleteFilm.php
@@ -0,0 +1,30 @@
+
+
Editar pelicula
+
+ ';
+
+ }
+
+
+?>
\ No newline at end of file
diff --git a/panel_admin/delete_film.php b/panel_admin/delete_film.php
new file mode 100644
index 0000000..990d4b5
--- /dev/null
+++ b/panel_admin/delete_film.php
@@ -0,0 +1,12 @@
+processesForm($_REQUEST['id'],null,null,null,null,"del");
+ $_SESSION['message'] = $film->getReply();
+
+ }
+ header("Location: ../panel_admin/index.php?state=mf");
+?>
\ No newline at end of file
diff --git a/panel_admin/editFilm.php b/panel_admin/editFilm.php
new file mode 100644
index 0000000..3ac8f90
--- /dev/null
+++ b/panel_admin/editFilm.php
@@ -0,0 +1,37 @@
+
+ Editar pelicula
+
+ ';
+
+ }
+
+
+?>
\ No newline at end of file
diff --git a/panel_admin/edit_film.php b/panel_admin/edit_film.php
new file mode 100644
index 0000000..2dae5d1
--- /dev/null
+++ b/panel_admin/edit_film.php
@@ -0,0 +1,11 @@
+processesForm($_REQUEST['id'], $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "edit");
+ $_SESSION['message'] = $film->getReply();
+ header("Location: ../panel_admin/index.php?state=mf");
+ }
+?>
\ No newline at end of file
diff --git a/panel_admin/index.php b/panel_admin/index.php
index ffd917c..6ccb11c 100644
--- a/panel_admin/index.php
+++ b/panel_admin/index.php
@@ -1,9 +1,8 @@
+// TO DO: Delete
+
+
+
+
+ print_head();
+ ?>
+
+
+ print_header();
+ ?>
+
+
+ print_main();
+ ?>
+
+
+
+
+
+
+
+
+
+
AQUÍ EL CONTENIDO DE CADA FUNCIONALIDAD.
+
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 sí).
+
Tendréis que rehacer todo el "PANEL" con PHP.
+
+
+
+
+
+
+ print_footer();
+ ?>
+
+
+
+
diff --git a/panel_admin/validade.php b/panel_admin/validade.php
new file mode 100644
index 0000000..7120e49
--- /dev/null
+++ b/panel_admin/validade.php
@@ -0,0 +1,66 @@
+processesForm($id, $_POST["title"], $_POST["duration"], $_POST["languaje"],$_POST["description"], $action);
+ $reply = $session->getReply();
+?>
+
+
+
+
+ print_head();
+ ?>
+
+
+ print_header();
+ ?>
+
+
+
+
+
+
+
+
+ print_footer();
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/panel_manager/edit_sessions.php b/panel_manager/edit_sessions.php
index 44e275b..da6e69f 100644
--- a/panel_manager/edit_sessions.php
+++ b/panel_manager/edit_sessions.php
@@ -36,7 +36,7 @@
Datos
-
+
";
foreach($formHall->getReply() as $r){
@@ -89,7 +89,7 @@
Datos
-
+
";
foreach($formHall->getReply() as $r){
diff --git a/panel_manager/includes/listFilms.php b/panel_manager/includes/listFilms.php
new file mode 100644
index 0000000..4857c40
--- /dev/null
+++ b/panel_manager/includes/listFilms.php
@@ -0,0 +1,53 @@
+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);
+ }
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/panel_manager/includes/listSessions.php b/panel_manager/includes/listSessions.php
new file mode 100644
index 0000000..81fcaae
--- /dev/null
+++ b/panel_manager/includes/listSessions.php
@@ -0,0 +1,55 @@
+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);
+ }
+ }
+
+}
+
+?>
+
diff --git a/panel_manager/includes/room_dao.php b/panel_manager/includes/room_dao.php
new file mode 100644
index 0000000..7661e82
--- /dev/null
+++ b/panel_manager/includes/room_dao.php
@@ -0,0 +1,39 @@
+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);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/panel_manager/includes/room_dto.php b/panel_manager/includes/room_dto.php
new file mode 100644
index 0000000..612b5ef
--- /dev/null
+++ b/panel_manager/includes/room_dto.php
@@ -0,0 +1,37 @@
+_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; }
+
+ }
+?>
\ No newline at end of file
diff --git a/panel_manager/includes/room_dto_interface.php b/panel_manager/includes/room_dto_interface.php
new file mode 100644
index 0000000..d220dfa
--- /dev/null
+++ b/panel_manager/includes/room_dto_interface.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/panel_manager/includes/session_dao.php b/panel_manager/includes/session_dao.php
index cac0594..381e55a 100644
--- a/panel_manager/includes/session_dao.php
+++ b/panel_manager/includes/session_dao.php
@@ -15,7 +15,7 @@
$startTime = date('H:i:s', strtotime( $startTime ) );
$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);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@@ -75,7 +75,7 @@
$sql = sprintf( "UPDATE `session`
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
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"]);
diff --git a/panel_manager/room_dto.php b/panel_manager/room_dto.php
new file mode 100644
index 0000000..68ee0fb
--- /dev/null
+++ b/panel_manager/room_dto.php
@@ -0,0 +1,30 @@
+_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; }
+
+ }
+?>
\ No newline at end of file
diff --git a/panel_manager/session_dto.php b/panel_manager/session_dto.php
new file mode 100644
index 0000000..b47de51
--- /dev/null
+++ b/panel_manager/session_dto.php
@@ -0,0 +1,44 @@
+_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; }
+
+ }
+?>
\ No newline at end of file
diff --git a/panel_manager/user_registered_view.php b/panel_manager/user_registered_view.php
new file mode 100644
index 0000000..8aa90e4
--- /dev/null
+++ b/panel_manager/user_registered_view.php
@@ -0,0 +1,4 @@
+ Vista de usuario registrado
+
+ Esta vista aun no esta implementada
+
\ No newline at end of file
diff --git a/panel_manager/user_unregistered_view.php b/panel_manager/user_unregistered_view.php
new file mode 100644
index 0000000..74370f4
--- /dev/null
+++ b/panel_manager/user_unregistered_view.php
@@ -0,0 +1,3 @@
+ Vista de usuario no registrado
+
+ Esta vista aun no esta implementada
\ No newline at end of file
diff --git a/panel_manager/validate.php b/panel_manager/validate.php
new file mode 100644
index 0000000..1d55f6d
--- /dev/null
+++ b/panel_manager/validate.php
@@ -0,0 +1,74 @@
+processesForm($id, $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], $action);
+ $reply = $session->getReply();
+
+?>
+
+
+
+
+ print_head();
+ ?>
+
+
+ print_header();
+ ?>
+
+
+
+
+
+
+
+
+ print_footer();
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/panel_user/index.php b/panel_user/index.php
index f40f2fc..9170c85 100644
--- a/panel_user/index.php
+++ b/panel_user/index.php
@@ -1,9 +1,7 @@