From 5758e4e7fccc4461aaea1f23fd9ca24beb8c2ee2 Mon Sep 17 00:00:00 2001 From: OscarRui <79144467+OscarRui@users.noreply.github.com> Date: Thu, 13 May 2021 10:13:03 +0200 Subject: [PATCH] Add files via upload --- panel_manager/includes/formSession.php | 165 +++++++++++++++---------- 1 file changed, 103 insertions(+), 62 deletions(-) diff --git a/panel_manager/includes/formSession.php b/panel_manager/includes/formSession.php index a9bbc5b..052d2fe 100644 --- a/panel_manager/includes/formSession.php +++ b/panel_manager/includes/formSession.php @@ -1,107 +1,148 @@ option = $option; + $options = array("action" => "./?state=".$option); + parent::__construct('formSession',$options); } //TODO Edit session no funciona correctamente con el seleccionar una pelicula distinta, hay que guardar la id de la sesion de alguna forma y usarla o guardar en la sesion - public static function generaCampoFormulario($data, $errores = array()){ + protected function generaCamposFormulario($data, $errores = array()){ + + $filmList = new Film_DAO('complucine'); + $films = $filmList->allFilmData(); - $cinema = $data['cinema'] ?? ''; - $film = $data['film'] ?? ''; - $hall = $data['hall'] ?? ''; - $date = $data['date'] ?? ''; - $start = $data['start'] ?? ''; - $price = $data['price'] ?? ''; - $format = $data['format'] ?? ''; - - $htmlform .= '
-
+ if($this->option == "new_session") { + $cinema = $data['cinema'] ?? $_SESSION["cinema"]; + $film = $data['film'] ?? 1; + $hall = $data['hall'] ?? ''; + $date = $data['date'] ?? ''; + $start = $data['start'] ?? ''; + $price = $data['price'] ?? ''; + $format = $data['format'] ?? ''; + } + else { + $cinema = $data['cinema'] ?? $_SESSION["cinema"]; + $film = $data['film'] ?? $_POST["film"]; + $hall = $data['hall'] ?? $_POST["hall"]; + $date = $data['date'] ?? $_POST["date"]; + $start = $data['start'] ?? $_POST["start"]; + $price = $data['price'] ?? $_POST["price"]; + $format = $data['format'] ?? $_POST["format"]; + } + $or_hall = $data["or_hall"] ?? $hall; + $or_date = $data["or_date"] ?? $date; + $or_start = $data["or_start"] ?? $start; + + $htmlErroresGlobales = self::generaListaErroresGlobales($errores); + $errorPrice = self::createMensajeError($errores, 'price', 'span', array('class' => 'error')); + + $html .= '
+ '.$htmlErroresGlobales.' + '.$errorPrice.'
Datos
+ '.$errorFormat.'
- + +
Horario
+
+
'; if($film){ - if($data['option'] == "new_session") - $htmlform .= '
-
'; + if($this->option == "new_session") + $html .= '
+
'; - if($data['option'] == "edit_session"){ - if(!$_SESSION["or_hall"]) $_SESSION["or_hall"] = $hall; - if(!$_SESSION["or_date"]) $_SESSION["or_date"] = $date; - if(!$_SESSION["or_start"])$_SESSION["or_start"] = $start; - - $htmlform .= ' -
-
'; + if($this->option == "edit_session"){ + $html .= ' +
+
'; } } - $htmlform .= " - - + $html .= ' +
-
"; - if($film["tittle"]){ - $htmlform .= "
-
-
".$film["tittle"]."
-

".str_replace('_', ' ',$film["tittle"])."

-
-
-

".$film["description"]."

-
-

Duración: ".$film["duration"]." minutos

-
-
-"; +
+