2021-04-08 10:59:22 +02:00
< ? php
2021-04-12 17:21:59 +02:00
require ( './includes/hall_dto.php' );
2021-04-08 18:02:25 +02:00
require ( './includes/session_dto.php' );
2021-04-11 17:58:01 +02:00
require ( '../panel_admin/includes/film_dto.php' );
2021-04-11 19:55:21 +02:00
include_once ( './includes/session_dao.php' );
2021-04-10 20:54:56 +02:00
2021-04-12 17:21:59 +02:00
$r1 = new HallDTO ( 1 , 20 , 20 , 30 ); //Esto se deberia cambiar por una llamada a una lista de salas
$r2 = new HallDTO ( 2 , 10 , 30 , 30 );
2021-04-11 17:58:01 +02:00
$rooms = array ( $r1 , $r2 );
require_once ( './includes/listFilms.php' );
2021-04-12 17:21:59 +02:00
$filmList = new Film_DAO ( 'complucine' );
$films = $filmList -> allFilmData ();
2021-04-11 17:58:01 +02:00
2021-04-11 19:55:21 +02:00
//DISCLAIMER; sabemos que si se edita la ulr se pueden acceder a datos de una sesion que no pertenece al usuario y que incluso puede hasta editarlas/borrarlas en la base de datos
2021-04-10 20:54:56 +02:00
if ( isset ( $_REQUEST [ 'option' ]) && $_REQUEST [ 'option' ] == 'edit' ) {
2021-04-11 19:55:21 +02:00
$bd = new sessionDAO ( 'complucine' );
if ( $bd ){
$session = ( $bd -> sessionData ( $_GET [ " id " ])) -> fetch_assoc ();
echo " <h2>Editar/Eliminar Sesion</h2>
2021-04-13 21:16:07 +02:00
< form method = \ " post \" id= \" edit_ses \" action= \" validate.php \" >
2021-04-11 19:55:21 +02:00
< div class = \ " row \" >
< fieldset id = \ " datos \" >
< legend > Datos </ legend >
< input type = \ " hidden \" name= \" cinema \" value = \" 1 \" />
< input type = \ " hidden \" name= \" id \" value = \" " . $_GET [ " id " ] . " \" />
< div class = \ " _price \" >
< input type = \ " number \" name= \" price \" id= \" price \" value= \" " . $session [ 'seat_price' ] . " \" min= \" 0 \" placeholder= \" Precio de la entrada \" required/>
</ div >
< select name = \ " hall \" class= \" button large \" > " ;
foreach ( $rooms as $r ){
2021-04-12 17:21:59 +02:00
if ( $r -> getNumber () == $session [ 'idhall' ]){
echo " <option value= \" " . $r -> getNumber () . " \" selected> Sala " . $r -> getNumber () . " </option> " ;
2021-04-11 19:55:21 +02:00
} else {
2021-04-12 17:21:59 +02:00
echo " <option value= \" " . $r -> getNumber () . " \" > Sala " . $r -> getNumber () . " </option> " ;
2021-04-11 19:55:21 +02:00
}
}
echo " <div class= \" _format \" >
< input type = \ " text \" name= \" format \" id= \" format \" value= \" " . $session [ 'format' ] . " \" placeholder= \" Formato \" required/>
</ div >
</ fieldset >
< fieldset id = \ " Horario \" >
< legend > Horario </ legend >
< div class = \ " _start_time \" >
< input type = \ " time \" name= \" start \" id= \" start_time \" value= \" " . $session [ 'start_time' ] . " \" placeholder= \" Hora de inicio \" required/>
</ div >
< div class = \ " _date \" >
< input type = \ " date \" name= \" date \" id= \" date \" value= \" " . $session [ 'date' ] . " \" Fecha de inicio \" required/>
</ div >
< div class = \ " _repeat \" >
< br > Introducir un numero para añadir esta sesion a los futuros X dias
< input type = \ " number \" name= \" repeat \" id= \" repeat \" title= \" Repetir esta sesion durante X dias \" min= \" 0 \" max= \" 31 \" placeholder= \" Repetir X dias \" />
</ div >
</ fieldset >
< div class = \ " actions \" >
< input type = \ " submit \" name= \" edit \" value= \" Editar \" class= \" primary \" />
< input type = \ " reset \" id= \" reset \" value= \" Limpiar \" />
< input type = \ " submit \" name= \" del \" value= \" Eliminar \" class= \" primary \" />
</ div >
</ div >
</ form >
< div >
< div class = \ " column side \" >
2021-04-13 21:16:07 +02:00
< select name = \ " film \" form= \" edit_ses \" class= \" button large \" > " ;
2021-04-11 19:55:21 +02:00
foreach ( $films as $f ){
if ( $f -> getId () == $session [ 'idfilm' ]){
echo " <option value= \" " . $f -> getId () . " \" selected> " . $f -> getId () . " | " . $f -> getTittle () . " Idioma: " . $f -> getLanguage () . " </option> " ;
} else {
echo " <option value= \" " . $f -> getId () . " \" > " . $f -> getId () . " | " . $f -> getTittle () . " Idioma: " . $f -> getLanguage () . " </option> " ;
}
}
echo " </div> " ;
}
}
2021-04-10 20:54:56 +02:00
else {
2021-04-10 21:08:48 +02:00
echo " <h2>Crear Sesion</h2>
2021-04-13 21:16:07 +02:00
< form method = \ " post \" id= \" new_ses \" action= \" validateSession.php \" >
2021-04-10 20:54:56 +02:00
< div class = \ " row \" >
< fieldset id = \ " datos \" >
< legend > Datos </ legend >
2021-04-11 17:58:01 +02:00
< input type = \ " hidden \" name= \" cinema \" value = \" 1 \" />
2021-04-10 20:54:56 +02:00
< div class = \ " _price \" >
< input type = \ " number \" name= \" price \" id= \" price \" min= \" 0 \" placeholder= \" Precio de la entrada \" required/>
</ div >
2021-04-11 17:58:01 +02:00
< select name = \ " hall \" class= \" button large \" > " ;
foreach ( $rooms as $r ){
if ( $r -> getid () == $_POST [ 'hall' ]){
echo " <option value= \" " . $r -> getid () . " \" selected> Sala " . $r -> getid () . " </option> " ;
} else {
echo " <option value= \" " . $r -> getid () . " \" > Sala " . $r -> getid () . " </option> " ;
}
}
echo " <div class= \" _format \" >
2021-04-10 20:54:56 +02:00
< input type = \ " text \" name= \" format \" id= \" format \" value= \" \" placeholder= \" Formato \" required/>
</ div >
</ fieldset >
< fieldset id = \ " Horario \" >
< legend > Horario </ legend >
< div class = \ " _start_time \" >
< input type = \ " time \" name= \" start \" id= \" start_time \" value= \" \" placeholder= \" Hora de inicio \" required/>
</ div >
2021-04-11 17:58:01 +02:00
< div class = \ " _date \" >
< input type = \ " date \" name= \" date \" id= \" date \" value= \" " . $_POST [ 'date' ] . " \" Fecha de inicio \" required/>
</ div >
2021-04-11 19:55:21 +02:00
< div class = \ " _repeat \" >
< br > Introducir un numero para añadir esta sesion a los futuros X dias
< input type = \ " number \" name= \" repeat \" id= \" repeat \" title= \" Repetir esta sesion durante X dias \" min= \" 0 \" max= \" 31 \" placeholder= \" Repetir X dias \" />
</ div >
2021-04-10 20:54:56 +02:00
</ fieldset >
< div class = \ " actions \" >
2021-04-11 19:55:21 +02:00
< input type = \ " submit \" name= \" new \" value= \" Añadir \" class= \" primary \" />
< input type = \ " reset \" id= \" reset \" value= \" Limpiar \" />
2021-04-10 20:54:56 +02:00
</ div >
</ div >
2021-04-11 17:58:01 +02:00
</ form >
< div >
< div class = \ " column side \" >
< select name = \ " film \" form= \" new_ses \" class= \" button large \" > " ;
foreach ( $films as $f ){
echo " <option value= \" " . $f -> getId () . " \" > " . $f -> getId () . " | " . $f -> getTittle () . " Idioma: " . $f -> getLanguage () . " </option> " ;
}
echo " </div> " ;
2021-04-10 20:54:56 +02:00
}
2021-04-11 17:58:01 +02:00
2021-04-10 20:54:56 +02:00
?>
2021-04-08 18:02:25 +02:00