Add files via upload
This commit is contained in:
parent
5732adfec9
commit
6625d9787a
@ -9,81 +9,81 @@
|
|||||||
include_once($prefix.'assets/php/includes/cinema.php');
|
include_once($prefix.'assets/php/includes/cinema.php');
|
||||||
include_once($prefix.'assets/php/includes/session.php');
|
include_once($prefix.'assets/php/includes/session.php');
|
||||||
|
|
||||||
|
$pay = true;
|
||||||
$film = null;
|
$film = null;
|
||||||
$cinemas = [];
|
$cinemas = [];
|
||||||
$sessions = [];
|
$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"]);
|
||||||
$tittle = $film->getTittle();
|
if($film){
|
||||||
|
$tittle = $film->getTittle();
|
||||||
|
|
||||||
$cinemas = $filmDAO->getCinemas($_GET["film"]);
|
$cinemas = $filmDAO->getCinemas($_GET["film"]);
|
||||||
if(!empty($cinemas)){
|
if(!empty($cinemas)){
|
||||||
$cinemasNames = new ArrayIterator(array());
|
$cinemasNames = new ArrayIterator(array());
|
||||||
$cinemasIDs = new ArrayIterator(array());
|
$cinemasIDs = new ArrayIterator(array());
|
||||||
foreach($cinemas as $key=>$value){
|
foreach($cinemas as $key=>$value){
|
||||||
$cinemasIDs[$key] = $value->getId();
|
$cinemasIDs[$key] = $value->getId();
|
||||||
$cinemasNames[$key] = $value->getName();
|
$cinemasNames[$key] = $value->getName();
|
||||||
}
|
|
||||||
$cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
|
||||||
$cinemasIT->attachIterator($cinemasIDs, "cID");
|
|
||||||
$cinemasIT->attachIterator($cinemasNames, "NAME");
|
|
||||||
|
|
||||||
$cinemasListHTML = '<select name="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>';
|
|
||||||
}
|
}
|
||||||
}
|
$cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
|
||||||
$cinemasListHTML .= '</select>';
|
$cinemasIT->attachIterator($cinemasIDs, "cID");
|
||||||
} else {
|
$cinemasIT->attachIterator($cinemasNames, "NAME");
|
||||||
$cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select>';
|
|
||||||
}
|
$cinemasListHTML = '<select name="cinemas">';
|
||||||
|
foreach($cinemasIT as $value){
|
||||||
$fiml_id = $film->getId();
|
if($value == reset($cinemasIT)){
|
||||||
$cinema_id = $value["cID"];
|
$cinemasListHTML .= '<option value="'.$value["cID"].'" selected>'.$value["NAME"].'</option>';
|
||||||
|
} else {
|
||||||
$cinemaDAO = new Cinema_DAO("complucine");
|
$cinemasListHTML .='<option value="'.$value["cID"].'">'.$value["NAME"].'</option>';
|
||||||
$sessions = $cinemaDAO->getSessions($value["cID"]);
|
}
|
||||||
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] = $value->getDate();
|
|
||||||
$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");
|
|
||||||
|
|
||||||
$sessionsListHTML = '<select name="sessions">';
|
|
||||||
foreach ($sessionsIT as $value) {
|
|
||||||
if($value == reset($sessionsIT)){
|
|
||||||
$sessionsListHTML .= '<option value="'.$value["sID"].'" selected>'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
|
|
||||||
} else {
|
|
||||||
$sessionsListHTML .='<option value="'.$value["sID"].'">'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
|
|
||||||
}
|
}
|
||||||
|
$cinemasListHTML .= '</select>';
|
||||||
|
} else {
|
||||||
|
$cinemasListHTML = '<select name="cinemas"><option value="" selected>No hay cines disponibles para esta película.</option></select>';
|
||||||
}
|
}
|
||||||
$sessionsListHTML .= '</select>';
|
|
||||||
} else {
|
|
||||||
$sessionsListHTML = '<select name="sessions"><option value="" selected>No hay sesiones disponibles para esta película.</option></select>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$session_id = $value["sID"];
|
$fiml_id = $film->getId();
|
||||||
$hall_id = $value["HALL"];
|
$cinema_id = $value["cID"];
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Reply: Depends on whether the purchase is to be made from a selected movie or a cinema.
|
$cinemaDAO = new Cinema_DAO("complucine");
|
||||||
$reply = '<div class="column left">
|
$sessions = $cinemaDAO->getSessions($value["cID"]);
|
||||||
|
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] = $value->getDate();
|
||||||
|
$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");
|
||||||
|
|
||||||
|
$sessionsListHTML = '<select name="sessions">';
|
||||||
|
foreach ($sessionsIT as $value) {
|
||||||
|
if($value == reset($sessionsIT)){
|
||||||
|
$sessionsListHTML .= '<option value="'.$value["sID"].'" selected>'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
|
||||||
|
} else {
|
||||||
|
$sessionsListHTML .='<option value="'.$value["sID"].'">'.$value["DATE"].' | '.$value["HOUR"].' (Sala: '.$value["HALL"].') '.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sessionsListHTML .= '</select>';
|
||||||
|
} else {
|
||||||
|
$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"];
|
||||||
|
|
||||||
|
//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 />
|
<h2>Película seleccionada: '.str_replace('_', ' ', $tittle).'</h2><hr />
|
||||||
<div class="image"><img src="'.$prefix.'img/films/'.$tittle.'.jpg" alt="'.$tittle.'" /></div>
|
<div class="image"><img src="'.$prefix.'img/films/'.$tittle.'.jpg" alt="'.$tittle.'" /></div>
|
||||||
<p>Duración: '.$film->getDuration().' minutos</p>
|
<p>Duración: '.$film->getDuration().' minutos</p>
|
||||||
@ -97,7 +97,22 @@
|
|||||||
'.$sessionsListHTML.'
|
'.$sessionsListHTML.'
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
} else {
|
||||||
|
$reply = '<h1>No existe la película.</h1>';
|
||||||
|
$pay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Pay button:
|
||||||
|
if($pay){
|
||||||
|
$pay = '<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>';
|
||||||
|
}
|
||||||
//Page-specific content:
|
//Page-specific content:
|
||||||
$section = '<!-- Purchase -->
|
$section = '<!-- Purchase -->
|
||||||
<section id="purchase">
|
<section id="purchase">
|
||||||
@ -106,13 +121,7 @@
|
|||||||
'.$reply.'
|
'.$reply.'
|
||||||
</section>
|
</section>
|
||||||
<section class="code purchase">
|
<section class="code purchase">
|
||||||
<form action="confirm.php" method="post">
|
'.$pay.'
|
||||||
<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>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user