Add files via upload

This commit is contained in:
OscarRui 2021-05-13 10:12:09 +02:00 committed by GitHub
parent 4228691615
commit 29011f52ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,18 +33,17 @@
return ""; return "";
} }
public static function create_session($session){ public static function create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat){
$bd = new SessionDAO('complucine'); $bd = new SessionDAO('complucine');
if($bd ){ if($bd ){
if(!$bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){ if(!$bd->searchSession($cinema, $hall, $start, $date)){
$bd->createSession(null,$session['film'], $session['hall'], $session['cinema'], $session['date'], $bd->createSession(null,$film, $hall, $cinema, $date, $start, $price, $format);
$session['start'], $session['price'], $session['format']);
if($repeat > "0") {
if($session['repeat'] > "0") { $repeats = $repeat;
$repeat = $session['repeat']; $repeat = $repeat - 1;
$session['repeat'] = $session['repeat'] - 1; $date = date('Y-m-d', strtotime( $date . ' +1 day') );
$session['date'] = date('Y-m-d', strtotime( $session['date'] . ' +1 day') ); self::create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat);
self::create_session($session);
return "Se han creado las ".$repeat ." sesiones con exito"; return "Se han creado las ".$repeat ." sesiones con exito";
} }
@ -56,13 +55,13 @@
} else return "Error al conectarse a la base de datos"; } else return "Error al conectarse a la base de datos";
} }
public static function edit_session($session){ public static function edit_session($cinema, $or_hall, $or_date, $or_start, $hall, $start, $date, $film, $price, $format){
$bd = new SessionDAO('complucine'); $bd = new SessionDAO('complucine');
if($bd ){ if($bd ){
if($bd->searchSession($session['cinema'], $session['origin_hall'],$session['origin_start'],$session['origin_date'])){ if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){
$origin = array("cinema" => $session['cinema'],"hall" => $session['origin_hall'],"start" => $session['origin_start'],"date" => $session['origin_date']); $origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
$bd->editSession($session['film'], $session['hall'], $session['cinema'], $session['date'], $bd->editSession($film, $hall, $cinema, $date,
$session['start'], $session['price'], $session['format'],$origin); $start, $price, $format,$origin);
return "Se ha editado la session con exito"; return "Se ha editado la session con exito";
} else } else
return "Esta session no existe"; return "Esta session no existe";
@ -70,11 +69,11 @@
} else return "Error al conectarse a la base de datos"; } else return "Error al conectarse a la base de datos";
} }
public static function delete_session($session){ public static function delete_session($cinema, $hall, $start, $date){
$bd = new SessionDAO('complucine'); $bd = new SessionDAO('complucine');
if($bd ){ if($bd ){
if($bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){ if($bd->searchSession($cinema, $hall, $start, $date)){
$bd->deleteSession($session['hall'], $session['cinema'], $session['date'], $session['start']); $bd->deleteSession($hall, $cinema, $date, $start);
return "Se ha eliminado la session con exito"; return "Se ha eliminado la session con exito";
} else } else
return "Esta session no existe"; return "Esta session no existe";