From fe520f1495bd47e2765f9a55d5766638d29e7291 Mon Sep 17 00:00:00 2001 From: Markines16 <80280295+Markines16@users.noreply.github.com> Date: Fri, 7 May 2021 13:48:20 +0200 Subject: [PATCH] Eliminadas las interaciones con film y film_dao --- panel_manager/includes/formSession.php | 50 +++++++++++---------- panel_manager/index.php | 3 ++ panel_manager/panel_manager.php | 61 ++++++++++++++++++++------ 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/panel_manager/includes/formSession.php b/panel_manager/includes/formSession.php index 54d3679..854f976 100644 --- a/panel_manager/includes/formSession.php +++ b/panel_manager/includes/formSession.php @@ -2,9 +2,6 @@ require_once($prefix.'assets/php/common/session_dao.php'); require_once($prefix.'assets/php/common/session.php'); require_once($prefix.'assets/php/form.php'); - -require_once($prefix.'assets/php/common/film.php'); -require_once($prefix.'assets/php/common/film_dao.php'); //Receive data from froms and prepare the correct response class FormSession extends Form { @@ -17,22 +14,20 @@ class FormSession extends Form { public static function generaCampoFormulario($data, $errores = array()){ $cinema = $data['cinema'] ?? ''; - $film = $data['film'] ?? '1'; - $hall = $data['hall'] ?? '1'; + $film = $data['film'] ?? ''; + $hall = $data['hall'] ?? ''; $date = $data['date'] ?? ''; $start = $data['start'] ?? ''; $price = $data['price'] ?? ''; $format = $data['format'] ?? ''; - $filmList = new Film_DAO('complucine'); - $films = $filmList->allFilmData(); - $htmlform .= '
Datos

+

'; - if($data['option'] == "edit_session") + if($data['option'] == "edit_session"){ + $_SESSION["session"] = $data['id'] ?? Session::getThisSessionId($cinema, $hall, $start, $date)["id"]; + $htmlform .= '

'; - $htmlform .= ' - + + } + $htmlform .= " +
-
- +
"; + if($film["tittle"]){ + $htmlform .= "
+
+
".$film["tittle"]."
+

".$film["tittle"]."

+
+
+

".$film["description"]."

+
+

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

+
+
+"; + } + $htmlform .= 'Seleccionar una Pelicula
'; return $htmlform; diff --git a/panel_manager/index.php b/panel_manager/index.php index 6a8da3f..1804bee 100644 --- a/panel_manager/index.php +++ b/panel_manager/index.php @@ -38,6 +38,9 @@ break; case "edit_session": $panel = Manager_panel::edit_session(); + break; + case "select_film": + $panel = Manager_panel::select_film($template); break; case "success": $panel = Manager_panel::success(); diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index 0bcbc92..cd81d79 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -7,11 +7,7 @@ class Manager_panel { - function __construct($panel,$log){ - $this->state = $panel; - $this->login = $log; - - } + function __construct(){} static function welcome(){ $name = strtoupper($_SESSION['nombre']); @@ -84,7 +80,7 @@ return $panel; } - + static function manage_sessions(){ //Base filtering values $date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d"); @@ -134,7 +130,7 @@ $panel .=' '.date("H:i", strtotime( $session->getStartTime())).' - '. str_replace('_', ' ', Session::getFilmTitle($session->getIdfilm())) .' + '. str_replace('_', ' ', Session::getThisSessionFilm($session->getIdfilm())["tittle"]) .' '.$session->getFormat().' '.$session->getSeatPrice().' @@ -145,7 +141,7 @@ - + '; } @@ -173,12 +169,51 @@ return $panel; } - static function edit_session(){ - $data = array("option" => "edit_session","hall" => $_POST["hall"],"cinema" => $_SESSION["cinema"],"date" => $_POST['date'],"film" => $_POST['film'],"start" => $_POST['start'],"price" => $_POST['price'],"format" => $_POST['format']); - $panel = '

Editar una sesión.



- '.FormSession::generaCampoFormulario($data, null); + static function edit_session(){ + if(isset($_POST["edit_session"])){ + $film = Session::getThisSessionFilm($_POST["film"]); + $data = array("option" => "edit_session","hall" => $_POST["hall"],"cinema" => $_SESSION["cinema"],"date" => $_POST['date'],"film" => $film, + "start" => $_POST['start'],"price" => $_POST['price'],"format" => $_POST['format']); + + }else if(isset($_SESSION["session"])){ + $session = Session::getThisSessionFromId($_SESSION["session"]); + $_SESSION["session"] = ""; + $film = array("idfilm" => $_POST["id"],"tittle" => $_POST["tittle"], "description" => $_POST["description"], "duration" => $_POST["duration"]); + + echo $film["id"] . " y el titulo es: " . $film["tittle"]; + $data = array("option" => "edit_session","hall" => $session["idhall"],"cinema" => $_SESSION["cinema"],"date" => $session["date"],"film" => $film, + "start" => $session["start_time"],"price" => $session["seat_price"],"format" => $session["format"]); + } + + if($data){ + $panel = '

Editar una sesión.



+ '.FormSession::generaCampoFormulario($data, null); + } else $panel = self::warning(); + return $panel; + } + + static function select_film($template){ + if(isset($_GET["option"])){ + $_SESSION["option"] = $_GET["option"]; + $panel = '

Seleccionar Pelicula.



'; + $panel .= $template->print_fimls(); + $_SESSION["option"] = ""; + } else $panel = self::warning(); return $panel; } + + //Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr + static function warning(){ + $panel = '
+

No deberias poder acceder aqui.

+
+

No uses la url para toquitear cosas >.<

+
'."\n"; + + return $panel; + } + + } -?> +?> \ No newline at end of file