Add files via upload

This commit is contained in:
OscarRui 2021-05-06 18:12:46 +02:00 committed by GitHub
parent bb2f0934dd
commit 0d7f34d1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 4 deletions

View File

@ -31,7 +31,7 @@ class FormSession extends Form {
<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\> <form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
<fieldset> <fieldset>
<legend>Datos</legend> <legend>Datos</legend>
<input type="number" name="price" value="'.$number.'" min="0" placeholder="Precio de la entrada" required/> <br> <input type="number" name="price" value="'.$price.'" min="0" placeholder="Precio de la entrada" required/> <br>
<input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" required/> <br> <input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" required/> <br>
<select name="hall" class="button large">'; <select name="hall" class="button large">';
foreach(Hall::getListHalls($cinema) as $hll){ foreach(Hall::getListHalls($cinema) as $hll){
@ -56,7 +56,11 @@ class FormSession extends Form {
$htmlform .= '<input type="number" name="repeat" value="" min="0" title="Añadir esta sesion durante los proximos X dias" min="0" max="31" placeholder="Añadir X dias"/> <br> $htmlform .= '<input type="number" name="repeat" value="" min="0" title="Añadir esta sesion durante los proximos X dias" min="0" max="31" placeholder="Añadir X dias"/> <br>
<button type="submit" name="new_session" class="button large">Crear</button><br>'; <button type="submit" name="new_session" class="button large">Crear</button><br>';
if($data['option'] == "edit_session") if($data['option'] == "edit_session")
$htmlform .= '<button type="submit" name="edit_session" class="button large">Editar</button><br> $htmlform .= '
<input name="origin_hall" type="hidden" value="'.$hall.'">
<input name="origin_date" type="hidden" value="'.$date.'">
<input name="origin_start" type="hidden" value="'.$start.'">
<button type="submit" name="edit_session" class="button large">Editar</button><br>
<button type="submit" name="delete_session" class="primary">Borrar</button><br>'; <button type="submit" name="delete_session" class="primary">Borrar</button><br>';
$htmlform .= ' $htmlform .= '
<input type="reset" value="Limpiar Campos" > <input type="reset" value="Limpiar Campos" >
@ -86,8 +90,13 @@ class FormSession extends Form {
if($data["option"] == "new_session"){ if($data["option"] == "new_session"){
$_SESSION['msg'] = Session::create_session($data); $_SESSION['msg'] = Session::create_session($data);
header( "Location: ../?state=success" ); header( "Location: ../?state=success" );
}else { }else if($data["option"] == "edit_session"){
$_SESSION['msg'] = Session::edit_session($data);
header( "Location: ../?state=success" );
}
else if($data["option"] == "delete_session") {
$_SESSION['msg'] = Session::delete_session($data);
header( "Location: ../?state=success" );
} }
} }
} }

View File

@ -16,4 +16,17 @@
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]); ,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]);
FormSession::processesForm($data); FormSession::processesForm($data);
} }
if(isset($_POST['edit_session'])){
$data = array("option" => "edit_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"]
, "origin_hall"=> $_POST["origin_hall"],"origin_date"=> $_POST["origin_date"],"origin_start"=> $_POST["origin_start"]);
FormSession::processesForm($data);
}
if(isset($_POST['delete_session'])){
$data = array("option" => "delete_session","cinema" => $_SESSION["cinema"], "hall"=> $_POST["origin_hall"]
,"date"=> $_POST["origin_date"],"start"=> $_POST["origin_start"]);
FormSession::processesForm($data);
}
?> ?>