2021-04-26 22:40:34 +02:00
|
|
|
<?php
|
2021-05-05 16:52:04 +02:00
|
|
|
include_once('../assets/php/common/hall.php');
|
2021-05-05 21:10:46 +02:00
|
|
|
include_once('../assets/php/common/session.php');
|
2021-05-05 16:52:04 +02:00
|
|
|
include_once('./includes/formHall.php');
|
2021-05-05 21:10:46 +02:00
|
|
|
include_once('./includes/formSession.php');
|
|
|
|
|
|
|
|
|
2021-05-05 16:52:04 +02:00
|
|
|
class Manager_panel {
|
|
|
|
|
2021-04-26 22:40:34 +02:00
|
|
|
function __construct($panel,$log){
|
|
|
|
$this->state = $panel;
|
|
|
|
$this->login = $log;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-05 16:52:04 +02:00
|
|
|
static function welcome(){
|
|
|
|
$name = strtoupper($_SESSION['nombre']);
|
|
|
|
|
|
|
|
$panel = '<div class="code info">
|
|
|
|
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1>
|
|
|
|
<hr />
|
|
|
|
<p>Usuario: '.$name.'</p>
|
|
|
|
<p>Espero que estes pasando un buen dia</p>
|
|
|
|
</div>'."\n";
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function success(){
|
|
|
|
$panel = '<div class="code info">
|
|
|
|
<h1>Operacion completada.</h1>
|
|
|
|
<hr />
|
|
|
|
<p>'.$_SESSION['msg'].'</p>
|
|
|
|
</div>'."\n";
|
|
|
|
$_SESSION['msg'] = "";
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function manage_halls(){
|
|
|
|
$panel = '<form method="post" action="./?state=new_hall">
|
2021-05-05 21:10:46 +02:00
|
|
|
<table class="alt">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Numero</th>
|
|
|
|
<th>Filas</th>
|
|
|
|
<th>Columnas</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>';
|
|
|
|
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hall){
|
2021-05-05 16:52:04 +02:00
|
|
|
$panel .='
|
2021-05-05 21:10:46 +02:00
|
|
|
<tr>
|
|
|
|
<td> '. $hall->getNumber().'</td>
|
|
|
|
<td> '. $hall->getNumRows().'</td>
|
|
|
|
<td> '. $hall->getNumCol().'</td>
|
|
|
|
<td> <input type="submit" name="edit" value="Editar" class="button" formaction="./?state=edit_hall&number='.$hall->getNumber().'" ></td>
|
|
|
|
</tr>';
|
2021-05-05 16:52:04 +02:00
|
|
|
}
|
|
|
|
$panel.='
|
2021-05-05 21:10:46 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<input type="submit" name="new" value="Añadir" class="button large" >
|
|
|
|
</form>
|
|
|
|
';
|
2021-05-05 16:52:04 +02:00
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function new_hall(){
|
2021-05-05 21:10:46 +02:00
|
|
|
$data = array("option" => "new_hall");
|
2021-05-05 16:52:04 +02:00
|
|
|
$panel = '<div class="column side"></div>
|
2021-05-05 21:10:46 +02:00
|
|
|
<div class="column middle">
|
2021-05-05 16:52:04 +02:00
|
|
|
<h1>Crear una sala.</h1><hr /></br>
|
2021-05-05 21:10:46 +02:00
|
|
|
'. FormHall::generaCampoFormulario($data, null).'
|
2021-05-05 16:52:04 +02:00
|
|
|
</div>
|
|
|
|
<div class="column side"></div>'."\n";
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function edit_hall(){
|
|
|
|
$panel = '<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h1>Editar una sala.</h1><hr /></br>
|
2021-05-05 21:10:46 +02:00
|
|
|
<p> En desarrollo... </p>
|
2021-05-05 16:52:04 +02:00
|
|
|
</div>
|
|
|
|
<div class="column side"></div>'."\n";
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function manage_sessions(){
|
2021-05-05 21:10:46 +02:00
|
|
|
//Base filtering values
|
|
|
|
$date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d");
|
|
|
|
$hall = isset($_POST['hall']) ? $_POST['hall'] : "1";
|
|
|
|
|
|
|
|
//Session filter
|
|
|
|
$panel='<div class = "column left">
|
|
|
|
<form method="post" id="filter" action="./?state=manage_sessions">
|
|
|
|
<input type="date" name="date" value="'.$date.'" min="2021-01-01" max="2031-12-31">
|
|
|
|
<select name="hall" class="button large">';
|
|
|
|
|
|
|
|
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
|
|
|
|
if($hll->getNumber() == $hall){
|
|
|
|
$panel.= '
|
|
|
|
<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
|
|
|
|
}else{
|
|
|
|
$panel.= '
|
|
|
|
<option value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$panel.='
|
|
|
|
</select>
|
|
|
|
<input type="submit" name="filter" value="Filtrar" class="button large"/>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
//Session list
|
|
|
|
$panel .='<div class = "column right">';
|
|
|
|
$sessions = Session::getListSessions($hall,$_SESSION["cinema"],$date);
|
|
|
|
|
|
|
|
if($sessions) {
|
|
|
|
$panel .='
|
|
|
|
<form method="post" action="./?state=edit_session">
|
|
|
|
<table class="alt">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Hora</th>
|
|
|
|
<th>Pelicula</th>
|
|
|
|
<th>Formato</th>
|
|
|
|
<th>Precio</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>';
|
2021-05-05 16:52:04 +02:00
|
|
|
|
2021-05-05 21:10:46 +02:00
|
|
|
|
|
|
|
foreach($sessions as $session){
|
|
|
|
$panel .='
|
|
|
|
<tr>
|
|
|
|
<td> '.date("H:i", strtotime( $session->getStartTime())).' </td>
|
|
|
|
<td> '. str_replace('_', ' ', Session::getFilmTitle($session->getIdfilm())) .' </td>
|
|
|
|
<td> '.$session->getFormat().' </td>
|
|
|
|
<td> '.$session->getSeatPrice().' </td>
|
|
|
|
<td> <input type="submit" name="edit" value="Editar" class="button" ></td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
$panel.='
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</form>';
|
|
|
|
} else {
|
|
|
|
$panel.=' <h3> No hay ninguna sesion </h3>';
|
|
|
|
}
|
|
|
|
$panel.='
|
|
|
|
<input type="submit" name="submit" form="filter" value="Añadir" class="button large" formaction="./?state=new_session">
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
|
2021-05-05 16:52:04 +02:00
|
|
|
return $panel;
|
2021-04-26 22:40:34 +02:00
|
|
|
}
|
2021-05-05 21:10:46 +02:00
|
|
|
|
|
|
|
static function new_session(){
|
|
|
|
$data = array("option" => "new_session","hall" => $_POST['hall'],"cinema" => $_SESSION["cinema"],"date" => $_POST['date']);
|
|
|
|
|
|
|
|
$panel = '<h1>Crear una sesión.</h1><hr /></br>
|
|
|
|
'.FormSession::generaCampoFormulario($data, null);
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function edit_session(){
|
|
|
|
$panel = '<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h1>Editar una session.</h1><hr /></br>
|
|
|
|
<p> En desarrollo... </p>
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>'."\n";
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
2021-04-26 22:40:34 +02:00
|
|
|
}
|
|
|
|
?>
|