From 3e48951b902db8a76e5e76ee9295b12b408a7f84 Mon Sep 17 00:00:00 2001
From: OscarRui <79144467+OscarRui@users.noreply.github.com>
Date: Fri, 7 May 2021 19:07:03 +0200
Subject: [PATCH] Add files via upload
---
panel_manager/includes/formHall.php | 16 +++++++++++++---
panel_manager/includes/processForm.php | 19 +++++++++++++++++++
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php
index 5834471..7c33f54 100644
--- a/panel_manager/includes/formHall.php
+++ b/panel_manager/includes/formHall.php
@@ -35,6 +35,11 @@ class FormHall extends Form {
';
if($data['option'] == "new_hall")
$htmlform .= '
';
+ if($data['option'] == "edit_hall"){
+ $htmlform .= '
+
+
';
+ }
$htmlform .= '
@@ -80,9 +85,14 @@ class FormHall extends Form {
if($data["option"] == "new_hall"){
$_SESSION['msg'] = Hall::create_hall($data);
header( "Location: ../?state=success" );
- }else {
-
- }
+ }else if($data["option"] == "edit_hall"){
+ $_SESSION['msg'] = Hall::edit_hall($data);
+ header( "Location: ../?state=success" );
+ }
+ else if($data["option"] == "delete_hall") {
+ $_SESSION['msg'] = Hall::delete_hall($data);
+ header( "Location: ../?state=success" );
+ }
}
}
diff --git a/panel_manager/includes/processForm.php b/panel_manager/includes/processForm.php
index b37b038..157457c 100644
--- a/panel_manager/includes/processForm.php
+++ b/panel_manager/includes/processForm.php
@@ -19,6 +19,25 @@
}
FormHall::processesForm($data);
}
+
+ if(isset($_POST['edit_hall'])){
+ $data = array("option" => "edit_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"],"seats" => 0);
+ //Check what checkboxs are seats or not
+ for($i = 1;$i<=$data["rows"];$i++){
+ for($j=1; $j<=$data["cols"]; $j++){
+ if(!empty($_POST['checkbox'.$i.$j.''])){
+ $data[$i][$j] = $_POST['checkbox'.$i.$j.''];
+ $data["seats"]++;
+ } else $data[$i][$j] = "-1";
+ }
+ }
+ FormHall::processesForm($data);
+ }
+
+ if(isset($_POST['delete_hall'])){
+ $data = array("option" => "delete_hall","number" => $_POST["number"], "cinema" => $_SESSION["cinema"]);
+ FormHall::processesForm($data);
+ }
if(isset($_POST['new_session'])){
$data = array("option" => "new_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]