Add files via upload

This commit is contained in:
Fernando Méndez 2021-06-02 17:42:58 +02:00 committed by GitHub
parent 85a0ff411d
commit 987fc1a641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 25 deletions

View File

@ -8,7 +8,7 @@
private $_duration; //Film duration. private $_duration; //Film duration.
private $_language; //Film language. private $_language; //Film language.
private $_description; //Film description. private $_description; //Film description.
private $_img; private $_img; //Film image.
//Constructor: //Constructor:
function __construct($id, $tittle, $duration, $language, $description, $img){ function __construct($id, $tittle, $duration, $language, $description, $img){

View File

@ -5,12 +5,12 @@
class Hall{ class Hall{
//Attributes: //Attributes:
private $_number; //Room number. private $_number; //Room number.
private $_idcinema; //Cinema Id private $_idcinema; //Cinema Id
private $_numRows; //Num rows. private $_numRows; //Num rows.
private $_numCol; //Num columns. private $_numCol; //Num columns.
private $_total_seats; private $_total_seats; //Toal seats.
private $_seats_map; private $_seats_map; //Seat map.
//Constructor: //Constructor:
function __construct($number, $idcinema, $numRows, $numCol, $total_seats, $seats_map){ function __construct($number, $idcinema, $numRows, $numCol, $total_seats, $seats_map){

View File

@ -4,11 +4,11 @@
class Seat{ class Seat{
//Attributes: //Attributes:
private $_idhall; private $_idhall; //Hall id.
private $_idcinema; private $_idcinema; //Cinema id.
private $_numRow; private $_numRow; //Number of row.
private $_numCol; private $_numCol; //Number of column.
private $_state; private $_state; //State of the seat-
//Constructor: //Constructor:
function __construct($idhall, $idcinema, $numRow, $numCol, $state){ function __construct($idhall, $idcinema, $numRow, $numCol, $state){

View File

@ -6,7 +6,7 @@
private $_username; //User name. private $_username; //User name.
private $_email; //User email. private $_email; //User email.
private $_password; //User password. 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: //Constructor:
function __construct($id, $username, $email, $password, $rol){ function __construct($id, $username, $email, $password, $rol){

View File

@ -126,15 +126,15 @@
$filmDAO = new Film_DAO("complucine"); $filmDAO = new Film_DAO("complucine");
$film = $filmDAO->FilmData($session->getIdfilm()); $film = $filmDAO->FilmData($session->getIdfilm());
if($i%3 === 0){ if($i%3 === 0 && $i !== 0){
if($i !== 0) $purchasesHTML .= '</div> if($i !== 0) $purchasesHTML .= '</div>
'; ';
$purchasesHTML .= '<div class="column left"> $purchasesHTML .= '<div class="column right">
'; ';
} else { } else {
if($i !== 0) $purchasesHTML .= '</div> if($i !== 0) $purchasesHTML .= '</div>
'; ';
$purchasesHTML .= '<div class="column right"> $purchasesHTML .= '<div class="column left">
'; ';
} }
$purchasesHTML .= '<h1>Compara realizada el: '.$dates[$i].'</h1><hr /> $purchasesHTML .= '<h1>Compara realizada el: '.$dates[$i].'</h1><hr />

View File

@ -18,7 +18,8 @@ class FormPurchase extends Form {
private $session; // Session of the film to be purchased. private $session; // Session of the film to be purchased.
private $cinema; // Cinema 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 $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 $years; // Actual year.
private $months; // Months of the year. private $months; // Months of the year.
private $_TODAY; // Actual date. private $_TODAY; // Actual date.
@ -38,6 +39,16 @@ class FormPurchase extends Form {
$hallDAO = new HallDAO("complucine"); $hallDAO = new HallDAO("complucine");
$this->hall = $hallDAO->HallData($this->session->getIdhall()); $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(); $TODAY = getdate();
$year = "$TODAY[year]"; $year = "$TODAY[year]";
@ -83,7 +94,7 @@ class FormPurchase extends Form {
<p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p> <p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p>
<p>Cine: ".$this->cinema->getName()."</p> <p>Cine: ".$this->cinema->getName()."</p>
<p>Sala: ".$this->session->getIdhall()."</p> <p>Sala: ".$this->session->getIdhall()."</p>
<p>Asiento: ".$_POST["checkbox11"]."</p> <p>Asiento: ".$this->seat."</p>
<p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p> <p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
<p>Hora: ".$this->session->getStartTime()."</p> <p>Hora: ".$this->session->getStartTime()."</p>
<p>Precio: ".$this->session->getSeatPrice()."</p> <p>Precio: ".$this->session->getSeatPrice()."</p>
@ -163,7 +174,7 @@ class FormPurchase extends Form {
$result[] = "Error al realizar la compra."; $result[] = "Error al realizar la compra.";
} }
} else { } 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["purchase"] = serialize($purchase);
$_SESSION["film_purchase"] = serialize($this->film); $_SESSION["film_purchase"] = serialize($this->film);
$result = "resume.php"; $result = "resume.php";

View File

@ -42,11 +42,9 @@ class FormSelectSeat extends Form {
//$seats = $hall->getTotalSeats(); //$seats = $hall->getTotalSeats();
$seats_map = array(); $seats_map = array();
for($x = 0; $x < $hall->getTotalSeats(); $x++){ for($i = 1; $i <= $rows; $i++){
for($i = 0; $i < $rows; $i++){ for($j = 1; $j <= $cols; $j++){
for($j = 0; $j < $cols; $j++){ $seats_map[$i][$j] = $seats[$i]->getState();
$seats_map[$i][$j] = $seats[$x]->getState();
}
} }
} }
$html ='<h2>Seleccionar un Asiento</h2><hr /> $html ='<h2>Seleccionar un Asiento</h2><hr />
@ -73,7 +71,7 @@ class FormSelectSeat extends Form {
$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" checked> <label for="checkbox'.$i.$j.'"> </td> $html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" checked> <label for="checkbox'.$i.$j.'"> </td>
';} ';}
else { else {
$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" > <label for="checkbox'.$i.$j.'"> </td> $html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" disabled> <label for="checkbox'.$i.$j.'"> </td>
';} ';}
} }
$html .='</tr>'; $html .='</tr>';

View File

@ -18,6 +18,8 @@
$cinemaDAO = new Cinema_DAO("complucine"); $cinemaDAO = new Cinema_DAO("complucine");
$cinema = $cinemaDAO->cinemaData($purchase->getCinemaId()); $cinema = $cinemaDAO->cinemaData($purchase->getCinemaId());
$seat = 1; //$_POST[];
unset($_SESSION["purchase"]); unset($_SESSION["purchase"]);
unset($_SESSION["film_purchase"]); unset($_SESSION["film_purchase"]);
@ -34,6 +36,7 @@
<p>Sesión (Hora): ".$session->getStartTime()."</p> <p>Sesión (Hora): ".$session->getStartTime()."</p>
<p>Cine: ".$cinema->getName()."</p> <p>Cine: ".$cinema->getName()."</p>
<p>Sala: ".$purchase->getHallId()."</p> <p>Sala: ".$purchase->getHallId()."</p>
<p>Asiento: ".$seat."</p>
<p>Asiento (Columna): ".$purchase->getRow()."</p> <p>Asiento (Columna): ".$purchase->getRow()."</p>
<p>Asiento (Fila): ".$purchase->getColumn()."</p> <p>Asiento (Fila): ".$purchase->getColumn()."</p>
<p>Fecha de la Compra: ".$purchase->getTime()."</p> <p>Fecha de la Compra: ".$purchase->getTime()."</p>