Add files via upload

This commit is contained in:
Fernando Méndez 2021-06-02 23:32:13 +02:00 committed by GitHub
parent b65220dee8
commit 0494c611b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -6,9 +6,9 @@
} }
.check_box:checked+label{ .check_box:checked+label{
background:url('../../img/seat_red.png') no-repeat; background:url('../../img/seat_grey.png') no-repeat;
} }
.check_box:disabled+label{ .check_box:disabled+label{
background:url('../../img/seat_grey.png') no-repeat; background:url('../../img/seat_red.png') no-repeat;
} }

View File

@ -15,11 +15,13 @@ include_once($prefix.'assets/php/includes/user.php');
class FormPurchase extends Form { class FormPurchase extends Form {
//Atributes: //Atributes:
private $film; // Film to be purchased.
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 $seat; // Seat of the film to be purchased. private $seat; // Seat of the film to be purchased.
private $row; // Row of the seat. private $row; // Row of the seat.
private $col; // Column 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.
@ -45,7 +47,7 @@ class FormPurchase extends Form {
for($i = 0; $i <= $rows; $i++){ for($i = 0; $i <= $rows; $i++){
for($j = 0; $j <= $cols; $j++){ for($j = 0; $j <= $cols; $j++){
$seat = $i.$j; $seat = $i.$j;
if(isset($_POST["checkbox".$seat])){ $this->seat = "(Fila) ".$i." - (Columna) ".$j; } if(isset($_POST["checkbox".$seat])){ $this->seat = "(Fila) ".$i." - (Columna) ".$j; $this->row = $i; $this->col = $j; }
} }
} }
@ -122,6 +124,8 @@ class FormPurchase extends Form {
</fieldset> </fieldset>
<div class='actions'> <div class='actions'>
<input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' /> <input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' />
<input type='hidden' name='row' id='row' value='".$this->row."' />
<input type='hidden' name='col' id='col' value='".$this->col."' />
<input type='submit' id='submit' value='Pagar' class='primary' /> <input type='submit' id='submit' value='Pagar' class='primary' />
<input type='reset' id='reset' value='Borrar' /> <input type='reset' id='reset' value='Borrar' />
</div> </div>
@ -164,8 +168,8 @@ class FormPurchase extends Form {
if (count($result) === 0) { if (count($result) === 0) {
if(isset($_SESSION["login"]) && $_SESSION["login"] == true){ if(isset($_SESSION["login"]) && $_SESSION["login"] == true){
$purchaseDAO = new PurchaseDAO("complucine"); $purchaseDAO = new PurchaseDAO("complucine");
if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), date("Y-m-d H:i:s"))){ if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], date("Y-m-d H:i:s"))){
$purchase = new Purchase(unserialize($_SESSION["user"])->getId(), $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(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], 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);
@ -174,7 +178,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(), $datos["row"], $datos["col"], 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";