From 8162f84100885d6b64daa40b291fdec0d2e29ac4 Mon Sep 17 00:00:00 2001 From: Markines16 <80280295+Markines16@users.noreply.github.com> Date: Mon, 7 Jun 2021 23:16:42 +0200 Subject: [PATCH] Add files via upload --- panel_manager/eventsProcess.php | 35 +++--- panel_manager/includes/SessionForm.php | 8 +- panel_manager/panel_manager.php | 158 ++++++++++++++----------- 3 files changed, 107 insertions(+), 94 deletions(-) diff --git a/panel_manager/eventsProcess.php b/panel_manager/eventsProcess.php index 9fb4f59..ff215f6 100644 --- a/panel_manager/eventsProcess.php +++ b/panel_manager/eventsProcess.php @@ -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 diff --git a/panel_manager/includes/SessionForm.php b/panel_manager/includes/SessionForm.php index f1781ef..dfdb8dc 100644 --- a/panel_manager/includes/SessionForm.php +++ b/panel_manager/includes/SessionForm.php @@ -66,12 +66,11 @@ class SessionForm {
iron man
-

"Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo."

+
  • Duración: duracion minutos
  • +
  • Lenguaje: idioma
  • -
  • Duración: duracion minutos
  • -
  • Lenguaje: idioma
  • - +
    @@ -83,7 +82,6 @@ class SessionForm { -
  • '. str_replace('_', ' ',$film->getTittle()).'
  • '.$film->getDuration().' min
  • diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index 59e421c..e5a47d1 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -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 =' -
    -
    -
    -
    - '; + foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){ + if($hll->getNumber() == $hall){ + $panel.= ' + '; + }else{ + $panel.= ' + '; + } } - } - $panel.=' - -
    -
    -
    -
    -
    - +
    +
    +
    +
    + -
    '; +
    '; + }else{ + $panel ='
    +

    No hay ninguna sala en este cine

    + Añadir Sala +
    '; + } }else{ - $panel ='
    -

    No hay ninguna sala en este cine

    - Añadir Sala -
    '; + $panel = '
    +

    Aun no se ha seleccionado un cine.

    +
    +

    >.<

    +

    Selecciona un cine en el panel principal

    +
    '."\n"; } - return $panel; + return $panel; + } static function success(){ @@ -140,42 +150,50 @@ } static function manage_halls(){ - - $panel = '
    -
    '; - $listhall = Hall::getListHalls($_SESSION["cinema"]); - if(!$listhall){ - $panel .= "

    No hay ninguna sala en este cine"; - }else{ - $panel .= ' - '; + $panel.=' +
    + +
    +

    +
    '; + }else{ + $panel = '
    +

    Aun no se ha seleccionado un cine.

    +
    +

    >.<

    +

    Selecciona un cine en el panel principal

    +
    '."\n"; } - $panel.=' -
    - -
    - -
    '; return $panel; }