This commit is contained in:
OscarRui 2021-06-08 12:44:47 +02:00 committed by GitHub
parent 5f1b02a3b3
commit 97d271bbee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,9 +18,9 @@ class FormHall extends Form {
$this->og_hall = $hall; $this->og_hall = $hall;
if($option == "edit_hall") if($option == "edit_hall")
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing"); $options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing=true");
else else
$options = array("action" => "./?state=".$option."&number=".$hall->getNumber().""); $options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing=false");
parent::__construct('formHall',$options); parent::__construct('formHall',$options);
} }
@ -183,25 +183,25 @@ class FormHall extends Form {
if (empty($number) && isset($datos["sumbit"])) { if (empty($number) && isset($datos["sumbit"])) {
$result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>"; $result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>";
} }
if(isset($datos["restart"])){ else if (count($result) === 0 && isset($datos["sumbit"]) ) {
return $result = "./?state=".$this->option."&number=".$this->og_hall->getNumber()."";
}
if (count($result) === 0 && isset($datos["sumbit"]) ) {
if($this->option == "new_hall"){ if($this->option == "new_hall"){
$msg = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map); $_SESSION['msg'] = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map);
return $result = './?state=success&msg='.$msg; $result = './?state=success';
} }
if($this->option == "edit_hall"){ else if($this->option == "edit_hall"){
$msg = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber()); $_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
return $result = './?state=success&msg='.$msg; $result = './?state=success';
} }
} }
if (!isset($result['number']) && isset($datos["delete"]) ) { else if (!isset($result['number']) && isset($datos["delete"]) ) {
if($this->option == "edit_hall"){ if($this->option == "edit_hall"){
$msg = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber()); $_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $this->og_hall->getNumber());
return $result = './?state=success&msg='.$msg; $result = './?state=success';
} }
} }
else if(isset($datos["restart"])){
$result = "./?state=".$this->option."&number=".$this->og_hall->getNumber()."";
}
return $result; return $result;