2021-04-26 22:40:34 +02:00
|
|
|
<?php
|
2021-05-05 16:52:04 +02:00
|
|
|
include_once($prefix.'assets/php/common/hall_dao.php');
|
|
|
|
include_once($prefix.'assets/php/form.php');
|
2021-04-26 22:40:34 +02:00
|
|
|
|
|
|
|
class FormHall extends Form {
|
|
|
|
|
|
|
|
//Constructor:
|
|
|
|
public function __construct() {
|
2021-05-05 21:10:46 +02:00
|
|
|
parent::__construct('formHall');
|
2021-04-26 22:40:34 +02:00
|
|
|
}
|
2021-05-03 12:40:59 +02:00
|
|
|
|
2021-05-05 21:10:46 +02:00
|
|
|
public static function generaCampoFormulario($data, $errores = array()){
|
|
|
|
|
|
|
|
$number = $data['number'] ?? '';
|
|
|
|
$rows = $data['rows'] ?? '';
|
|
|
|
$cols = $data['cols'] ?? '';
|
|
|
|
$seats = $data['seats'] ?? '';
|
2021-05-03 12:40:59 +02:00
|
|
|
|
2021-05-05 21:10:46 +02:00
|
|
|
$htmlform .= '<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
|
|
|
|
<fieldset>
|
|
|
|
<input type="number" name="number" value="'.$number.'" min="1" placeholder="Numero de la sala" required/> <br>
|
|
|
|
<input type="number" name="rows" value= "'.$rows.'" min="1" placeholder="Filas" required/><br>
|
|
|
|
<input type="number" name="cols" value= "'.$cols.'" min="1" placeholder="Columnas" required/><br>
|
|
|
|
<input type="number" name="seats" value= "'.$seats.'" min="1" placeholder="Total de butacas?" /><br>
|
|
|
|
';
|
|
|
|
if($data['option'] == "new_hall")
|
|
|
|
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button></div><br>';
|
2021-05-03 12:40:59 +02:00
|
|
|
|
2021-05-05 21:10:46 +02:00
|
|
|
$htmlform .= '
|
|
|
|
</fieldset>
|
|
|
|
</form>';
|
2021-05-03 12:40:59 +02:00
|
|
|
return $htmlform;
|
|
|
|
}
|
2021-04-26 22:40:34 +02:00
|
|
|
//Methods:
|
|
|
|
|
|
|
|
//Process form:
|
2021-05-05 16:52:04 +02:00
|
|
|
public static function processesForm($data){
|
2021-05-05 21:10:46 +02:00
|
|
|
if($data["option"] == "new_hall"){
|
|
|
|
$_SESSION['msg'] = Hall::create_hall($data);
|
2021-05-05 16:52:04 +02:00
|
|
|
header( "Location: ../?state=success" );
|
|
|
|
}else {
|
2021-05-04 22:26:24 +02:00
|
|
|
|
2021-05-05 16:52:04 +02:00
|
|
|
}
|
2021-04-26 22:40:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|