Add files via upload

This commit is contained in:
OscarRui 2021-05-07 19:07:03 +02:00 committed by GitHub
parent 59a89cff30
commit 3e48951b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 3 deletions

View File

@ -35,6 +35,11 @@ class FormHall extends Form {
'; ';
if($data['option'] == "new_hall") if($data['option'] == "new_hall")
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button><br>'; $htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button><br>';
if($data['option'] == "edit_hall"){
$htmlform .= '
<button type="submit" name="edit_hall" class="button large">Editar</button><br>
<button type="submit" name="delete_hall" class="primary">Borrar</button><br>';
}
$htmlform .= ' $htmlform .= '
</fieldset> </fieldset>
@ -80,8 +85,13 @@ class FormHall extends Form {
if($data["option"] == "new_hall"){ if($data["option"] == "new_hall"){
$_SESSION['msg'] = Hall::create_hall($data); $_SESSION['msg'] = Hall::create_hall($data);
header( "Location: ../?state=success" ); 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" );
} }
} }
} }

View File

@ -20,6 +20,25 @@
FormHall::processesForm($data); 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'])){ if(isset($_POST['new_session'])){
$data = array("option" => "new_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"] $data = array("option" => "new_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]); ,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]);