diff --git a/panel_manager/includes/formSession.php b/panel_manager/includes/formSession.php index d8586ae..b1fc898 100644 --- a/panel_manager/includes/formSession.php +++ b/panel_manager/includes/formSession.php @@ -1,6 +1,5 @@ option = $option; $this->cinema = $cinema; + $this->formID = 'formSession1'; + $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 protected function generaCamposFormulario($data, $errores = array()){ - - $filmList = new Film_DAO('complucine'); - $films = $filmList->allFilmData(); - if($this->option == "new_session") { - $film = $data['film'] ?? 1; - $hall = $data['hall'] ?? $_POST["hall"]; - $date = $data['date'] ?? $_POST["date"]; - $start = $data['start'] ?? ''; - $price = $data['price'] ?? ''; - $format = $data['format'] ?? ''; - } - else { - $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"]; - } + $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; - + + $film = $data['film'] ?? $_POST["film"] ?? ""; + $tittle = $data['tittle'] ?? $_POST["tittle"] ?? ""; + $duration = $data['duration'] ?? $_POST["duration"] ?? ""; + $language = $data['language'] ?? $_POST["language"] ?? ""; + $description = $data['description'] ?? $_POST["description"] ?? ""; + $htmlErroresGlobales = self::generaListaErroresGlobales($errores); $errorPrice = self::createMensajeError($errores, 'price', 'span', array('class' => 'error')); $errorFormat = self::createMensajeError($errores, 'format', 'span', array('class' => 'error')); + $errorDate = self::createMensajeError($errores, 'date', 'span', array('class' => 'error')); + $errorStart = self::createMensajeError($errores, 'start', 'span', array('class' => 'error')); $html = ' -
'.$htmlErroresGlobales.' '.$errorPrice.' +
'.$htmlErroresGlobales.'
Datos -
'.$errorFormat.' -
+ '.$errorPrice.' +
' + .$errorFormat.' +
+
+ '.$errorStart.' +
-
+ '.$errorDate.' +
'; @@ -87,22 +89,29 @@ class FormSession extends Form {
'; } } - $html .= ' - + $html .= " + +
-
- '; + $html .= '
+
+'; return $html; } //Methods: @@ -122,10 +131,21 @@ class FormSession extends Form { $or_date = $data["or_date"] ; $or_start = $data["or_start"] ; - if (($price == 0 || empty($price))&& isset($data["sumbit"]) ) { - $result['price'] = "
  • No puede haber 0 euros.

  • "; + if (($price <= 0 || empty($price))&& isset($data["sumbit"]) ) { + $result['price'] = "
  • No puede haber 0 o menos euros.

  • "; + } + + if ((empty($format))&& isset($data["sumbit"]) ) { + $result['format'] = "
  • El formato no puede estar vacio.

  • "; + } + + if ((empty($date))&& isset($data["sumbit"]) ) { + $result['date'] = "
  • No hay una fecha seleccionada.

  • "; + } + + if ((empty($start))&& isset($data["sumbit"]) ) { + $result['start'] = "
  • No hay una hora inicial seleccionada.

  • "; } - if (count($result) === 0 && isset($data["sumbit"]) ) { if($this->option == "new_session"){ diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index 3a3861a..3624b35 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -25,7 +25,7 @@ return $panel; } - + static function welcomeAdmin($manager) { $cinemaList = new Cinema_DAO('complucine'); $cinemas = $cinemaList->allCinemaData(); @@ -56,12 +56,12 @@ "; } } - + $panel .= '
    '; - + return $panel; } @@ -188,14 +188,19 @@ foreach($sessions as $session){ + $film = Session::getThisSessionFilm($session->getIdfilm()); $panel .=' '.date("H:i", strtotime( $session->getStartTime())).' - '. str_replace('_', ' ', Session::getThisSessionFilm($session->getIdfilm())["tittle"]) .' + '. str_replace('_', ' ', $film["tittle"]) .' '.$session->getFormat().' '.$session->getSeatPrice().'
    + + + + @@ -237,8 +242,8 @@ //TODO: estado al modificar sesiones para la seleccion de peliculas usando el template->print films static function select_film($template,$manager){ - if(isset($_GET["option"])){ - $_SESSION["option"] = $_GET["option"]; + if(isset($_POST["select_film"]) && isset($_POST["option"])){ + $_SESSION["option"] = $_POST["option"]; $panel = '

    Seleccionar Pelicula.



    '; $panel .= $template->print_fimls(); $_SESSION["option"] = ""; @@ -252,7 +257,7 @@ $panel = '

    No deberias poder acceder aqui.


    -

    No uses la url para toquitear cosas >.<

    +

    >.<

    '."\n"; return $panel;