diff --git a/purchase/index.php b/purchase/index.php index 1e11d4b..33d57a7 100644 --- a/purchase/index.php +++ b/purchase/index.php @@ -18,21 +18,22 @@ $cinemas = $filmDAO->getCinemas($_GET["film"]); if(!empty($cinemas)){ - $cinemasNames = array(); - $cinemasIDs = array(); + $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, "ID"); + $cinemasIT->attachIterator($cinemasNames, "NAME"); $cinemasListHTML = ''; @@ -41,7 +42,7 @@ } $cinemaDAO = new Cinema_DAO("complucine"); - $sessions = $cinemaDAO->getSessions($id); + $sessions = $cinemaDAO->getSessions($value["ID"]); if(!empty($sessions)){ $sessionsDates = new ArrayIterator(array()); $sessionsStarts = new ArrayIterator(array()); @@ -64,19 +65,6 @@ $sessionsListHTML .=''; } } - /* - foreach($sessionsDates as $value){ - foreach($sessionsStarts as $start){ - foreach($sessionsIDs as $id){ - if($value == reset($sessionsDates)){ - $sessionsListHTML .= ''; - } else { - $sessionsListHTML .=''; - } - } - } - } - */ $sessionsListHTML .= ''; } else { $sessionsListHTML = '';