diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php index 9733d13..2205825 100644 --- a/panel_manager/includes/formHall.php +++ b/panel_manager/includes/formHall.php @@ -8,7 +8,6 @@ class FormHall extends Form { private $option; private $cinema; private $og_hall; - private $first; //Constructor: public function __construct($option, $cinema, $hall) { @@ -18,9 +17,9 @@ class FormHall extends Form { $this->og_hall = $hall; if($option == "edit_hall") - $this->first = true; - - $options = array("action" => "./?state=".$option."&number=".$hall->getNumber().""); + $options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing"); + else + $options = array("action" => "./?state=".$option."&number=".$hall->getNumber().""); parent::__construct('formHall',$options); } @@ -38,10 +37,9 @@ class FormHall extends Form { $seats_map[$i][$j] = "-1"; } } - + $alltozero = $_POST["alltozero"] ?? 0; //Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form - if(isset($data["restart"]) || $this->first){ - $first = false; + if(!isset($_GET["editing"])){ $rows = $this->og_hall->getNumRows(); $cols = $this->og_hall->getNumCol(); $seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema); @@ -54,7 +52,7 @@ class FormHall extends Form { } } }//Show the checkbox seats_map updated and everything to selected if alltoone was pressed - else{ + else if(!$alltozero){ $alltoone = $_POST["alltoone"] ?? 0; for($i = 1;$i <= $rows; $i++){ for($j = 1; $j <= $cols; $j++){ @@ -81,8 +79,8 @@ class FormHall extends Form {
Mapa de Asientos '.$errorSeats.' '.$errorRows.' '.$errorCols.' -
-
+
+

'; @@ -92,7 +90,7 @@ class FormHall extends Form {

'.$errorNumber.' -
+
'; if($this->option == "new_hall") $html .=' @@ -106,6 +104,7 @@ class FormHall extends Form { $html .='
+

Pantalla

@@ -189,25 +188,29 @@ class FormHall extends Form { $result['number'] = "
  • El numero de sala tiene que ser mayor que 0.

  • "; } + if(isset($datos["restart"])){ + return $result = "./?state=".$this->option."&number=".$this->og_hall->getNumber().""; + } + if (count($result) === 0 && isset($datos["sumbit"]) ) { if($this->option == "new_hall"){ $_SESSION['msg'] = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map); - $result = './?state=success'; + return $result = './?state=success'; } if($this->option == "edit_hall"){ $_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber()); - $result = './?state=success'; + return $result = './?state=success'; } } if (!isset($result['number']) && isset($datos["delete"]) ) { if($this->option == "edit_hall"){ $_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber()); - $result = './?state=success'; + return $result = './?state=success'; } } - + return $result; } } diff --git a/panel_manager/index.php b/panel_manager/index.php index 7341e90..f40a535 100644 --- a/panel_manager/index.php +++ b/panel_manager/index.php @@ -12,64 +12,39 @@ $manager = false; $manager = new Manager(null, null, null, null, null); + $state = isset($_GET['state']) ? $_GET['state'] : ''; switch($state){ case "view_user": - $_SESSION["rol"] = null; - $panel .= "
    -
    -
    -
    -

    ¡ATENCIÓN!


    -

    Está viendo la web como un Usuario NO Registrado.

    - -
    -
    -
    -
    - "; break; case "view_ruser": - $_SESSION["rol"] = "user"; - $panel .= "
    -
    -
    -
    -

    ¡ATENCIÓN!


    -

    Está viendo la web como un Usuario Registrado.

    - -
    -
    -
    -
    - "; break; case "manage_halls": - $panel .= Manager_panel::manage_halls($manager); + $panel = Manager_panel::manage_halls($manager); break; case "new_hall": - $panel .= Manager_panel::new_hall($manager); + $panel = Manager_panel::new_hall($manager); break; case "edit_hall": - $panel .= Manager_panel::edit_hall($manager); + $panel = Manager_panel::edit_hall($manager); break; case "manage_sessions": - $panel .= Manager_panel::manage_sessions($manager); + $panel = Manager_panel::manage_sessions($manager); break; case "new_session": - $panel .= Manager_panel::new_session($manager); + $panel = Manager_panel::new_session($manager); break; case "edit_session": - $panel .= Manager_panel::edit_session($manager); + $panel = Manager_panel::edit_session($manager); break; case "select_film": - $panel .= Manager_panel::select_film($template,$manager); + $panel = Manager_panel::select_film($template,$manager); break; case "success": - $panel .= Manager_panel::success(); + $panel = Manager_panel::success(); break; default: - $panel .= Manager_panel::welcomeAdmin($manager); + $panel = Manager_panel::welcomeAdmin($manager); break; } } diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index 59d0cc7..e845e33 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -14,10 +14,10 @@ static function welcome($manager){ $bd = new Cinema_DAO('complucine'); if($bd){ - $cinema = $bd->cinemaData($manager->getIdcinema()); - $c_name = $cinema->getName(); - $c_dir = $cinema->getDirection(); - $c_tel = $cinema->getPhone(); + $cinema = ($bd->cinemaData( $manager->getIdcinema() ) ); + $c_name = $cinema->getId(); + $c_dir = $cinema->getId(); + $c_tel = $cinema->getId(); } $name = strtoupper($_SESSION["nombre"]); $cinema = strtoupper( $manager->getIdcinema()); @@ -93,20 +93,29 @@ $panel .= "

    No hay ninguna sala en este cine"; }else{ $panel .= ' -

    Salas

    Asientos


    - '; + + '; } $panel.=' @@ -119,7 +128,7 @@ static function new_hall($manager){ - $formHall = new FormHall("new_hall",$manager->getIdcinema()); + $formHall = new FormHall("new_hall",$manager->getIdcinema(),new Hall(null, null, null, null, null, null)); $panel = '

    Crear una sala.



    '.$formHall->gestiona();