Add files via upload
This commit is contained in:
parent
045e93198e
commit
bf0bb38838
@ -7,23 +7,28 @@ class FormHall extends Form {
|
|||||||
|
|
||||||
private $option;
|
private $option;
|
||||||
private $cinema;
|
private $cinema;
|
||||||
|
private $og_hall;
|
||||||
|
private $first;
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
public function __construct($option, $cinema) {
|
public function __construct($option, $cinema, $hall) {
|
||||||
|
|
||||||
$this->option = $option;
|
$this->option = $option;
|
||||||
$this->cinema = $cinema;
|
$this->cinema = $cinema;
|
||||||
$options = array("action" => "./?state=".$option);
|
$this->og_hall = $hall;
|
||||||
|
|
||||||
|
if($option == "edit_hall")
|
||||||
|
$this->first = true;
|
||||||
|
|
||||||
|
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."");
|
||||||
parent::__construct('formHall',$options);
|
parent::__construct('formHall',$options);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generaCamposFormulario($data, $errores = array()){
|
protected function generaCamposFormulario($data, $errores = array()){
|
||||||
//Prepare the data
|
//Prepare the data
|
||||||
$number = $data['number'] ?? $_POST["number"] ?? "";
|
$number = $data['number'] ?? $this->og_hall->getNumber() ?? "";
|
||||||
$rows = $data['rows'] ?? $_POST["rows"] ?? "12";
|
$rows = $data['rows'] ?? $this->og_hall->getNumRows() ?? "12";
|
||||||
$cols = $data['cols'] ?? $_POST["cols"] ?? "8";
|
$cols = $data['cols'] ?? $this->og_hall->getNumCol() ?? "8";
|
||||||
$og_number = $data['og_number'] ?? $number;
|
|
||||||
$og_rows = $data['og_rows'] ?? $rows;
|
|
||||||
$og_cols = $data['og_cols'] ?? $cols;
|
|
||||||
|
|
||||||
//Seats_map
|
//Seats_map
|
||||||
$seats = 0;
|
$seats = 0;
|
||||||
@ -35,10 +40,11 @@ class FormHall extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form
|
//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"]) || isset($_POST["edit_hall"]) ){
|
if(isset($data["restart"]) || $this->first){
|
||||||
$rows = $og_rows;
|
$first = false;
|
||||||
$cols = $og_cols;
|
$rows = $this->og_hall->getNumRows();
|
||||||
$seat_list = Seat::getSeatsMap($og_number, $this->cinema);
|
$cols = $this->og_hall->getNumCol();
|
||||||
|
$seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema);
|
||||||
if($seat_list){
|
if($seat_list){
|
||||||
foreach($seat_list as $seat){
|
foreach($seat_list as $seat){
|
||||||
$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
|
$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
|
||||||
@ -76,21 +82,17 @@ class FormHall extends Form {
|
|||||||
<legend>Mapa de Asientos</legend>
|
<legend>Mapa de Asientos</legend>
|
||||||
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
|
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
|
||||||
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br>
|
<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br>
|
||||||
<input type="Hidden" name="og_rows" value="'.$og_rows.'"/> <br>
|
|
||||||
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br>
|
<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br>
|
||||||
<input type="Hidden" name="og_cols" value="'.$og_cols.'"/> <br>
|
|
||||||
<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br>
|
<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br>
|
||||||
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />';
|
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" />
|
||||||
|
';
|
||||||
if($this->option == "edit_hall")
|
if($this->option == "edit_hall")
|
||||||
$html .= ' <input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="black button" />';
|
$html .= ' <input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="black button" />';
|
||||||
$html .='
|
$html .='
|
||||||
</fieldset>
|
</fieldset><br>
|
||||||
<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" /> '.$errorNumber.'
|
'.$errorNumber.'
|
||||||
<fieldset>
|
|
||||||
<label> Numero de sala: </label>
|
<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" min="1" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>
|
||||||
<input type="hidden" name="og_number" value="'.$og_number.'" /><br>
|
|
||||||
</fieldset>
|
|
||||||
';
|
';
|
||||||
if($this->option == "new_hall")
|
if($this->option == "new_hall")
|
||||||
$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />
|
$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />
|
||||||
@ -103,6 +105,7 @@ class FormHall extends Form {
|
|||||||
if(!$errorCols && !$errorRows){
|
if(!$errorCols && !$errorRows){
|
||||||
$html .='</div>
|
$html .='</div>
|
||||||
<div class="column right">
|
<div class="column right">
|
||||||
|
<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />
|
||||||
<h3 class="table_title"> Pantalla </h3>
|
<h3 class="table_title"> Pantalla </h3>
|
||||||
<table class="seat">
|
<table class="seat">
|
||||||
<thead>
|
<thead>
|
||||||
@ -150,7 +153,6 @@ class FormHall extends Form {
|
|||||||
|
|
||||||
$rows = $datos['rows'];
|
$rows = $datos['rows'];
|
||||||
$cols = $datos['cols'];
|
$cols = $datos['cols'];
|
||||||
$og_number = $datos["og_number"];
|
|
||||||
|
|
||||||
//Prepare the seat_map
|
//Prepare the seat_map
|
||||||
$seats_map = array();
|
$seats_map = array();
|
||||||
@ -193,14 +195,14 @@ class FormHall extends Form {
|
|||||||
$result = './?state=success';
|
$result = './?state=success';
|
||||||
}
|
}
|
||||||
if($this->option == "edit_hall"){
|
if($this->option == "edit_hall"){
|
||||||
$_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $og_number);
|
$_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
|
||||||
$result = './?state=success';
|
$result = './?state=success';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($result['number']) && isset($datos["delete"]) ) {
|
if (!isset($result['number']) && isset($datos["delete"]) ) {
|
||||||
if($this->option == "edit_hall"){
|
if($this->option == "edit_hall"){
|
||||||
$_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $og_number);
|
$_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
|
||||||
$result = './?state=success';
|
$result = './?state=success';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,23 @@
|
|||||||
function __construct(){}
|
function __construct(){}
|
||||||
|
|
||||||
static function welcome($manager){
|
static function welcome($manager){
|
||||||
|
$bd = new Cinema_DAO('complucine');
|
||||||
|
if($bd){
|
||||||
|
$cinema = ($bd->cinemaData($manager->getIdcinema()))->fetch_assoc();
|
||||||
|
$c_name = $cinema["name"];
|
||||||
|
$c_dir = $cinema["direction"];
|
||||||
|
$c_tel = $cinema["phone"];
|
||||||
|
}
|
||||||
$name = strtoupper($_SESSION["nombre"]);
|
$name = strtoupper($_SESSION["nombre"]);
|
||||||
$cinema = strtoupper( $manager->getIdcinema());
|
$cinema = strtoupper( $manager->getIdcinema());
|
||||||
|
|
||||||
$panel = '<div class="code info">
|
$panel = '<div class="code info">
|
||||||
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1>
|
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1>
|
||||||
<hr />
|
<hr />
|
||||||
<p>Usuario: '.$name.'</p>
|
<p>Usuario: '.$name.'</p> <br>
|
||||||
<p>Cine: '.$cinema.'</p>
|
<p>Cine: '.$c_name.'</p>
|
||||||
|
<p>Dirección: '.$c_dir.'</p>
|
||||||
|
<p>Telefono: '.$c_tel.'</p> <br>
|
||||||
<p>Espero que estes pasando un buen dia</p>
|
<p>Espero que estes pasando un buen dia</p>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
@ -84,36 +93,20 @@
|
|||||||
$panel .= "<h2> No hay ninguna sala en este cine";
|
$panel .= "<h2> No hay ninguna sala en este cine";
|
||||||
}else{
|
}else{
|
||||||
$panel .= '
|
$panel .= '
|
||||||
<table class="alt">
|
<h3 class="tablelike_title"> Salas </h3> <h3 class="tablelike_title"> Asientos </h3> <br>
|
||||||
<thead>
|
<ul class="tablelike">
|
||||||
<tr>
|
';
|
||||||
<th>Numero</th>
|
|
||||||
<th>Filas</th>
|
|
||||||
<th>Columnas</th>
|
|
||||||
<th>Asientos Disponibles</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>';
|
|
||||||
|
|
||||||
foreach($listhall as $hall){
|
foreach($listhall as $hall){
|
||||||
$panel .='
|
$panel .='
|
||||||
<tr>
|
<li class="tablelike"> '. $hall->getNumber().'</li>
|
||||||
<td> '. $hall->getNumber().'</td>
|
<li class="tablelike"> '.$hall->getTotalSeats().' </li>
|
||||||
<td> '. $hall->getNumRows().'</td>
|
<a class="tablelike_link" href="?state=edit_hall&number='. $hall->getNumber().'"> Editar </a>
|
||||||
<td> '. $hall->getNumCol().'</td>
|
<a class="tablelike_link" href="?state=manage_sessions&number='. $hall->getNumber().'"> Sessiones </a>
|
||||||
<td> '.$hall->getTotalSeats().' </td>
|
';
|
||||||
<form method="post" action="./?state=edit_session">
|
|
||||||
<input name="number" type="hidden" value="'. $hall->getNumber().'"/>
|
|
||||||
<input name="rows" type="hidden" value="'. $hall->getNumRows().'"/>
|
|
||||||
<input name="cols" type="hidden" value="'. $hall->getNumCol().'"/>
|
|
||||||
<input name="seats" type="hidden" value="'.$hall->getTotalSeats().'"/>
|
|
||||||
<td> <input type="submit" id="submit" name ="edit_hall" formaction="./?state=edit_hall" value="Editar" class="primary" /> </td>
|
|
||||||
</form>
|
|
||||||
</tr>';
|
|
||||||
}
|
}
|
||||||
$panel.='
|
$panel.='
|
||||||
</tbody>
|
</ul>';
|
||||||
</table>';
|
|
||||||
}
|
}
|
||||||
$panel.='
|
$panel.='
|
||||||
<form method="post" action="./?state=new_hall">
|
<form method="post" action="./?state=new_hall">
|
||||||
@ -133,18 +126,24 @@
|
|||||||
return $panel;
|
return $panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function edit_hall($manager){
|
static function edit_hall($manager){
|
||||||
$formHall = new FormHall("edit_hall",$manager->getIdcinema());
|
$hall = Hall::search_hall($_GET["number"], $manager->getIdcinema());
|
||||||
|
|
||||||
$panel = '<h1>Editar una sala.</h1><hr/></br>
|
if($hall || isset($_POST["restart"]) || isset($_POST["filter"]) || isset($_POST["sumbit"]) ){
|
||||||
'.$formHall->gestiona();
|
|
||||||
return $panel;
|
$formHall = new FormHall("edit_hall",$manager->getIdcinema(), $hall);
|
||||||
|
$panel = '<h1>Editar una sala.</h1><hr/></br>
|
||||||
|
'.$formHall->gestiona();
|
||||||
|
return $panel;
|
||||||
|
} else{
|
||||||
|
return Manager_panel::warning($manager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function manage_sessions($manager){
|
static function manage_sessions($manager){
|
||||||
//Base filtering values
|
//Base filtering values
|
||||||
$date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d");
|
$date = $_POST['date'] ?? $_GET['date'] ?? date("Y-m-d");
|
||||||
$hall = isset($_POST['hall']) ? $_POST['hall'] : "1";
|
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
|
||||||
|
|
||||||
//Session filter
|
//Session filter
|
||||||
$panel='<div class = "column left">
|
$panel='<div class = "column left">
|
||||||
@ -254,7 +253,7 @@
|
|||||||
//Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr
|
//Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr
|
||||||
static function warning($manager){
|
static function warning($manager){
|
||||||
$panel = '<div class="code info">
|
$panel = '<div class="code info">
|
||||||
<h1>No deberias poder acceder aqui.</h1>
|
<h1>Ha habido un error.</h1>
|
||||||
<hr />
|
<hr />
|
||||||
<p> >.< </p>
|
<p> >.< </p>
|
||||||
</div>'."\n";
|
</div>'."\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user