Add files via upload
This commit is contained in:
parent
43219ccefa
commit
62db2dcd23
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once('../assets/php/common/hall_dao.php');
|
include_once($prefix.'assets/php/common/hall_dao.php');
|
||||||
include_once('../assets/php/form.php');
|
include_once($prefix.'assets/php/form.php');
|
||||||
|
|
||||||
class FormHall extends Form {
|
class FormHall extends Form {
|
||||||
|
|
||||||
@ -16,14 +16,8 @@ class FormHall extends Form {
|
|||||||
$this->reply = array();
|
$this->reply = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generaCamposFormulario($datos, $errores = array()){
|
public static function generaCampoFormulario($datos, $errores = array(), $option){
|
||||||
$this->option = $_SESSION['option'];
|
if($option == "new"){
|
||||||
$_SESSION['option'] = "";
|
|
||||||
$htmlform = "";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($this->option == "new"){
|
|
||||||
$number = $datos['number'] ?? '';
|
$number = $datos['number'] ?? '';
|
||||||
$rows = $datos['rows'] ?? '';
|
$rows = $datos['rows'] ?? '';
|
||||||
$cols = $datos['cols'] ?? '';
|
$cols = $datos['cols'] ?? '';
|
||||||
@ -31,13 +25,15 @@ class FormHall extends Form {
|
|||||||
|
|
||||||
|
|
||||||
$htmlform .= '
|
$htmlform .= '
|
||||||
<fieldset>
|
<form method="post" id="new_hall" action="./includes/processForm.php"\>
|
||||||
<label>Numero de sala:</label> <input type="text" name="number" value="'.$number.'"/> <br>
|
<fieldset>
|
||||||
<label>Filas:</label> <input type="text" name="rows" value= "'.$rows.'"/><br>
|
<label>Numero de sala:</label> <input type="number" name="number" value="'.$number.'" required/> <br>
|
||||||
<label>Columnas:</label> <input type="text" name="cols" value= "'.$cols.'"/><br>
|
<label>Filas:</label> <input type="number" name="rows" value= "'.$rows.'" required/><br>
|
||||||
<label>Butacas totales:</label> <input type="text" name="seats" value= "'.$seats.'"/><br>
|
<label>Columnas:</label> <input type="number" name="cols" value= "'.$cols.'" required/><br>
|
||||||
<button type="submit" name="newHall">Crear</button></div><br>
|
<label>Butacas totales:</label> <input type="number" name="seats" value= "'.$seats.'"/><br>
|
||||||
</fieldset>
|
<button type="submit" name="new_hall" class="button large">Crear</button></div><br>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,45 +70,40 @@ class FormHall extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Process form:
|
//Process form:
|
||||||
public function processesForm($datos){
|
public static function processesForm($data){
|
||||||
$this->correct = true;
|
if($data["option"] == "new"){
|
||||||
$bd = new HallDAO('complucine');
|
Hall::create_hall($data);
|
||||||
|
$_SESSION['msg'] = "La sala se ha añadido correctamente";
|
||||||
|
header( "Location: ../?state=success" );
|
||||||
|
}else {
|
||||||
|
/* TODO
|
||||||
|
$start = date('H:i:s', strtotime( $start ) );
|
||||||
|
|
||||||
|
if($option == "new"){
|
||||||
|
|
||||||
if($bd ){
|
$selectSession = $bd->selectSession($cinema, $hall, $start, $date);
|
||||||
if($option == "list"){
|
if($selectSession && $selectSession->num_rows >= 1) {
|
||||||
$this->halls = $bd->getAllHalls($cinema);
|
$this->correct = false;
|
||||||
}else {
|
} else{
|
||||||
/* TODO
|
$bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format);
|
||||||
$start = date('H:i:s', strtotime( $start ) );
|
|
||||||
|
|
||||||
if($option == "new"){
|
|
||||||
|
|
||||||
$selectSession = $bd->selectSession($cinema, $hall, $start, $date);
|
|
||||||
if($selectSession && $selectSession->num_rows >= 1) {
|
|
||||||
$this->correct = false;
|
|
||||||
} else{
|
|
||||||
$bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format);
|
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_free_result($selectSession);
|
|
||||||
|
|
||||||
} else if ($option == "del"){
|
|
||||||
$bd->deleteSession($id);
|
|
||||||
|
|
||||||
} else if ($option == "edit"){
|
|
||||||
$bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($repeat > "0"){
|
mysqli_free_result($selectSession);
|
||||||
$repeat--;
|
|
||||||
$date = date('Y-m-d', strtotime( $date. ' +1 day') );
|
} else if ($option == "del"){
|
||||||
$this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat);
|
$bd->deleteSession($id);
|
||||||
}
|
|
||||||
*/
|
} else if ($option == "edit"){
|
||||||
|
$bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {$this->correct = false;}
|
if($repeat > "0"){
|
||||||
|
$repeat--;
|
||||||
|
$date = date('Y-m-d', strtotime( $date. ' +1 day') );
|
||||||
|
$this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
panel_manager/includes/processForm.php
Normal file
12
panel_manager/includes/processForm.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
//General Config File:
|
||||||
|
require_once('../../assets/php/config.php');
|
||||||
|
$prefix ="../../";
|
||||||
|
include_once('formHall.php');
|
||||||
|
|
||||||
|
if(isset($_POST['new_hall'])){
|
||||||
|
$data = array("option" => "new","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => "1");
|
||||||
|
FormHall::processesForm($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user