diff --git a/assets/php/includes/film.php b/assets/php/includes/film.php index f34a40d..ca812c5 100644 --- a/assets/php/includes/film.php +++ b/assets/php/includes/film.php @@ -8,7 +8,7 @@ private $_duration; //Film duration. private $_language; //Film language. private $_description; //Film description. - private $_img; + private $_img; //Film image. //Constructor: function __construct($id, $tittle, $duration, $language, $description, $img){ diff --git a/assets/php/includes/hall.php b/assets/php/includes/hall.php index 173b29e..2425273 100644 --- a/assets/php/includes/hall.php +++ b/assets/php/includes/hall.php @@ -5,12 +5,12 @@ class Hall{ //Attributes: - private $_number; //Room number. - private $_idcinema; //Cinema Id - private $_numRows; //Num rows. - private $_numCol; //Num columns. - private $_total_seats; - private $_seats_map; + private $_number; //Room number. + private $_idcinema; //Cinema Id + private $_numRows; //Num rows. + private $_numCol; //Num columns. + private $_total_seats; //Toal seats. + private $_seats_map; //Seat map. //Constructor: function __construct($number, $idcinema, $numRows, $numCol, $total_seats, $seats_map){ diff --git a/assets/php/includes/seat.php b/assets/php/includes/seat.php index 54a7e0b..122e212 100644 --- a/assets/php/includes/seat.php +++ b/assets/php/includes/seat.php @@ -4,11 +4,11 @@ class Seat{ //Attributes: - private $_idhall; - private $_idcinema; - private $_numRow; - private $_numCol; - private $_state; + private $_idhall; //Hall id. + private $_idcinema; //Cinema id. + private $_numRow; //Number of row. + private $_numCol; //Number of column. + private $_state; //State of the seat- //Constructor: function __construct($idhall, $idcinema, $numRow, $numCol, $state){ diff --git a/assets/php/includes/user.php b/assets/php/includes/user.php index 213e3bf..777b089 100644 --- a/assets/php/includes/user.php +++ b/assets/php/includes/user.php @@ -6,7 +6,7 @@ private $_username; //User name. private $_email; //User email. private $_password; //User password. - private $_rol; //Type of user: user | manager | admin. --> Será eliminado en la siguiente práctica para usar el modelo relacional de nuestra BD. + private $_rol; //Type of user: user | manager | admin. //Constructor: function __construct($id, $username, $email, $password, $rol){ diff --git a/panel_user/panelUser.php b/panel_user/panelUser.php index 336b5af..23c0786 100644 --- a/panel_user/panelUser.php +++ b/panel_user/panelUser.php @@ -126,15 +126,15 @@ $filmDAO = new Film_DAO("complucine"); $film = $filmDAO->FilmData($session->getIdfilm()); - if($i%3 === 0){ + if($i%3 === 0 && $i !== 0){ if($i !== 0) $purchasesHTML .= ' '; - $purchasesHTML .= '
+ $purchasesHTML .= '
'; } else { if($i !== 0) $purchasesHTML .= '
'; - $purchasesHTML .= '
+ $purchasesHTML .= '
'; } $purchasesHTML .= '

Compara realizada el: '.$dates[$i].'


diff --git a/purchase/includes/formPurchase.php b/purchase/includes/formPurchase.php index d9f0e03..25c69ef 100644 --- a/purchase/includes/formPurchase.php +++ b/purchase/includes/formPurchase.php @@ -18,7 +18,8 @@ class FormPurchase extends Form { private $session; // Session of the film to be purchased. private $cinema; // Cinema of the film to be purchased. private $hall; // Hall of the film to be purchased. - private $film; // Film to be purchased. + private $seat; // Seat of the film to be purchased. + private $row; // Row of the seat. private $years; // Actual year. private $months; // Months of the year. private $_TODAY; // Actual date. @@ -38,6 +39,16 @@ class FormPurchase extends Form { $hallDAO = new HallDAO("complucine"); $this->hall = $hallDAO->HallData($this->session->getIdhall()); + + $rows = $this->hall->getNumRows(); + $cols = $this->hall->getNumCol(); + for($i = 0; $i <= $rows; $i++){ + for($j = 0; $j <= $cols; $j++){ + $seat = $i.$j; + if(isset($_POST["checkbox".$seat])){ $this->seat = $seat; } + } + } + $TODAY = getdate(); $year = "$TODAY[year]"; @@ -83,7 +94,7 @@ class FormPurchase extends Form {

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

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

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

-

Asiento: ".$_POST["checkbox11"]."

+

Asiento: ".$this->seat."

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

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

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

@@ -163,7 +174,7 @@ class FormPurchase extends Form { $result[] = "Error al realizar la compra."; } } else { - $purchase = new Purchase("null", $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), strftime("%A %e de %B de %Y a las %H:%M")); + $purchase = new Purchase("null", $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), strftime("%A %e de %B de %Y a las %H:%M")); $_SESSION["purchase"] = serialize($purchase); $_SESSION["film_purchase"] = serialize($this->film); $result = "resume.php"; diff --git a/purchase/includes/formSelectSeat.php b/purchase/includes/formSelectSeat.php index 755bd39..e1efa27 100644 --- a/purchase/includes/formSelectSeat.php +++ b/purchase/includes/formSelectSeat.php @@ -42,11 +42,9 @@ class FormSelectSeat extends Form { //$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(); - } + for($i = 1; $i <= $rows; $i++){ + for($j = 1; $j <= $cols; $j++){ + $seats_map[$i][$j] = $seats[$i]->getState(); } } $html ='

Seleccionar un Asiento


@@ -73,7 +71,7 @@ class FormSelectSeat extends Form { $html .= '