From b4f2d17d0ed96c8bbf153d8f75e69952375d9575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Tue, 25 May 2021 17:02:29 +0200 Subject: [PATCH] Add files via upload --- assets/css/highContrast.css | 55 ++++++++++++++++- assets/css/main.css | 55 +++++++++++++++++ assets/js/deleteConfirm.js | 3 + assets/php/includes/cinema_dao.php | 9 ++- assets/php/includes/film_dao.php | 18 ------ assets/php/includes/session_dao.php | 13 ++++ assets/php/template.php | 1 + panel_user/confirm.php | 1 + panel_user/includes/formDeleteAccount.php | 5 +- purchase/confirm.php | 5 +- purchase/includes/formPurchase.php | 75 ++++++++++++++++++++--- purchase/index.php | 17 ++--- 12 files changed, 214 insertions(+), 43 deletions(-) create mode 100644 assets/js/deleteConfirm.js create mode 100644 panel_user/confirm.php diff --git a/assets/css/highContrast.css b/assets/css/highContrast.css index 9725c22..f41436d 100644 --- a/assets/css/highContrast.css +++ b/assets/css/highContrast.css @@ -373,13 +373,19 @@ .code.purchase { text-align: center; } +.code.purchase h3 { + margin-top: 2em; +} .code.purchase img { margin: 0.1em 0 0.8em 0; width: 100%; - box-shadow: 0 4px 8px 0 #00020f, 0 6px 20px 0 #00020f; + box-shadow: 0 4px 8px 0 #d3ebff, 0 6px 20px 0 #d3ebff; } .code.purchase select, .code.purchase select option { + display: block; width: 100%; + height: 30px; + margin: 0.1em 0.5em 1em 0.5em; font-weight: bold !important; color: #1f2c3d !important; background-color: #d3ebff; @@ -678,6 +684,53 @@ .file input{ height: 110%; } + + .card-holder { + width: 75%; + display: inline-block; + } + .input-cart-number, .fieldset-cvv, .select { + width: 70px; + max-width: 100%; + display: inline-block; + } + + form select { + display: inline-block; + font-size: 15px; + font-weight: 400; + color: #1f2c3d; + line-height: 1.3; + padding: .4em 1.4em .3em .8em; + width: 75px; + max-width: 100%; + box-sizing: border-box; + margin: 10px auto; + border: 1px solid #d3ebff; + box-shadow: 0 1px 0 1px #1f2c3d; + border-radius: .3em; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #fff; + } + form select::-ms-expand { + display: none; + } + form select:hover { + border-color: #d3ebff; + } + form select:focus { + border-color: #d3ebff; + box-shadow: 0 0 1px 3px #1f2c3d; + box-shadow: 0 0 0 3px -moz-mac-focusring; + color: #1f2c3d; + outline: none; + } + form select option { + font-weight:normal; + } + /* Preformatted Text */ pre { diff --git a/assets/css/main.css b/assets/css/main.css index 62af3b4..c6bc8be 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -371,13 +371,19 @@ main img { .code.purchase { text-align: center; } +.code.purchase h3 { + margin-top: 2em; +} .code.purchase img { margin: 0.1em 0 0.8em 0; width: 100%; box-shadow: 0 4px 8px 0 #d3ebff, 0 6px 20px 0 #d3ebff; } .code.purchase select, .code.purchase select option { + display: block; width: 100%; + height: 30px; + margin: 0.1em 0.5em 1em 0.5em; font-weight: bold !important; color: #1f2c3d !important; background-color: #d3ebff; @@ -664,6 +670,7 @@ textarea { border:#000000; background-color: #791515; } + .file{ margin-top: 10px; } @@ -671,6 +678,53 @@ textarea { height: 110%; } +.card-holder { + width: 75%; + display: inline-block; +} +.input-cart-number, .fieldset-cvv, .select { + width: 70px; + max-width: 100%; + display: inline-block; +} + +form select { + display: inline-block; + font-size: 15px; + font-weight: 400; + color: #1f2c3d; + line-height: 1.3; + padding: .4em 1.4em .3em .8em; + width: 75px; + max-width: 100%; + box-sizing: border-box; + margin: 10px auto; + border: 1px solid #d3ebff; + box-shadow: 0 1px 0 1px #1f2c3d; + border-radius: .3em; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #fff; +} +form select::-ms-expand { + display: none; +} +form select:hover { + border-color: #d3ebff; +} +form select:focus { + border-color: #d3ebff; + box-shadow: 0 0 1px 3px #1f2c3d; + box-shadow: 0 0 0 3px -moz-mac-focusring; + color: #1f2c3d; + outline: none; +} +form select option { + font-weight:normal; +} + + /* Preformatted Text */ pre { font-weight: bold; @@ -680,6 +734,7 @@ fieldset pre { color: red; } + /* Footer */ footer { text-align: left; diff --git a/assets/js/deleteConfirm.js b/assets/js/deleteConfirm.js new file mode 100644 index 0000000..3211bb0 --- /dev/null +++ b/assets/js/deleteConfirm.js @@ -0,0 +1,3 @@ +function newWindow(page){ + window.open(page, 'Ventana de Confirmación', 'width=500, height=300'); +} \ No newline at end of file diff --git a/assets/php/includes/cinema_dao.php b/assets/php/includes/cinema_dao.php index 2719d14..0660562 100644 --- a/assets/php/includes/cinema_dao.php +++ b/assets/php/includes/cinema_dao.php @@ -44,7 +44,14 @@ public function cinemaData($id){ $sql = sprintf( "SELECT * FROM cinema WHERE cinema.id = '%d'", $id); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - return $resul; + + $cinema = null; + while($fila=$resul->fetch_assoc()){ + $cinema = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]); + } + $resul->free(); + + return $cinema; } //Deleted film by "id". diff --git a/assets/php/includes/film_dao.php b/assets/php/includes/film_dao.php index 35d4c06..9b4f77c 100644 --- a/assets/php/includes/film_dao.php +++ b/assets/php/includes/film_dao.php @@ -120,24 +120,6 @@ return $cinemas; } - - //Get sessions associated with a film. - public function getSessions($id){ - include_once('session_dao.php'); - $session = new SessionDAO("complucine"); - - $sql = sprintf( " SELECT DISTINCT * FROM session WHERE session.id in - (SELECT session.id FROM session JOIN film ON session.idfilm = film.id WHERE film.id = '%d'); ", $id); - $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - - $sessions = null; - while($fila = $resul->fetch_assoc()){ - $sessions[] = $session->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]); - } - $resul->free(); - - return $sessions; - } //Create a new film Data Transfer Object. public function loadFilm($id, $tittle, $duration, $language,$description, $img){ diff --git a/assets/php/includes/session_dao.php b/assets/php/includes/session_dao.php index e7eb904..1ce608f 100644 --- a/assets/php/includes/session_dao.php +++ b/assets/php/includes/session_dao.php @@ -79,6 +79,19 @@ return $sessions; } + + public function getSessions_Film_Cinema($idFiml, $idCinema){ + $sql = sprintf( "SELECT * FROM session WHERE session.idfilm = '%d' AND session.idcinema = '%d' ", $idFiml, $idCinema); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + $sessions = null; + while($fila = $resul->fetch_assoc()){ + $sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]); + } + $resul->free(); + + return $sessions; + } public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){ $format = $this->mysqli->real_escape_string($format); diff --git a/assets/php/template.php b/assets/php/template.php index 55db2fd..5bbb4c0 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -690,6 +690,7 @@ "; if($page === "FDI-Cines") echo"\n"; + if($page === "Panel de Usuario") echo"\n"; } } diff --git a/panel_user/confirm.php b/panel_user/confirm.php new file mode 100644 index 0000000..7624a4d --- /dev/null +++ b/panel_user/confirm.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/panel_user/includes/formDeleteAccount.php b/panel_user/includes/formDeleteAccount.php index 8afc59c..8f3b5f3 100644 --- a/panel_user/includes/formDeleteAccount.php +++ b/panel_user/includes/formDeleteAccount.php @@ -36,8 +36,9 @@ class FormDeleteAccount extends Form { -
- +
+ +
"; diff --git a/purchase/confirm.php b/purchase/confirm.php index 401bd7b..8781465 100644 --- a/purchase/confirm.php +++ b/purchase/confirm.php @@ -1,11 +1,8 @@ loadSession($_POST["session_id"], $_POST["film_id"], $_POST["hall_id"], $_POST["cinema_id"], $_POST["date_"], $_POST["hour_"], "12", null, null); - $session = $sessionDAO->sessionData($_POST["session_id"]); + //echo $_POST["session_id"]; //Purchase form: require_once('includes/formPurchase.php'); diff --git a/purchase/includes/formPurchase.php b/purchase/includes/formPurchase.php index b48d8e9..eaf0b5f 100644 --- a/purchase/includes/formPurchase.php +++ b/purchase/includes/formPurchase.php @@ -1,15 +1,41 @@ session = $sessionDAO->sessionData($_POST["session_id"]); + + $filmDAO = new Film_DAO("complucine"); + $this->film = $filmDAO->FilmData($this->session->getIdfilm()); + + $cinemaDAO = new Cinema_DAO("complucine"); + $this->cinema = $cinemaDAO->cinemaData($this->session->getIdcinema()); + + $TODAY = getdate(); + $year = "$TODAY[year]"; + + $this->years = array(); + for($i = $year; $i < $year+10; $i++) array_push($this->years, $i); + + $this->months = array(); + for($i = 1; $i <= 12; $i++) array_push($this->months, $i); } protected function generaCamposFormulario($datos, $errores = array()){ @@ -19,17 +45,46 @@ class FormPurchase extends Form { $errorNombre = self::createMensajeError($errores, 'name', 'span', array('class' => 'error')); $errorPassword = self::createMensajeError($errores, 'pass', 'span', array('class' => 'error')); + $monthsHTML = ""; + foreach($this->months as $value){ + $monthsHTML .= ""; + } + + $yearsHTML = ""; + foreach($this->years as $value){ + $yearsHTML .= ""; + } + $html = "
-
".$htmlErroresGlobales."
+
Resumen de la Compra -

Película: ".$session->getIdfilm()."

-

Cine: ".$session->getIdcinema()."

-

Sala: ".$session->getIdhall()."

-

Fecha: ".date_format(date_create($session->getDate()), 'd-m-Y')."

-

Hora: ".$session->getStartTime()."

-

Precio: ".$session->getSeatPrice()."€

+

Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."

+

Cine: ".$this->cinema->getName()."

+

Sala: ".$this->session->getIdhall()."

+

Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."

+

Hora: ".$this->session->getStartTime()."

+

Precio: ".$this->session->getSeatPrice()."€

+
+
".$htmlErroresGlobales."
Datos Bancarios -
".$errorNombre."
+
+ +
+
+ + + + + + +
+
+ +
diff --git a/purchase/index.php b/purchase/index.php index 2641f9f..5475fbe 100644 --- a/purchase/index.php +++ b/purchase/index.php @@ -7,6 +7,7 @@ include_once($prefix.'assets/php/includes/film.php'); include_once($prefix.'assets/php/includes/cinema_dao.php'); include_once($prefix.'assets/php/includes/cinema.php'); + include_once($prefix.'assets/php/includes/session_dao.php'); include_once($prefix.'assets/php/includes/session.php'); $TODAY = getdate(); @@ -50,7 +51,9 @@ $fiml_id = $film->getId(); $cinema_id = $value["cID"]; - $sessions = $filmDAO->getSessions($_GET["film"]); + $sessionsDAO = new SessionDAO("complucine"); + $sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id); + //print_r($sessions); if(!empty($sessions)){ $sessionsDates = new ArrayIterator(array()); $sessionsStarts = new ArrayIterator(array()); @@ -71,10 +74,10 @@ $sessionsListHTML = '