From 62db2dcd23fffce3b0db9589c3c75c2d5d4d9a43 Mon Sep 17 00:00:00 2001 From: Markines16 <80280295+Markines16@users.noreply.github.com> Date: Tue, 4 May 2021 21:14:38 +0200 Subject: [PATCH] Add files via upload --- panel_manager/includes/formHall.php | 95 ++++++++++++-------------- panel_manager/includes/processForm.php | 12 ++++ 2 files changed, 55 insertions(+), 52 deletions(-) create mode 100644 panel_manager/includes/processForm.php diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php index ee45443..8e6b0bb 100644 --- a/panel_manager/includes/formHall.php +++ b/panel_manager/includes/formHall.php @@ -1,6 +1,6 @@ reply = array(); } - protected function generaCamposFormulario($datos, $errores = array()){ - $this->option = $_SESSION['option']; - $_SESSION['option'] = ""; - $htmlform = ""; - - - - if($this->option == "new"){ + public static function generaCampoFormulario($datos, $errores = array(), $option){ + if($option == "new"){ $number = $datos['number'] ?? ''; $rows = $datos['rows'] ?? ''; $cols = $datos['cols'] ?? ''; @@ -31,13 +25,15 @@ class FormHall extends Form { $htmlform .= ' -
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
'; } @@ -74,45 +70,40 @@ class FormHall extends Form { } //Process form: - public function processesForm($datos){ - $this->correct = true; - $bd = new HallDAO('complucine'); - - - if($bd ){ - if($option == "list"){ - $this->halls = $bd->getAllHalls($cinema); - }else { - /* TODO - $start = date('H:i:s', strtotime( $start ) ); + public static function processesForm($data){ + if($data["option"] == "new"){ + Hall::create_hall($data); + $_SESSION['msg'] = "La sala se ha aƱadido correctamente"; + header( "Location: ../?state=success" ); + }else { + /* TODO + $start = date('H:i:s', strtotime( $start ) ); + + if($option == "new"){ - if($option == "new"){ - - $selectSession = $bd->selectSession($cinema, $hall, $start, $date); - if($selectSession && $selectSession->num_rows >= 1) { - $this->correct = false; - } else{ - $bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format); - } - - mysqli_free_result($selectSession); - - } else if ($option == "del"){ - $bd->deleteSession($id); - - } else if ($option == "edit"){ - $bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format); + $selectSession = $bd->selectSession($cinema, $hall, $start, $date); + if($selectSession && $selectSession->num_rows >= 1) { + $this->correct = false; + } else{ + $bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format); } - if($repeat > "0"){ - $repeat--; - $date = date('Y-m-d', strtotime( $date. ' +1 day') ); - $this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat); - } - */ - } + mysqli_free_result($selectSession); - } else {$this->correct = false;} + } else if ($option == "del"){ + $bd->deleteSession($id); + + } else if ($option == "edit"){ + $bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format); + } + + if($repeat > "0"){ + $repeat--; + $date = date('Y-m-d', strtotime( $date. ' +1 day') ); + $this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat); + } + */ + } } } diff --git a/panel_manager/includes/processForm.php b/panel_manager/includes/processForm.php new file mode 100644 index 0000000..542c400 --- /dev/null +++ b/panel_manager/includes/processForm.php @@ -0,0 +1,12 @@ + "new","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => "1"); + FormHall::processesForm($data); + } + +?> \ No newline at end of file