Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-24 12:46:52 +02:00 committed by GitHub
parent 8b86f15a68
commit 7e29154220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,21 +18,22 @@
$cinemas = $filmDAO->getCinemas($_GET["film"]); $cinemas = $filmDAO->getCinemas($_GET["film"]);
if(!empty($cinemas)){ if(!empty($cinemas)){
$cinemasNames = array(); $cinemasNames = new ArrayIterator(array());
$cinemasIDs = 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, "ID");
$cinemasIT->attachIterator($cinemasNames, "NAME");
$cinemasListHTML = '<select name="cinemas">'; $cinemasListHTML = '<select name="cinemas">';
foreach($cinemasNames as $value){ foreach($cinemasIT as $value){
foreach($cinemasIDs as $id){ if($value == reset($cinemasIT)){
if($value == reset($cinemasNames)){ $cinemasListHTML .= '<option value="'.$value["ID"].'" selected>'.$value["NAME"].'</option>';
$cinemasListHTML .= '<option value="'.$id.'" selected>'.$value.'</option>';
} else { } else {
$cinemasListHTML .='<option value="'.$id.'">'.$value.'</option>'; $cinemasListHTML .='<option value="'.$value["ID"].'">'.$value["NAME"].'</option>';
}
} }
} }
$cinemasListHTML .= '</select>'; $cinemasListHTML .= '</select>';
@ -41,7 +42,7 @@
} }
$cinemaDAO = new Cinema_DAO("complucine"); $cinemaDAO = new Cinema_DAO("complucine");
$sessions = $cinemaDAO->getSessions($id); $sessions = $cinemaDAO->getSessions($value["ID"]);
if(!empty($sessions)){ if(!empty($sessions)){
$sessionsDates = new ArrayIterator(array()); $sessionsDates = new ArrayIterator(array());
$sessionsStarts = new ArrayIterator(array()); $sessionsStarts = new ArrayIterator(array());
@ -64,19 +65,6 @@
$sessionsListHTML .='<option value="'.$value["ID"].'">'.$value["DATE"].' | '.$value["HOUR"].'</option>'; $sessionsListHTML .='<option value="'.$value["ID"].'">'.$value["DATE"].' | '.$value["HOUR"].'</option>';
} }
} }
/*
foreach($sessionsDates as $value){
foreach($sessionsStarts as $start){
foreach($sessionsIDs as $id){
if($value == reset($sessionsDates)){
$sessionsListHTML .= '<option value="'.$id.'" selected>'.$value.' | '.$start.'</option>';
} else {
$sessionsListHTML .='<option value="'.$id.'">'.$value.' | '.$start.'</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>';