Add files via upload
This commit is contained in:
parent
6efe3fc241
commit
85a0ff411d
@ -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');
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
//Specific page content:
|
||||
$section = '<!-- Contact Form -->
|
||||
<section id="formulario">
|
||||
<h4>Formulario (EN DESARROLLO)</h4>
|
||||
<h4>Formulario</h4>
|
||||
'.$htmlForm.'
|
||||
</section>
|
||||
';
|
||||
|
@ -129,12 +129,12 @@
|
||||
if($i%3 === 0){
|
||||
if($i !== 0) $purchasesHTML .= '</div>
|
||||
';
|
||||
$purchasesHTML .= '<div class="column right">
|
||||
$purchasesHTML .= '<div class="column left">
|
||||
';
|
||||
} else {
|
||||
if($i !== 0) $purchasesHTML .= '</div>
|
||||
';
|
||||
$purchasesHTML .= '<div class="column left">
|
||||
$purchasesHTML .= '<div class="column right">
|
||||
';
|
||||
}
|
||||
$purchasesHTML .= '<h1>Compara realizada el: '.$dates[$i].'</h1><hr />
|
||||
|
@ -83,6 +83,7 @@ class FormPurchase extends Form {
|
||||
<p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p>
|
||||
<p>Cine: ".$this->cinema->getName()."</p>
|
||||
<p>Sala: ".$this->session->getIdhall()."</p>
|
||||
<p>Asiento: ".$_POST["checkbox11"]."</p>
|
||||
<p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
|
||||
<p>Hora: ".$this->session->getStartTime()."</p>
|
||||
<p>Precio: ".$this->session->getSeatPrice()."€</p>
|
||||
|
@ -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 = '<input type="submit" id="submit" value="Pagar" />';
|
||||
$pay = '<input type="submit" id="submit" value="Seleccionar Asiento" />';
|
||||
}
|
||||
|
||||
return '
|
||||
@ -258,7 +260,7 @@ class FormSelectCinemaSession extends Form {
|
||||
}
|
||||
|
||||
if (count($result) === 0) {
|
||||
$result = "confirm.php";
|
||||
$result = "selectSeat.php";
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
109
purchase/includes/formSelectSeat.php
Normal file
109
purchase/includes/formSelectSeat.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
include_once($prefix.'assets/php/form.php');
|
||||
include_once($prefix.'assets/php/includes/film_dao.php');
|
||||
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');
|
||||
include_once($prefix.'assets/php/includes/hall_dao.php');
|
||||
include_once($prefix.'assets/php/includes/hall.php');
|
||||
include_once($prefix.'assets/php/includes/seat_dao.php');
|
||||
include_once($prefix.'assets/php/includes/seat.php');
|
||||
|
||||
class FormSelectSeat extends Form {
|
||||
|
||||
//Atributes:
|
||||
|
||||
public function __construct() {
|
||||
$options = array("action" => "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 ='<h2>Seleccionar un Asiento</h2><hr />
|
||||
<h3 class="table_title">Pantalla</h3>
|
||||
<table class="seat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
';
|
||||
for($j = 1; $j <= $cols; $j++){
|
||||
$html .= '<th>'.$j.'</th>
|
||||
';
|
||||
}
|
||||
$html .= '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
for($i = 1; $i <= $rows; $i++){
|
||||
$html .= '
|
||||
<tr>
|
||||
<td>'.$i.'</td>
|
||||
';
|
||||
for($j = 1; $j <= $cols; $j++){
|
||||
if($seats_map[$i][$j] >= 0){
|
||||
$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 {
|
||||
$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 .='</tr>';
|
||||
}
|
||||
|
||||
$html .= '
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
//Pay button:
|
||||
$pay = '<input type="hidden" name="sessions" id="sessions" value="'.$_POST["sessions"].'" />
|
||||
<input type="submit" id="submit" value="Pagar" />';
|
||||
|
||||
return '
|
||||
<section class="code purchase">
|
||||
'.$html.'
|
||||
</section>
|
||||
<section class="code purchase">
|
||||
'.$pay.'
|
||||
</section>';
|
||||
}
|
||||
|
||||
protected function procesaFormulario($datos){
|
||||
$result = array();
|
||||
|
||||
if (count($result) === 0) {
|
||||
$result = "confirm.php";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
18
purchase/selectSeat.php
Normal file
18
purchase/selectSeat.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
//General Config File:
|
||||
require_once('../assets/php/config.php');
|
||||
|
||||
//Seats form:
|
||||
require_once('includes/formSelectSeat.php');
|
||||
$form = new FormSelectSeat();
|
||||
$formHTML = $form->gestiona();
|
||||
|
||||
//Page-specific content:
|
||||
$section = '<section class="row">
|
||||
<!-- Seat Form -->
|
||||
'.$formHTML.'
|
||||
</div>';
|
||||
|
||||
//General page content:
|
||||
require RAIZ_APP.'/HTMLtemplate.php';
|
||||
?>
|
Loading…
Reference in New Issue
Block a user