Add files via upload

This commit is contained in:
Markines16 2021-05-13 14:06:07 +02:00 committed by GitHub
parent 2925084c7c
commit d2c4fdd77f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 30 deletions

View File

@ -28,7 +28,6 @@
$bd = new HallDAO('complucine'); $bd = new HallDAO('complucine');
if($bd ) if($bd )
return $bd->getAllHalls($cinema); return $bd->getAllHalls($cinema);
return "";
} }
public static function create_hall($number, $cinema, $rows, $cols, $seats, $seats_map){ public static function create_hall($number, $cinema, $rows, $cols, $seats, $seats_map){

View File

@ -42,19 +42,23 @@
return $hall; return $hall;
} }
//Returns the count of the hall searched
public function searchHall($number, $cinema){ public function searchHall($number, $cinema){
$sql = sprintf( "SELECT COUNT(*) FROM hall WHERE $sql = sprintf( "SELECT * FROM hall WHERE
number = '%s' AND idcinema = '%s'", number = '%s' AND idcinema = '%s'",
$number, $cinema); $number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = false;
$hall = mysqli_fetch_array($resul); if($resul){
if($resul->num_rows == 1){
mysqli_free_result($resul); $fila = $resul->fetch_assoc();
$hall = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
return $hall[0]; }
$resul->free();
}
return $hall;
} }

View File

@ -30,7 +30,6 @@
if($bd ) { if($bd ) {
return $bd->getAllSessions($hall, $cinema, $date); return $bd->getAllSessions($hall, $cinema, $date);
} }
return "";
} }
public static function create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat){ public static function create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat){
@ -59,10 +58,12 @@
$bd = new SessionDAO('complucine'); $bd = new SessionDAO('complucine');
if($bd ){ if($bd ){
if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){ if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){
$origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date); if(!$bd->searchSession($cinema,$hall,$start,$date)){
$bd->editSession($film, $hall, $cinema, $date, $origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
$start, $price, $format,$origin); $bd->editSession($film, $hall, $cinema, $date, $start, $price, $format,$origin);
return "Se ha editado la session con exito"; return "Se ha editado la session con exito";
}else
return "Ya existe una sesion con los parametros nuevos";
} else } else
return "Esta session no existe"; return "Esta session no existe";
@ -87,23 +88,6 @@
if($bd ) { if($bd ) {
return $bd->filmTittle($idfilm); return $bd->filmTittle($idfilm);
} }
return "";
}
public static function getThisSessionId($cinema, $hall, $start, $date){
$bd = new SessionDAO('complucine');
if($bd ) {
return $bd->searchSession($cinema, $hall, $start, $date);
}
return "";
}
public static function getThisSessionFromId($id){
$bd = new SessionDAO('complucine');
if($bd ) {
return $bd->sessionData($id);
}
return "";
} }
public function setId($id){ $this->_id = $id; } public function setId($id){ $this->_id = $id; }