diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php index 8e6b0bb..fdb13ca 100644 --- a/panel_manager/includes/formHall.php +++ b/panel_manager/includes/formHall.php @@ -4,105 +4,42 @@ include_once($prefix.'assets/php/form.php'); class FormHall extends Form { - //Atributes: - private $correct; - private $reply; - private $option; - private $halls; - //Constructor: public function __construct() { - parent::__construct('formSession'); - $this->reply = array(); + parent::__construct('formHall'); } - public static function generaCampoFormulario($datos, $errores = array(), $option){ - if($option == "new"){ - $number = $datos['number'] ?? ''; - $rows = $datos['rows'] ?? ''; - $cols = $datos['cols'] ?? ''; - $seats = $datos['seats'] ?? ''; - - - $htmlform .= ' -
- '; - } + public static function generaCampoFormulario($data, $errores = array()){ + + $number = $data['number'] ?? ''; + $rows = $data['rows'] ?? ''; + $cols = $data['cols'] ?? ''; + $seats = $data['seats'] ?? ''; + $htmlform .= ''; return $htmlform; } //Methods: - //Returns validation response: - public function getReply() { - - if($this->correct){ - if($this->option == "new"){ - $this->reply = "Se ha añadido la sala correctamente en la base de datos.
- "; - }else if($this->option == "edit"){ - $this->reply = "Se ha editado la sala correctamente en la base de datos.
- "; - }else if($this->option == "del"){ - $this->reply = "Se ha eliminado la sala correctamente en la base de datos.
- "; - }else if($this->option == "list"){ - $this->reply = $this->halls; - } - } else { - $this->reply = "Ha habido un error en la operacion. Revisa los datos introducidos o ponte en contacto con el administrador de la base de datos.
- "; - } - return $this->reply; - } - //Process form: public static function processesForm($data){ - if($data["option"] == "new"){ - Hall::create_hall($data); - $_SESSION['msg'] = "La sala se ha añadido correctamente"; + if($data["option"] == "new_hall"){ + $_SESSION['msg'] = Hall::create_hall($data); header( "Location: ../?state=success" ); }else { - /* TODO - $start = date('H:i:s', strtotime( $start ) ); - 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); - } - - 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/formSession.php b/panel_manager/includes/formSession.php index ac81f3c..9fb5b8c 100644 --- a/panel_manager/includes/formSession.php +++ b/panel_manager/includes/formSession.php @@ -1,81 +1,94 @@ reply = array(); } - //Methods: - public function getReply() { - if($this->correct){ - if($this->option == "new"){ - $this->reply = "Se ha añadido la sesion correctamente en la base de datos.
- "; - }else if($this->option == "edit"){ - $this->reply = "Se ha editado la sesion correctamente en la base de datos.
- "; - }else if($this->option == "del"){ - $this->reply = "Se ha eliminado la sesion correctamente en la base de datos.
- "; - }else if($this->option == "list"){ - $this->reply = $this->sessions; - } - } else if($this->correct == false) { - $this->reply = "Ha habido un error en la operacion. Revisa los datos introducidos o ponte en contacto con el administrador de la base de datos.
- "; - } - return $this->reply; - } - - public function processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat, $option) { - $this->option = $option; - $this->correct = true; - - $bd = new sessionDAO('complucine'); - - if($bd ){ - if($option == "list"){ - $this->sessions = $bd->getAllSessionsFromACinemaHallDate($cinema, $hall, $date); - - }else { - if($option == "new"){ - $searchSession = $bd->searchSession($cinema, $hall, $start, $date); - if($searchSession) { - $this->correct = false; - } else{ - $bd->createSession(null,$film, $hall,$cinema, $date, $start, $price, $format); - } - - } else if ($option == "del"){ - $bd->deleteSession($hall, $cinema, $date, $start); - - } else if ($option == "edit"){ - $bd->editSession($film, $hall, $cinema, $date, $start, $price, $format); + public static function generaCampoFormulario($data, $errores = array()){ + $cinema = $data['cinema'] ?? ''; + $film = $data['film'] ?? '1'; + $hall = $data['hall'] ?? '1'; + $date = $data['date'] ?? ''; + $start = $data['start'] ?? ''; + $price = $data['price'] ?? ''; + $format = $data['format'] ?? ''; + + $filmList = new Film_DAO('complucine'); + $films = $filmList->allFilmData(); + + $htmlform .= 'En desarrollo...
Usuario: '.$name.'
-Espero que estes pasando un buen dia
-En desarrollo...
+