Add files via upload
This commit is contained in:
parent
d9992fde93
commit
6e18e93fc2
@ -701,7 +701,7 @@ form select {
|
||||
font-weight: 400px;
|
||||
color: #1f2c3d;
|
||||
line-height: 1.3;
|
||||
padding: .3em 1.4em .3em .4em;
|
||||
padding: 0.2em 0.2em 0.2em 0.2em;
|
||||
width: 75px;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
@ -694,7 +694,7 @@ form select {
|
||||
font-weight: 400px;
|
||||
color: #1f2c3d;
|
||||
line-height: 1.3;
|
||||
padding: .3em 1.4em .3em .4em;
|
||||
padding: 0.2em 0.2em 0.2em 0.2em;
|
||||
width: 75px;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
@ -101,7 +101,7 @@ table.seat td:first-child {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.tablelist li:nth-child(3n+)
|
||||
.tablelist li:nth-child(3n)
|
||||
{
|
||||
clear: both;
|
||||
}
|
||||
|
47
assets/js/selectTicket.js
Normal file
47
assets/js/selectTicket.js
Normal file
@ -0,0 +1,47 @@
|
||||
// Método 1: recargar la página y enviar un GET.
|
||||
window.onload = function(){
|
||||
var select = document.getElementById("select_cinema");
|
||||
select.onchange = function(){
|
||||
location.href += "&cinema=" + $('select[id=cinemas]').val();
|
||||
}
|
||||
}
|
||||
|
||||
// Método 2: enviar una petición AJAX con POST. (NO FUNCIONA)
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
$("#select_cinema_session").change(function(){
|
||||
var cinema = $('select[id=cinemas]').val();
|
||||
//console.log($('select[id=cinemas]').val());
|
||||
$.ajax({
|
||||
url : 'index.php',
|
||||
type : 'POST',
|
||||
dataType : 'text',
|
||||
data : 'cinema='+cinema,
|
||||
cache : false,
|
||||
async : false,
|
||||
success: function(data){
|
||||
$("cinemas option").remove();
|
||||
$("cinemas").append(data);
|
||||
console.log(cinema);
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
console.log(response + ' ==> Error al seleccionar el cine')
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
//Método 3: enviar una petición AJAX con GET. (NO FUNCIONA)
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
$("#select_cinema_session").change(function(){
|
||||
var cinema = $('select[id=cinemas]').val();
|
||||
//console.log($('select[id=cinemas]').val());
|
||||
$.get(window.location + "?cinema=" + cinema, function(data,status){
|
||||
console.log(cinema);
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
@ -701,6 +701,7 @@
|
||||
";
|
||||
if($page === "FDI-Cines") echo"<script type='text/javascript' src='{$prefix}assets/js/promotions.js' ></script>\n";
|
||||
if($page === "Panel de Usuario") echo"<script type='text/javascript' src='{$prefix}assets/js/deleteConfirm.js' ></script>\n";
|
||||
if($page === "Comprar Entrada") echo"<script type='text/javascript' src='{$prefix}assets/js/selectTicket.js' ></script>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
153
purchase/_old.index.php
Normal file
153
purchase/_old.index.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
//General Config File:
|
||||
require_once('../assets/php/config.php');
|
||||
|
||||
//Get Film to purchase:
|
||||
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');
|
||||
|
||||
$TODAY = getdate();
|
||||
$TODAY = "$TODAY[mday]"."-"."$TODAY[mon]"."-"."$TODAY[year]";
|
||||
|
||||
$pay = true;
|
||||
$film = null;
|
||||
$cinemas = [];
|
||||
$sessions = [];
|
||||
if(isset($_GET["film"])){
|
||||
$filmDAO = new Film_DAO("complucine");
|
||||
$film = $filmDAO->FilmData($_GET["film"]);
|
||||
if($film){
|
||||
$tittle = $film->getTittle();
|
||||
|
||||
$cinemas = $filmDAO->getCinemas($_GET["film"]);
|
||||
if(!empty($cinemas)){
|
||||
$cinemasNames = new ArrayIterator(array());
|
||||
$cinemasIDs = new ArrayIterator(array());
|
||||
foreach($cinemas as $key=>$value){
|
||||
$cinemasIDs[$key] = $value->getId();
|
||||
$cinemasNames[$key] = $value->getName();
|
||||
}
|
||||
$cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
||||
$cinemasIT->attachIterator($cinemasIDs, "cID");
|
||||
$cinemasIT->attachIterator($cinemasNames, "NAME");
|
||||
|
||||
$cinemasListHTML = '<form action="confirm.php" method="post">
|
||||
<select name="cinemas" id="cinemas">';
|
||||
foreach($cinemasIT as $value){
|
||||
if($value == reset($cinemasIT)){
|
||||
$cinemasListHTML .= '<option value="'.$value["cID"].'" selected>'.$value["NAME"].'</option>';
|
||||
} else {
|
||||
$cinemasListHTML .='<option value="'.$value["cID"].'">'.$value["NAME"].'</option>';
|
||||
}
|
||||
}
|
||||
$cinemasListHTML .= '</select>';
|
||||
} else {
|
||||
$cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select></form>';
|
||||
}
|
||||
|
||||
$fiml_id = $film->getId();
|
||||
$cinema_id = $value["cID"];
|
||||
|
||||
$sessionsDAO = new SessionDAO("complucine");
|
||||
$sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id);
|
||||
if(!empty($sessions)){
|
||||
$sessionsDates = new ArrayIterator(array());
|
||||
$sessionsStarts = new ArrayIterator(array());
|
||||
$sessionsHalls = new ArrayIterator(array());
|
||||
$sessionsIDs = new ArrayIterator(array());
|
||||
foreach($sessions as $key=>$value){
|
||||
$sessionsIDs[$key] = $value->getId();
|
||||
$sessionsDates[$key] = date_format(date_create($value->getDate()), 'j-n-Y');
|
||||
$sessionsHalls[$key] = $value->getIdhall();
|
||||
$sessionsStarts[$key] = $value->getStartTime();
|
||||
}
|
||||
$sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
||||
$sessionsIT->attachIterator($sessionsIDs, "sID");
|
||||
$sessionsIT->attachIterator($sessionsDates, "DATE");
|
||||
$sessionsIT->attachIterator($sessionsHalls, "HALL");
|
||||
$sessionsIT->attachIterator($sessionsStarts, "HOUR");
|
||||
|
||||
$count = 0;
|
||||
$sessionsListHTML = '<select name="sessions" id="sessions">';
|
||||
foreach ($sessionsIT as $value) {
|
||||
if($TODAY <= $value["DATE"]){
|
||||
if($value === reset($sessionsIT)){
|
||||
$sessionsListHTML .= '<option value="'.$value["sID"].'" >Fecha: '.$value["DATE"].' | Hora: '.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
} else {
|
||||
$sessionsListHTML .='<option value="'.$value["sID"].'">Fecha: '.$value["DATE"].' | Hora:'.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$sessionsListHTML .= '</select>';
|
||||
|
||||
if($count == 0) {
|
||||
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
|
||||
$pay = false;
|
||||
}
|
||||
} else {
|
||||
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
|
||||
$pay = false;
|
||||
}
|
||||
|
||||
//$session_id = $value["sID"];
|
||||
//$hall_id = $value["HALL"];
|
||||
//$date_ = $value["DATE"];
|
||||
//$hour_ = $value["HOUR"];
|
||||
|
||||
//Reply: Depends on whether the purchase is to be made from a selected movie or a cinema.
|
||||
$reply = '<div class="column left">
|
||||
<h2>Película seleccionada: '.str_replace('_', ' ', $tittle).'</h2><hr />
|
||||
<div class="image"><img src="'.$prefix.'img/films/'.$tittle.'.jpg" alt="'.$tittle.'" /></div>
|
||||
<p>Duración: '.$film->getDuration().' minutos</p>
|
||||
<p>Idioma: '.$film->getLanguage().'</p>
|
||||
</div>
|
||||
<div class="column right">
|
||||
<h2>Seleccione un Cine y una Sesión</h2><hr />
|
||||
<h3>Cines</h3>
|
||||
'.$cinemasListHTML.'
|
||||
<h3>Sesiones</h3>
|
||||
'.$sessionsListHTML.'
|
||||
</div>
|
||||
';
|
||||
} else {
|
||||
$reply = '<h1>No existe la película.</h1>';
|
||||
$pay = false;
|
||||
}
|
||||
} else if(isset($_GET["cinema"])) {
|
||||
$reply = '<h1>ESTAMOS TRABAJANDO EN ELLO</h1>';
|
||||
$pay = false;
|
||||
} else {
|
||||
$reply = '<h1>No se ha encontrado película ni cine.</h1>';
|
||||
$pay = false;
|
||||
}
|
||||
|
||||
|
||||
//Pay button:
|
||||
if($pay){
|
||||
$pay = '<input type="submit" id="submit" value="Pagar" />
|
||||
</form>';
|
||||
} else {
|
||||
$pay = '</form>';
|
||||
}
|
||||
//Page-specific content:
|
||||
$section = '<!-- Purchase -->
|
||||
<section id="purchase">
|
||||
<div class="row">
|
||||
<section class="code purchase">
|
||||
'.$reply.'
|
||||
</section>
|
||||
<section class="code purchase">
|
||||
'.$pay.'
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
';
|
||||
|
||||
//General page content:
|
||||
require RAIZ_APP.'/HTMLtemplate.php';
|
||||
?>
|
50
purchase/includes/formSelectTicket.php
Normal file
50
purchase/includes/formSelectTicket.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
include_once($prefix.'assets/php/form.php');
|
||||
include_once($prefix.'assets/php/includes/session_dao.php');
|
||||
include_once($prefix.'assets/php/includes/session.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');
|
||||
|
||||
class FormSelectTicket extends Form {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct('formSelectTicket');
|
||||
}
|
||||
|
||||
protected function generaCamposFormulario($datos, $errores = array()){
|
||||
|
||||
// Se generan los mensajes de error si existen.
|
||||
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
|
||||
//$errorNombre = self::createMensajeError($errores, 'name', 'span', array('class' => 'error'));
|
||||
|
||||
$html = "";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function procesaFormulario($datos){
|
||||
$result = array();
|
||||
|
||||
//$nombre = $this->test_input($datos['name']) ?? null;
|
||||
$nombre = $datos['name'] ?? null;
|
||||
$nombre = strtolower($nombre);
|
||||
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 15 ) {
|
||||
$result['name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 15 caracteres.";
|
||||
}
|
||||
|
||||
//$password = $this->test_input($datos['pass']) ?? null;
|
||||
$password = $datos['pass'] ?? null;
|
||||
if ( empty($password) || mb_strlen($password) < 4 ) {
|
||||
$result['pass'] = "El password tiene que tener\n una longitud de al menos\n 4 caracteres.";
|
||||
}
|
||||
|
||||
if (count($result) === 0) {
|
||||
$result[] = "La compra aun está en desarrollo. Vuelva en unos días.";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
@ -15,6 +15,7 @@
|
||||
|
||||
$pay = true;
|
||||
$film = null;
|
||||
$cinema = null;
|
||||
$cinemas = [];
|
||||
$sessions = [];
|
||||
if(isset($_GET["film"])){
|
||||
@ -24,6 +25,7 @@
|
||||
$tittle = $film->getTittle();
|
||||
|
||||
$cinemas = $filmDAO->getCinemas($_GET["film"]);
|
||||
$cinema_id = $_GET["cinema"];
|
||||
if(!empty($cinemas)){
|
||||
$cinemasNames = new ArrayIterator(array());
|
||||
$cinemasIDs = new ArrayIterator(array());
|
||||
@ -35,70 +37,78 @@
|
||||
$cinemasIT->attachIterator($cinemasIDs, "cID");
|
||||
$cinemasIT->attachIterator($cinemasNames, "NAME");
|
||||
|
||||
$cinemasListHTML = '<form action="confirm.php" method="post">
|
||||
$cinemasListHTML = '<form id="select_cinema">
|
||||
<select name="cinemas" id="cinemas">';
|
||||
foreach($cinemasIT as $value){
|
||||
if($value == reset($cinemasIT)){
|
||||
$cinemasListHTML .= '<option value="'.$value["cID"].'" selected>'.$value["NAME"].'</option>';
|
||||
} else {
|
||||
if(!isset($cinema_id)){
|
||||
$cinemasListHTML .= '<option value="" selected>Selecciona un cine</option>';
|
||||
foreach($cinemasIT as $value){
|
||||
$cinemasListHTML .='<option value="'.$value["cID"].'">'.$value["NAME"].'</option>';
|
||||
}
|
||||
} else {
|
||||
foreach($cinemasIT as $value){
|
||||
if($value["cID"] == $cinema_id){
|
||||
$cinemasListHTML .= '<option value="'.$value["cID"].'" selected>'.$value["NAME"].'</option>';
|
||||
} else {
|
||||
$cinemasListHTML .='<option value="'.$value["cID"].'">'.$value["NAME"].'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$cinemasListHTML .= '</select>';
|
||||
$cinemasListHTML .= '</select>
|
||||
</form>';
|
||||
} else {
|
||||
$cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select></form>';
|
||||
}
|
||||
|
||||
$fiml_id = $film->getId();
|
||||
$cinema_id = $value["cID"];
|
||||
|
||||
$sessionsDAO = new SessionDAO("complucine");
|
||||
$sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id);
|
||||
if(!empty($sessions)){
|
||||
$sessionsDates = new ArrayIterator(array());
|
||||
$sessionsStarts = new ArrayIterator(array());
|
||||
$sessionsHalls = new ArrayIterator(array());
|
||||
$sessionsIDs = new ArrayIterator(array());
|
||||
foreach($sessions as $key=>$value){
|
||||
$sessionsIDs[$key] = $value->getId();
|
||||
$sessionsDates[$key] = date_format(date_create($value->getDate()), 'j-n-Y');
|
||||
$sessionsHalls[$key] = $value->getIdhall();
|
||||
$sessionsStarts[$key] = $value->getStartTime();
|
||||
}
|
||||
$sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
||||
$sessionsIT->attachIterator($sessionsIDs, "sID");
|
||||
$sessionsIT->attachIterator($sessionsDates, "DATE");
|
||||
$sessionsIT->attachIterator($sessionsHalls, "HALL");
|
||||
$sessionsIT->attachIterator($sessionsStarts, "HOUR");
|
||||
|
||||
$count = 0;
|
||||
$sessionsListHTML = '<select name="sessions" id="sessions">';
|
||||
foreach ($sessionsIT as $value) {
|
||||
if($TODAY <= $value["DATE"]){
|
||||
if($value === reset($sessionsIT)){
|
||||
$sessionsListHTML .= '<option value="'.$value["sID"].'" >Fecha: '.$value["DATE"].' | Hora: '.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
} else {
|
||||
$sessionsListHTML .='<option value="'.$value["sID"].'">Fecha: '.$value["DATE"].' | Hora:'.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
}
|
||||
$count++;
|
||||
if(isset($cinema_id)){
|
||||
$sessionsDAO = new SessionDAO("complucine");
|
||||
$sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id);
|
||||
if(!empty($sessions)){
|
||||
$sessionsDates = new ArrayIterator(array());
|
||||
$sessionsStarts = new ArrayIterator(array());
|
||||
$sessionsHalls = new ArrayIterator(array());
|
||||
$sessionsIDs = new ArrayIterator(array());
|
||||
foreach($sessions as $key=>$value){
|
||||
$sessionsIDs[$key] = $value->getId();
|
||||
$sessionsDates[$key] = date_format(date_create($value->getDate()), 'j-n-Y');
|
||||
$sessionsHalls[$key] = $value->getIdhall();
|
||||
$sessionsStarts[$key] = $value->getStartTime();
|
||||
}
|
||||
}
|
||||
$sessionsListHTML .= '</select>';
|
||||
$sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
||||
$sessionsIT->attachIterator($sessionsIDs, "sID");
|
||||
$sessionsIT->attachIterator($sessionsDates, "DATE");
|
||||
$sessionsIT->attachIterator($sessionsHalls, "HALL");
|
||||
$sessionsIT->attachIterator($sessionsStarts, "HOUR");
|
||||
|
||||
if($count == 0) {
|
||||
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
|
||||
$count = 0;
|
||||
$sessionsListHTML = '<form id="select_session" action="confirm.php" method="post">
|
||||
<select name="sessions" id="sessions">';
|
||||
foreach ($sessionsIT as $value) {
|
||||
if($TODAY <= $value["DATE"]){
|
||||
if($value === reset($sessionsIT)){
|
||||
$sessionsListHTML .= '<option value="'.$value["sID"].'" >Fecha: '.$value["DATE"].' | Hora: '.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
} else {
|
||||
$sessionsListHTML .='<option value="'.$value["sID"].'">Fecha: '.$value["DATE"].' | Hora:'.$value["HOUR"].' | Sala: '.$value["HALL"].'</option>';
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$sessionsListHTML .= '</select>';
|
||||
|
||||
if($count == 0) {
|
||||
$sessionsListHTML = '<form><select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select></form>';
|
||||
$pay = false;
|
||||
}
|
||||
} else {
|
||||
$sessionsListHTML = '<form><select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select></form>';
|
||||
$pay = false;
|
||||
}
|
||||
} else {
|
||||
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
|
||||
$sessionsListHTML = '<form><select name="sessions"><option value="" selected>Seleccione primero un cine.</option></select></form>';
|
||||
$pay = false;
|
||||
}
|
||||
|
||||
//$session_id = $value["sID"];
|
||||
//$hall_id = $value["HALL"];
|
||||
//$date_ = $value["DATE"];
|
||||
//$hour_ = $value["HOUR"];
|
||||
|
||||
//Reply: Depends on whether the purchase is to be made from a selected movie or a cinema.
|
||||
$reply = '<div class="column left">
|
||||
<h2>Película seleccionada: '.str_replace('_', ' ', $tittle).'</h2><hr />
|
||||
@ -126,14 +136,12 @@
|
||||
$pay = false;
|
||||
}
|
||||
|
||||
|
||||
//Pay button:
|
||||
if($pay){
|
||||
$pay = '<input type="submit" id="submit" value="Pagar" />
|
||||
</form>';
|
||||
} else {
|
||||
$pay = '</form>';
|
||||
</form>';
|
||||
}
|
||||
|
||||
//Page-specific content:
|
||||
$section = '<!-- Purchase -->
|
||||
<section id="purchase">
|
||||
|
Loading…
Reference in New Issue
Block a user