Add files via upload
This commit is contained in:
parent
d78ef81c3e
commit
8162f84100
@ -19,24 +19,18 @@ foreach ($acceptedContentTypes as $acceptedContentType) {
|
||||
switch($_SERVER['REQUEST_METHOD']) {
|
||||
// Get Events
|
||||
case 'GET':
|
||||
error_log("GET");
|
||||
|
||||
$hall = $_GET["hall"];
|
||||
$cinema = $_SESSION["cinema"];
|
||||
|
||||
$start = $_GET["start"];
|
||||
$end = $_GET["end"];
|
||||
|
||||
// Comprobamos si es una lista de eventos entre dos fechas -> eventos.php?start=XXXXX&end=YYYYY
|
||||
$start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP, array("options" => array("regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
|
||||
$end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, array("options" => array("default" => null, "regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
|
||||
if ($start) {
|
||||
|
||||
$startDateTime = $start . ' 00:00:00';
|
||||
$endDateTime = $end;
|
||||
if ($end) {
|
||||
$endDateTime = $end. ' 00:00:00';
|
||||
}
|
||||
$result = Event::searchEventsBetween2dates($startDateTime, $endDateTime, $hall,$cinema);
|
||||
$result = Event::searchEventsBetween2dates($start, $end, $hall,$cinema);
|
||||
} else {
|
||||
// Comprobamos si es una lista de eventos completa
|
||||
$result = Event::searchAllEvents($hall,$cinema);
|
||||
$result = Event::searchAllEvents($hall,$cinema);
|
||||
}
|
||||
|
||||
// Generamos un array de eventos en formato JSON
|
||||
@ -44,12 +38,12 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
http_response_code(200); // 200 OK
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Length: ' . mb_strlen($json));;
|
||||
|
||||
echo $json;
|
||||
|
||||
echo $json;
|
||||
break;
|
||||
// Add Session
|
||||
case 'POST':
|
||||
error_log("POST");
|
||||
|
||||
$errors = [];
|
||||
$data = [];
|
||||
|
||||
@ -136,6 +130,7 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
|
||||
//Check if the user is droping an event in a new date
|
||||
if(isset($_GET["drop"]) && $_GET["drop"]){
|
||||
|
||||
$or_hall = $dictionary->{"idhall"} ?? "";
|
||||
$or_date = $dictionary->{"startDate"} ?? "";
|
||||
$or_start = $dictionary->{"startHour"} ?? "";
|
||||
@ -144,7 +139,7 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
$format = $dictionary->{"format"} ?? "";
|
||||
|
||||
$new_date = $dictionary->{"newDate"} ?? "";
|
||||
|
||||
|
||||
$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $or_hall, $new_date, $new_date, $idfilm, $price, $format);
|
||||
|
||||
if(strcmp($msg,$correct_response)!== 0)
|
||||
@ -159,7 +154,8 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
$startDate = $dictionary->{"startDate"} ?? "";
|
||||
|
||||
$endDate = $dictionary->{"endDate"} ?? "";
|
||||
$startHour = $dictionary->{"startHour"} ?? "";
|
||||
$startHour = $dictionary->{"startHour"} ?? "";
|
||||
|
||||
$idfilm = $dictionary->{"idFilm"} ?? "";
|
||||
|
||||
$or_hall = $dictionary->{"og_hall"} ?? "";
|
||||
@ -191,7 +187,8 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
if (!is_numeric($idfilm) && $idfilm <= 0 )
|
||||
$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
|
||||
|
||||
if(empty($errors)){
|
||||
if(empty($errors)){
|
||||
|
||||
$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $hall, $startHour, $startDate, $idfilm, $price, $format);
|
||||
|
||||
if(strcmp($msg,$correct_response)!== 0)
|
||||
@ -207,7 +204,7 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
$data['success'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo json_encode($data);
|
||||
break;
|
||||
//Delete a session
|
||||
|
@ -66,12 +66,11 @@ class SessionForm {
|
||||
<div class="img_desc">
|
||||
<div class="image"> <img src="../img/films/iron_man.jpg" alt="iron man" id="film_img" /> </div>
|
||||
<div class="blockquote">
|
||||
<p id="film_desc">"Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo."</p>
|
||||
<li id="film_dur"> Duración: duracion minutos</li>
|
||||
<li id="film_lan"> Lenguaje: idioma </li>
|
||||
</div>
|
||||
</div>
|
||||
<li id="film_dur"> Duración: duracion minutos</li>
|
||||
<li id="film_lan"> Lenguaje: idioma </li>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="button large" id="return"> Cambiar pelicula </button>
|
||||
</div>
|
||||
<div class="film_list" id="film_list">
|
||||
@ -83,7 +82,6 @@ class SessionForm {
|
||||
<input type="hidden" value="'.$film->getId().'" id="id'.$i.'"/>
|
||||
<input type="hidden" value="'.$film->getImg().'" id="img'.$i.'"/>
|
||||
<input type="hidden" value="'.$film->getLanguage().'" id="lan'.$i.'"/>
|
||||
<input type="hidden" value="'.$film->getDescription().'" id="desc'.$i.'"/>
|
||||
<li value="'.$film->getTittle().'"id="title'.$i.'"> '. str_replace('_', ' ',$film->getTittle()).'</li>
|
||||
<li id="dur'.$i.'"> '.$film->getDuration().' min</li>
|
||||
<li> <button type="button" class="film_button" id="'.$i.'"> Seleccionar </button> </li>
|
||||
|
@ -85,47 +85,57 @@
|
||||
}
|
||||
//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"]);
|
||||
|
||||
if($halls){
|
||||
$panel ='
|
||||
<div class="row">
|
||||
<div class="column side"></div>
|
||||
<div class="column middle">
|
||||
<br>
|
||||
<select id="hall_selector" class="button large">';
|
||||
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
|
||||
if($hll->getNumber() == $hall){
|
||||
$panel.= '
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
|
||||
}else{
|
||||
$panel.= '
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
|
||||
if(isset($_SESSION["cinema"])){
|
||||
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
|
||||
$halls = Hall::getListHalls($_SESSION["cinema"]);
|
||||
|
||||
if($halls){
|
||||
$panel ='
|
||||
<div class="row">
|
||||
<div class="column side"></div>
|
||||
<div class="column middle">
|
||||
<br>
|
||||
<select id="hall_selector" class="button large">';
|
||||
foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
|
||||
if($hll->getNumber() == $hall){
|
||||
$panel.= '
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> ';
|
||||
}else{
|
||||
$panel.= '
|
||||
<option data-feed="./eventsProcess.php?hall='.$hll->getNumber().'" value="'. $hll->getNumber() .'"> Sala '. $hll->getNumber() .'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$panel.='
|
||||
</select>
|
||||
</div>
|
||||
<div class="column side"></div>
|
||||
</div>
|
||||
<div class="row fc-container">
|
||||
<div id="calendar"></div>
|
||||
<div id="myModal" class="modal">
|
||||
$panel.='
|
||||
</select>
|
||||
</div>
|
||||
<div class="column side"></div>
|
||||
</div>
|
||||
<div class="row fc-container">
|
||||
<div id="calendar"></div>
|
||||
<div id="myModal" class="modal">
|
||||
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span> <br> <br>
|
||||
'.SessionForm::getForm().'
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span> <br> <br>
|
||||
'.SessionForm::getForm().'
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
</div>';
|
||||
}else{
|
||||
$panel ='<div class="row">
|
||||
<h3> No hay ninguna sala en este cine </h3>
|
||||
<a href=."/?state=new_hall"> Añadir Sala </a>
|
||||
</div>';
|
||||
}
|
||||
}else{
|
||||
$panel ='<div class="row">
|
||||
<h3> No hay ninguna sala en este cine </h3>
|
||||
<a href=."/?state=new_hall"> Añadir Sala </a>
|
||||
</div>';
|
||||
$panel = '<div class="code info">
|
||||
<h1>Aun no se ha seleccionado un cine.</h1>
|
||||
<hr />
|
||||
<p> >.< </p>
|
||||
<p> Selecciona un cine en el panel principal </p>
|
||||
</div>'."\n";
|
||||
}
|
||||
return $panel;
|
||||
return $panel;
|
||||
|
||||
}
|
||||
|
||||
static function success(){
|
||||
@ -140,42 +150,50 @@
|
||||
}
|
||||
|
||||
static function manage_halls(){
|
||||
|
||||
$panel = '<div class="column side"></div>
|
||||
<div class="column middle">';
|
||||
$listhall = Hall::getListHalls($_SESSION["cinema"]);
|
||||
if(!$listhall){
|
||||
$panel .= "<h2> No hay ninguna sala en este cine";
|
||||
}else{
|
||||
$panel .= '
|
||||
<ul class="tablelist col3">
|
||||
<li class="title"> Sala </li>
|
||||
<li class="title"> Asientos </li>
|
||||
<li class="title"> Sesión </li>
|
||||
';
|
||||
$parity = "odd";
|
||||
foreach($listhall as $hall){
|
||||
$panel .='<div class="'.$parity.'">
|
||||
<a class="h2long" 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> Sesiones </li>
|
||||
</a>
|
||||
</div>
|
||||
';
|
||||
$parity = ($parity == "odd") ? "even" : "odd";
|
||||
if(isset($_SESSION["cinema"])){
|
||||
$panel = '<div class="column side"></div>
|
||||
<div class="column middle">';
|
||||
$listhall = Hall::getListHalls($_SESSION["cinema"]);
|
||||
if(!$listhall){
|
||||
$panel .= "<h2> No hay ninguna sala en este cine";
|
||||
}else{
|
||||
$panel .= '
|
||||
<ul class="tablelist col3">
|
||||
<li class="title"> Sala </li>
|
||||
<li class="title"> Asientos </li>
|
||||
<li class="title"> Sesión </li>
|
||||
';
|
||||
$parity = "odd";
|
||||
foreach($listhall as $hall){
|
||||
$panel .='<div class="'.$parity.'">
|
||||
<a class="h2long" 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> Sesiones </li>
|
||||
</a>
|
||||
</div>
|
||||
';
|
||||
$parity = ($parity == "odd") ? "even" : "odd";
|
||||
}
|
||||
$panel.='
|
||||
</ul>';
|
||||
}
|
||||
$panel.='
|
||||
</ul>';
|
||||
$panel.='
|
||||
<form method="post" action="./?state=new_hall">
|
||||
<input type="submit" name="new_hall" value="Añadir Sala" class="button large" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="column side"></div>';
|
||||
}else{
|
||||
$panel = '<div class="code info">
|
||||
<h1>Aun no se ha seleccionado un cine.</h1>
|
||||
<hr />
|
||||
<p> >.< </p>
|
||||
<p> Selecciona un cine en el panel principal </p>
|
||||
</div>'."\n";
|
||||
}
|
||||
$panel.='
|
||||
<form method="post" action="./?state=new_hall">
|
||||
<input type="submit" name="new_hall" value="Añadir Sala" class="button large" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="column side"></div>';
|
||||
return $panel;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user