From 85a0ff411d6814d5b03f7dbc706c7b89a6ef4c78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernando=20M=C3=A9ndez?=
<45081533+FerMdez@users.noreply.github.com>
Date: Wed, 2 Jun 2021 14:55:05 +0200
Subject: [PATCH] Add files via upload
---
assets/php/includes/seat_dao.php | 2 +-
contacto/index.php | 2 +-
panel_user/includes/formChangePass.php | 26 ++---
panel_user/panelUser.php | 4 +-
purchase/includes/formPurchase.php | 1 +
purchase/includes/formSelectCinemaSession.php | 10 +-
purchase/includes/formSelectSeat.php | 109 ++++++++++++++++++
purchase/selectSeat.php | 18 +++
8 files changed, 151 insertions(+), 21 deletions(-)
create mode 100644 purchase/includes/formSelectSeat.php
create mode 100644 purchase/selectSeat.php
diff --git a/assets/php/includes/seat_dao.php b/assets/php/includes/seat_dao.php
index 52c8d29..a144f24 100644
--- a/assets/php/includes/seat_dao.php
+++ b/assets/php/includes/seat_dao.php
@@ -25,7 +25,7 @@
public function getAllSeats($number, $cinema){
$sql = sprintf( "SELECT * FROM seat WHERE
- idhall = '%s' AND idcinema = '%s'",
+ idhall = '%d' AND idcinema = '%d'",
$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
diff --git a/contacto/index.php b/contacto/index.php
index 65a13db..f7ce99e 100644
--- a/contacto/index.php
+++ b/contacto/index.php
@@ -10,7 +10,7 @@
//Specific page content:
$section = '
Formulario (EN DESARROLLO)
+ Formulario
'.$htmlForm.'
Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."
Cine: ".$this->cinema->getName()."
Sala: ".$this->session->getIdhall()."
+Asiento: ".$_POST["checkbox11"]."
Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."
Hora: ".$this->session->getStartTime()."
Precio: ".$this->session->getSeatPrice()."€
diff --git a/purchase/includes/formSelectCinemaSession.php b/purchase/includes/formSelectCinemaSession.php index 972c9d2..035f06f 100644 --- a/purchase/includes/formSelectCinemaSession.php +++ b/purchase/includes/formSelectCinemaSession.php @@ -6,6 +6,8 @@ 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'); +include_once($prefix.'assets/php/includes/hall_dao.php'); +include_once($prefix.'assets/php/includes/hall.php'); class FormSelectCinemaSession extends Form { @@ -17,7 +19,7 @@ class FormSelectCinemaSession extends Form { private $_TODAY; // Actual date. public function __construct() { - $options = array("action" => "confirm.php"); + $options = array("action" => "selectSeat.php"); parent::__construct('formSelectCinemaSession', $options); $TODAY = getdate(); @@ -219,9 +221,9 @@ class FormSelectCinemaSession extends Form { $pay = false; } - //Pay button: + //Select seat button: if($pay){ - $pay = ''; + $pay = ''; } return ' @@ -258,7 +260,7 @@ class FormSelectCinemaSession extends Form { } if (count($result) === 0) { - $result = "confirm.php"; + $result = "selectSeat.php"; } return $result; diff --git a/purchase/includes/formSelectSeat.php b/purchase/includes/formSelectSeat.php new file mode 100644 index 0000000..755bd39 --- /dev/null +++ b/purchase/includes/formSelectSeat.php @@ -0,0 +1,109 @@ + "confirm.php"); + parent::__construct('formSelectSeat', $options); + + } + + protected function generaCamposFormulario($datos, $errores = array()){ + + // Se generan los mensajes de error, si existen. + $htmlErroresGlobales = self::generaListaErroresGlobales($errores); + $errorSeat = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error')); + + $sessionDAO = new SessionDAO("complucine"); + $session = $sessionDAO->sessionData($_POST["sessions"]); + + $hallDAO = new HallDAO("complucine"); + $hall = $hallDAO->HallData($session->getIdhall()); + + $seatDAO = new SeatDAO("complucine"); + $seats = $seatDAO->getAllSeats($session->getIdhall(), $session->getIdcinema()); + + $rows = $hall->getNumRows(); + $cols = $hall->getNumCol(); + + //$seats = $hall->getTotalSeats(); + $seats_map = array(); + + for($x = 0; $x < $hall->getTotalSeats(); $x++){ + for($i = 0; $i < $rows; $i++){ + for($j = 0; $j < $cols; $j++){ + $seats_map[$i][$j] = $seats[$x]->getState(); + } + } + } + $html ='+ '; + for($j = 1; $j <= $cols; $j++){ + $html .= ' | '.$j.' | + '; + } + $html .= '|
---|---|---|
'.$i.' | + '; + for($j = 1; $j <= $cols; $j++){ + if($seats_map[$i][$j] >= 0){ + $html .= '+ ';} + else { + $html .= ' | + ';} + } + $html .=' |