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")
$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 .= '
</fieldset>
@ -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" );
}
}
}

View File

@ -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"]