Add files via upload

This commit is contained in:
Markines16 2021-06-07 23:16:42 +02:00 committed by GitHub
parent d78ef81c3e
commit 8162f84100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 107 additions and 94 deletions

View File

@ -19,21 +19,15 @@ foreach ($acceptedContentTypes as $acceptedContentType) {
switch($_SERVER['REQUEST_METHOD']) {
// Get Events
case 'GET':
error_log("GET");
$hall = $_GET["hall"];
$cinema = $_SESSION["cinema"];
// 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) {
$start = $_GET["start"];
$end = $_GET["end"];
$startDateTime = $start . ' 00:00:00';
$endDateTime = $end;
if ($end) {
$endDateTime = $end. ' 00:00:00';
}
$result = Event::searchEventsBetween2dates($startDateTime, $endDateTime, $hall,$cinema);
if ($start) {
$result = Event::searchEventsBetween2dates($start, $end, $hall,$cinema);
} else {
// Comprobamos si es una lista de eventos completa
$result = Event::searchAllEvents($hall,$cinema);
@ -49,7 +43,7 @@ switch($_SERVER['REQUEST_METHOD']) {
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"} ?? "";
@ -160,6 +155,7 @@ switch($_SERVER['REQUEST_METHOD']) {
$endDate = $dictionary->{"endDate"} ?? "";
$startHour = $dictionary->{"startHour"} ?? "";
$idfilm = $dictionary->{"idFilm"} ?? "";
$or_hall = $dictionary->{"og_hall"} ?? "";
@ -192,6 +188,7 @@ switch($_SERVER['REQUEST_METHOD']) {
$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
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)

View File

@ -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>
</div>
</div>
<li id="film_dur"> Duración: duracion minutos</li>
<li id="film_lan"> Lenguaje: idioma </li>
</div>
</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>

View File

@ -85,6 +85,7 @@
}
//Manage the sessions using full calendar js events and a pop up form which is constantly edited with more js
static function calendar(){
if(isset($_SESSION["cinema"])){
$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
$halls = Hall::getListHalls($_SESSION["cinema"]);
@ -125,7 +126,16 @@
<a href=."/?state=new_hall"> Añadir Sala </a>
</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";
}
return $panel;
}
static function success(){
@ -140,7 +150,7 @@
}
static function manage_halls(){
if(isset($_SESSION["cinema"])){
$panel = '<div class="column side"></div>
<div class="column middle">';
$listhall = Hall::getListHalls($_SESSION["cinema"]);
@ -176,6 +186,14 @@
</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";
}
return $panel;
}