diff --git a/panel_admin/includes/formAddFilm.php b/panel_admin/includes/formAddFilm.php index f0fcc5a..2ddd471 100644 --- a/panel_admin/includes/formAddFilm.php +++ b/panel_admin/includes/formAddFilm.php @@ -49,7 +49,7 @@ class formAddFilm extends Form{ $result = array(); $t = $this->test_input($datos['tittle']) ?? null; - $tittle = str_replace(" ", "_", $t); + $tittle = strtolower(str_replace(" ", "_", $t)); //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle) if ( empty($tittle) ) { $result['tittle'] = "El título no es válido"; diff --git a/purchase/index copy.php b/purchase/index copy.php new file mode 100644 index 0000000..4ff77de --- /dev/null +++ b/purchase/index copy.php @@ -0,0 +1,153 @@ +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 = '
+ '; + } else { + $cinemasListHTML = '
'; + } + + $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 = ''; + + if($count == 0) { + $sessionsListHTML = ''; + $pay = false; + } + } else { + $sessionsListHTML = ''; + $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 = '
+

Película seleccionada: '.str_replace('_', ' ', $tittle).'


+
'.$tittle.'
+

Duración: '.$film->getDuration().' minutos

+

Idioma: '.$film->getLanguage().'

+
+
+

Seleccione un Cine y una Sesión


+

Cines

+ '.$cinemasListHTML.' +

Sesiones

+ '.$sessionsListHTML.' +
+ '; + } else { + $reply = '

No existe la película.

'; + $pay = false; + } + } else if(isset($_GET["cinema"])) { + $reply = '

ESTAMOS TRABAJANDO EN ELLO

'; + $pay = false; + } else { + $reply = '

No se ha encontrado película ni cine.

'; + $pay = false; + } + + + //Pay button: + if($pay){ + $pay = ' + '; + } else { + $pay = ''; + } + //Page-specific content: + $section = ' +
+
+
+ '.$reply.' +
+
+ '.$pay.' +
+
+
+ '; + + //General page content: + require RAIZ_APP.'/HTMLtemplate.php'; +?> diff --git a/purchase/index.php b/purchase/index.php index 65706bc..4ff77de 100644 --- a/purchase/index.php +++ b/purchase/index.php @@ -35,7 +35,8 @@ $cinemasIT->attachIterator($cinemasIDs, "cID"); $cinemasIT->attachIterator($cinemasNames, "NAME"); - $cinemasListHTML = '
'; foreach($cinemasIT as $value){ if($value == reset($cinemasIT)){ $cinemasListHTML .= ''; @@ -43,7 +44,7 @@ $cinemasListHTML .=''; } } - $cinemasListHTML .= '
'; + $cinemasListHTML .= ''; } else { $cinemasListHTML = ''; } @@ -53,7 +54,6 @@ $sessionsDAO = new SessionDAO("complucine"); $sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id); - //print_r($sessions); if(!empty($sessions)){ $sessionsDates = new ArrayIterator(array()); $sessionsStarts = new ArrayIterator(array()); @@ -72,8 +72,7 @@ $sessionsIT->attachIterator($sessionsStarts, "HOUR"); $count = 0; - $sessionsListHTML = '
'; - $sessionsListHTML .= ''; foreach ($sessionsIT as $value) { if($TODAY <= $value["DATE"]){ if($value === reset($sessionsIT)){ @@ -132,6 +131,8 @@ if($pay){ $pay = '
'; + } else { + $pay = ''; } //Page-specific content: $section = '