Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-24 13:28:35 +02:00 committed by GitHub
parent 7e29154220
commit 5732adfec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 9 deletions

3
purchase/confirm.php Normal file
View File

@ -0,0 +1,3 @@
<?php
?>

View File

@ -11,6 +11,7 @@
$film = null; $film = null;
$cinemas = []; $cinemas = [];
$sessions = [];
if(isset($_GET["film"])){ if(isset($_GET["film"])){
$filmDAO = new Film_DAO("complucine"); $filmDAO = new Film_DAO("complucine");
$film = $filmDAO->FilmData($_GET["film"]); $film = $filmDAO->FilmData($_GET["film"]);
@ -25,15 +26,15 @@
$cinemasNames[$key] = $value->getName(); $cinemasNames[$key] = $value->getName();
} }
$cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); $cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
$cinemasIT->attachIterator($cinemasIDs, "ID"); $cinemasIT->attachIterator($cinemasIDs, "cID");
$cinemasIT->attachIterator($cinemasNames, "NAME"); $cinemasIT->attachIterator($cinemasNames, "NAME");
$cinemasListHTML = '<select name="cinemas">'; $cinemasListHTML = '<select name="cinemas">';
foreach($cinemasIT as $value){ foreach($cinemasIT as $value){
if($value == reset($cinemasIT)){ if($value == reset($cinemasIT)){
$cinemasListHTML .= '<option value="'.$value["ID"].'" selected>'.$value["NAME"].'</option>'; $cinemasListHTML .= '<option value="'.$value["cID"].'" selected>'.$value["NAME"].'</option>';
} else { } else {
$cinemasListHTML .='<option value="'.$value["ID"].'">'.$value["NAME"].'</option>'; $cinemasListHTML .='<option value="'.$value["cID"].'">'.$value["NAME"].'</option>';
} }
} }
$cinemasListHTML .= '</select>'; $cinemasListHTML .= '</select>';
@ -41,34 +42,43 @@
$cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select>'; $cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select>';
} }
$fiml_id = $film->getId();
$cinema_id = $value["cID"];
$cinemaDAO = new Cinema_DAO("complucine"); $cinemaDAO = new Cinema_DAO("complucine");
$sessions = $cinemaDAO->getSessions($value["ID"]); $sessions = $cinemaDAO->getSessions($value["cID"]);
if(!empty($sessions)){ if(!empty($sessions)){
$sessionsDates = new ArrayIterator(array()); $sessionsDates = new ArrayIterator(array());
$sessionsStarts = new ArrayIterator(array()); $sessionsStarts = new ArrayIterator(array());
$sessionsHalls = new ArrayIterator(array());
$sessionsIDs = new ArrayIterator(array()); $sessionsIDs = new ArrayIterator(array());
foreach($sessions as $key=>$value){ foreach($sessions as $key=>$value){
$sessionsIDs[$key] = $value->getId(); $sessionsIDs[$key] = $value->getId();
$sessionsDates[$key] = $value->getDate(); $sessionsDates[$key] = $value->getDate();
$sessionsHalls[$key] = $value->getIdhall();
$sessionsStarts[$key] = $value->getStartTime(); $sessionsStarts[$key] = $value->getStartTime();
} }
$sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); $sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
$sessionsIT->attachIterator($sessionsIDs, "ID"); $sessionsIT->attachIterator($sessionsIDs, "sID");
$sessionsIT->attachIterator($sessionsDates, "DATE"); $sessionsIT->attachIterator($sessionsDates, "DATE");
$sessionsIT->attachIterator($sessionsHalls, "HALL");
$sessionsIT->attachIterator($sessionsStarts, "HOUR"); $sessionsIT->attachIterator($sessionsStarts, "HOUR");
$sessionsListHTML = '<select name="sessions">'; $sessionsListHTML = '<select name="sessions">';
foreach ($sessionsIT as $value) { foreach ($sessionsIT as $value) {
if($value == reset($sessionsIT)){ if($value == reset($sessionsIT)){
$sessionsListHTML .= '<option value="'.$value["ID"].'" selected>'.$value["DATE"].' | '.$value["HOUR"].'</option>'; $sessionsListHTML .= '<option value="'.$value["sID"].'" selected>'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
} else { } else {
$sessionsListHTML .='<option value="'.$value["ID"].'">'.$value["DATE"].' | '.$value["HOUR"].'</option>'; $sessionsListHTML .='<option value="'.$value["sID"].'">'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
} }
} }
$sessionsListHTML .= '</select>'; $sessionsListHTML .= '</select>';
} else { } else {
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>'; $sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
} }
$session_id = $value["sID"];
$hall_id = $value["HALL"];
} }
@ -82,8 +92,8 @@
<div class="column right"> <div class="column right">
<h2>Seleccione un Cine y una Sesión</h2><hr /> <h2>Seleccione un Cine y una Sesión</h2><hr />
<br /><h3>Cines</h3> <br /><h3>Cines</h3>
'.$cinemasListHTML.' '.$cinemasListHTML.'<br />
<h3>Sesiones</h3> <br/><h3>Sesiones</h3>
'.$sessionsListHTML.' '.$sessionsListHTML.'
</div> </div>
'; ';
@ -95,6 +105,15 @@
<section class="code purchase"> <section class="code purchase">
'.$reply.' '.$reply.'
</section> </section>
<section class="code purchase">
<form action="confirm.php" method="post">
<input type="hidden" name="film_id" id="film_id" value='.$fiml_id.' />
<input type="hidden" name="cinema_id" id="cinema_id" value='.$cinema_id.' />
<input type="hidden" name="session_id" id="session_id" value='.$session_id.' />
<input type="hidden" name="hall_id" id="hall_id" value='.$hall_id.' />
<input type="submit" id="submit" value="Pagar" />
</form>
</section>
</div> </div>
</section> </section>
'; ';