Add files via upload

This commit is contained in:
Markines16 2021-05-27 14:18:25 +02:00 committed by GitHub
parent c90c450f1c
commit d108b66468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 64 deletions

View File

@ -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 {
<fieldset>
<legend>Mapa de Asientos</legend>
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br>
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br>
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" /> <br>
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"/> <br>
<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br>
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" />
';
@ -92,7 +90,7 @@ class FormHall extends Form {
</fieldset><br>
'.$errorNumber.'
<label> Numero de sala: </label>
<input type="number" min="1" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
<input type="number" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
';
if($this->option == "new_hall")
$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />
@ -106,6 +104,7 @@ class FormHall extends Form {
$html .='</div>
<div class="column right">
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />
<input type="submit" name="alltozero" value="Desactivar todos los asientos" class="button large" />
<h3 class="table_title"> Pantalla </h3>
<table class="seat">
<thead>
@ -189,25 +188,29 @@ class FormHall extends Form {
$result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>";
}
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;
}
}

View File

@ -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 .= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> ¡ATENCIÓN! </h1><hr />
<p>Está viendo la web como un Usuario NO Registrado.</p>
<a href=''><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
break;
case "view_ruser":
$_SESSION["rol"] = "user";
$panel .= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<div class='code info'>
<h1> ¡ATENCIÓN! </h1><hr />
<p>Está viendo la web como un Usuario Registrado.</p>
<a href=''><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
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;
}
}

View File

@ -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 .= "<h2> No hay ninguna sala en este cine";
}else{
$panel .= '
<h3 class="tablelike_title"> Salas </h3> <h3 class="tablelike_title"> Asientos </h3> <br>
<ul class="tablelike">
<div class="tablelist">
<u1">
<li class="title"> Salas </li>
<li class="title"> Asientos </li>
<li class="title"> Sesiones </li> <br>
';
$parity = "odd";
foreach($listhall as $hall){
$panel .='
<li class="tablelike"> '. $hall->getNumber().'</li>
<li class="tablelike"> '.$hall->getTotalSeats().' </li>
<a class="tablelike_link" href="?state=edit_hall&number='. $hall->getNumber().'"> Editar </a>
<a class="tablelike_link" href="?state=manage_sessions&number='. $hall->getNumber().'"> Sessiones </a>
$panel .='<div class='.$parity.'>
<a href="?state=edit_hall&number='. $hall->getNumber().'">
<li> '. $hall->getNumber().'</li>
<li> '.$hall->getTotalSeats().' </li>
</a>
<a href="?state=manage_sessions&hall='. $hall->getNumber().'">
<li> Sessiones</li>
</a>
</div>
';
$parity = ($parity == "odd") ? "even" : "odd";
}
$panel.='
</ul>';
</ul>
</div>';
}
$panel.='
<form method="post" action="./?state=new_hall">
@ -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 = '<h1>Crear una sala.</h1><hr/></br>
'.$formHall->gestiona();