FC funcional entero
This commit is contained in:
@ -1,16 +1,13 @@
|
||||
<?php
|
||||
include_once($prefix.'assets/php/includes/hall.php');
|
||||
include_once($prefix.'assets/php/includes/session.php');
|
||||
require_once($prefix.'assets/php/includes/manager.php');
|
||||
require_once($prefix.'assets/php/includes/cinema_dao.php');
|
||||
include_once('./includes/formHall.php');
|
||||
include_once('./includes/formSession.php');
|
||||
include_once('./includes/NewSessionForm.php');
|
||||
include_once('./includes/SessionForm.php');
|
||||
|
||||
class Manager_panel {
|
||||
|
||||
function __construct(){}
|
||||
|
||||
|
||||
static function welcome(){
|
||||
$bd = new Cinema_DAO('complucine');
|
||||
if($bd){
|
||||
@ -30,12 +27,12 @@
|
||||
<p>Usuario: '.$name.'</p> <br>
|
||||
<p>Cine: '.$c_name.'</p>
|
||||
<p>Dirección: '.$c_dir.'</p>
|
||||
<a href="?state=calendar"> <p> Hack para entrar al calendario <p> </a>
|
||||
</div>'."\n";
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
// Admin welcome panel allows to change the cinema linked to the admin-like-manager
|
||||
static function welcomeAdmin() {
|
||||
$cinemaList = new Cinema_DAO('complucine');
|
||||
$cinemas = $cinemaList->allCinemaData();
|
||||
@ -64,8 +61,6 @@
|
||||
<p>Usuario: '.$name.'</p> <br>
|
||||
<h3>Como administrador puedes escoger el cine que gestionar</h3>
|
||||
<p>Cine: '.$c_name.'</p>
|
||||
|
||||
<a href="?state=calendar"> <p> Hack para entrar al calendario <p> </a>
|
||||
|
||||
<form method="post" id="changecinema" action="index.php">
|
||||
<select name="cinema" class="button large">
|
||||
@ -88,8 +83,8 @@
|
||||
|
||||
return $panel;
|
||||
}
|
||||
//Manage the sessions using full calendar js events and a pop up form which is constantly edited with more js
|
||||
static function calendar(){
|
||||
|
||||
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
|
||||
$halls = Hall::getListHalls($_SESSION["cinema"]);
|
||||
|
||||
@ -103,10 +98,10 @@
|
||||
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
|
||||
if($hll->getNumber() == $hall){
|
||||
$panel.= '
|
||||
<option data-feed="./eventos.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
|
||||
}else{
|
||||
$panel.= '
|
||||
<option data-feed="./eventos.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
|
||||
}
|
||||
}
|
||||
$panel.='
|
||||
@ -120,7 +115,7 @@
|
||||
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span> <br> <br>
|
||||
'.NewSessionForm::getForm().'
|
||||
'.SessionForm::getForm().'
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
@ -130,10 +125,9 @@
|
||||
<a href=."/?state=new_hall"> Añadir Sala </a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
static function success(){
|
||||
$panel = '<div class="code info">
|
||||
<h1>Operacion completada.</h1>
|
||||
@ -166,7 +160,7 @@
|
||||
<li> '. $hall->getNumber().'</li>
|
||||
<li> '.$hall->getTotalSeats().' </li>
|
||||
</a>
|
||||
<a href="?state=calendar&hall='. $hall->getNumber().'">
|
||||
<a href="?state=manage_sessions&hall='. $hall->getNumber().'">
|
||||
<li> Sesiones </li>
|
||||
</a>
|
||||
</div>
|
||||
@ -208,117 +202,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
static function manage_sessions(){
|
||||
//Base filtering values
|
||||
$date = $_POST['date'] ?? $_GET['date'] ?? date("Y-m-d");
|
||||
$hall = $_POST['hall'] ?? $_GET['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>';
|
||||
|
||||
|
||||
foreach($sessions as $session){
|
||||
$film = Session::getThisSessionFilm($session->getIdfilm());
|
||||
$panel .='
|
||||
<tr>
|
||||
<td> '.date("H:i", strtotime( $session->getStartTime())).' </td>
|
||||
<td> '. str_replace('_', ' ', $film["tittle"]) .' </td>
|
||||
<td> '.$session->getFormat().' </td>
|
||||
<td> '.$session->getSeatPrice().' </td>
|
||||
<form method="post" action="./?state=edit_session">
|
||||
<input name="film" type="hidden" value="'.$session->getIdfilm().'">
|
||||
<input name="tittle" type="hidden" value="'.$film["tittle"].'">
|
||||
<input name="duration" type="hidden" value="'.$film["duration"].'">
|
||||
<input name="language" type="hidden" value="'.$film["language"].'">
|
||||
<input name="description" type="hidden" value="'.$film["description"].'">
|
||||
<input name="hall" type="hidden" value="'.$session->getIdhall().'">
|
||||
<input name="date" type="hidden" value="'.$session->getDate().'">
|
||||
<input name="start" type="hidden" value="'.$session->getStartTime().'">
|
||||
<input name="price" type="hidden" value="'.$session->getSeatPrice().'">
|
||||
<input name="format" type="hidden" value="'.$session->getFormat().'">
|
||||
<td> <input type="submit" id="submit" name ="edit_session" value="Editar" class="primary" /> </td>
|
||||
</form>
|
||||
</tr>';
|
||||
}
|
||||
$panel.='
|
||||
</tbody>
|
||||
</table>
|
||||
</form>';
|
||||
} else {
|
||||
$panel.=' <h3> No hay ninguna sesion </h3>';
|
||||
}
|
||||
$panel.='
|
||||
<input type="submit" name="new_session" form="filter" value="Añadir" class="button large" formaction="./?state=new_session">
|
||||
</div>';
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
static function new_session(){
|
||||
$formSession = new FormSession("new_session", $_SESSION["cinema"] );
|
||||
|
||||
$panel = '<h1>Crear una sesion.</h1> <hr/> </br>
|
||||
'.$formSession->gestiona();
|
||||
return $panel;
|
||||
}
|
||||
|
||||
static function edit_session(){
|
||||
$formSession = new FormSession("edit_session", $_SESSION["cinema"] );
|
||||
|
||||
$panel = '<h1>Editar una sesion.</h1><hr/></br>
|
||||
'.$formSession->gestiona();
|
||||
return $panel;
|
||||
}
|
||||
|
||||
//TODO: estado al modificar sesiones para la seleccion de peliculas usando el template->print films
|
||||
static function select_film($template){
|
||||
if(isset($_POST["select_film"]) && isset($_POST["option"])){
|
||||
$_SESSION["option"] = $_POST["option"];
|
||||
$panel = '<h1>Seleccionar Pelicula.</h1><hr /></br>';
|
||||
$panel .= $template->print_fimls();
|
||||
$_SESSION["option"] = "";
|
||||
} else $panel = self::warning();
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
//Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr
|
||||
//this function is used as an answer to wrong url parameters accesing a formhall edit. The formsession version has been replaced by other js error replys
|
||||
static function warning(){
|
||||
$panel = '<div class="code info">
|
||||
<h1>Ha habido un error.</h1>
|
||||
@ -328,7 +212,5 @@
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user