This commit is contained in:
OscarRui 2021-06-04 11:36:15 +02:00 committed by GitHub
parent a45a525e67
commit 22977e8091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 18 deletions

View File

@ -11,7 +11,7 @@
//Methods:
//Create a new Hall.
//Create a new hall taking the new number,cinema, rows, cols, seats and seats map saving in the database
public function createHall($number, $cinema, $rows, $cols, $seats, $seats_map){
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`, `total_seats`)
@ -60,7 +60,7 @@
return $hall;
}
//Search a hall
//Returns a hall data taking the number and cinema
public function searchHall($number, $cinema){
$sql = sprintf( "SELECT * FROM hall WHERE
@ -87,7 +87,7 @@
return new Hall($number, $idcinema, $numrows, $numcolumns, $total_seats, $seats_map);
}
//Edit Hall.
//Edit a hall taking the new number, rows, cols ans seats with respect to its origin parameter
public function editHall($number, $cinema, $rows, $cols, $seats, $og_number){
$sql = sprintf( "UPDATE `hall`
@ -101,7 +101,7 @@
return $resul;
}
//Delete Hall.
//Delete a hall whit the primary key
public function deleteHall($number, $cinema){
$sql = sprintf( "DELETE FROM `hall` WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",$number, $cinema);

View File

@ -10,7 +10,7 @@
//Methods:
//Returns a query to get All the managers.
//Returns a query to get all the manager's data.
public function allManagersData(){
$sql = sprintf( "SELECT * FROM `users` JOIN `manager` ON manager.id = users.id");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -22,21 +22,21 @@
return $managers;
}
//Returns a manager data .
//Returns a manager data taking the id
public function GetManager($id){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a manager data .
//Returns a manager data
public function GetManagerCinema($id, $idcinema){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d' AND manager.idcinema ='%d'", $id, $idcinema );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Session.
//Create a new Manager with a new id and id cinema
public function createManager($id, $idcinema){
$sql = sprintf( "INSERT INTO `manager`( `id`, `idcinema`)
VALUES ( '%d', '%d')",
@ -56,7 +56,7 @@
return $resul;
}
//Edit manager.
//Edit manager by "id" and "idcinema"
public function editManager($id, $idcinema){
$sql = sprintf( "UPDATE `manager` SET manager.idcinema = '%d'
WHERE manager.id = '%d';",

View File

@ -10,7 +10,7 @@
//Methods:
//Create a new Seat.
//Create a new Seat taking the new hall,cinema,row,col and state saving in the database
public function createSeat($hall, $cinema, $row, $col, $state){
$sql = sprintf( "INSERT INTO `seat`( `idhall`, `idcinema`, `numrow`, `numcolum`, `active`)
@ -22,7 +22,7 @@
return $sql;
}
//search all Seat
//Returns a query to get all the seat's data.
public function getAllSeats($number, $cinema){
$sql = sprintf( "SELECT * FROM seat WHERE
@ -39,7 +39,7 @@
return $seat_map;
}
//Delete a Seat
//Delete a Seat whit the primary key
public function deletemapSeats($hall, $cinema){
$sql = sprintf( "DELETE FROM `seat` WHERE
idcinema = '%s' AND idhall = '%s'",

View File

@ -8,7 +8,7 @@
}
//Methods:
//Create a new Session
//Create a new Session taking the new id,film, hall, cinema, date, start time, seat price and format saving in the database
public function createSession($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
@ -36,7 +36,7 @@
return $session;
}
//Search for a title
//Look for a tittle with the id film
public function filmTittle($idfilm){
$sql = sprintf("SELECT * FROM film JOIN session ON film.id = session.idfilm WHERE session.idfilm = '%d' ", $idfilm );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $idfilm);
@ -46,7 +46,7 @@
return $resul;
}
//Returns a session
//Look for a session with the primary key
public function searchSession($cinema, $hall, $startTime, $date){
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
@ -70,7 +70,6 @@
$date = $date->format("Y-m-d");
$end = $end->format("Y-m-d");
// su output es date: 2021-05-30 end: 2021-07-11
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date BETWEEN '%s' AND '%s' ORDER BY start_time ASC;",
$cinema, $hall, $date, $end);
@ -115,7 +114,7 @@
return $sessions;
}
//Edit Session.
//Edit a session taking the new film, hall, date, start time, seat price and format with respect to its origin parameter
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
@ -133,7 +132,7 @@
return $resul;
}
//Delete Session
//Delete a session whit the primary key
public function deleteSession($hall, $cinema, $date, $startTime){
$sql = sprintf( "DELETE FROM `session` WHERE