Add files via upload
This commit is contained in:
parent
fe520f1495
commit
7be148840e
@ -8,6 +8,7 @@
|
|||||||
private $_idcinema; //Cinema Id
|
private $_idcinema; //Cinema Id
|
||||||
private $_numRows; //Num rows.
|
private $_numRows; //Num rows.
|
||||||
private $_numCol; //Num columns.
|
private $_numCol; //Num columns.
|
||||||
|
private $_total_seats;
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
function __construct($number, $idcinema, $numRows, $numCol){
|
function __construct($number, $idcinema, $numRows, $numCol){
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once($prefix.'assets/php/common/session_dao.php');
|
include_once($prefix.'assets/php/common/session_dao.php');
|
||||||
include_once($prefix.'panel_admin/includes/film.php');
|
|
||||||
include_once($prefix.'assets/php/common/film_dao.php');
|
|
||||||
|
|
||||||
class Session{
|
class Session{
|
||||||
|
|
||||||
@ -13,8 +11,9 @@
|
|||||||
private $_startTime;
|
private $_startTime;
|
||||||
private $_seatPrice;
|
private $_seatPrice;
|
||||||
private $_format;
|
private $_format;
|
||||||
|
private $_seats_full;
|
||||||
|
|
||||||
function __construct($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
|
function __construct($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
$this->_idfilm = $idfilm;
|
$this->_idfilm = $idfilm;
|
||||||
$this->_idhall = $idhall;
|
$this->_idhall = $idhall;
|
||||||
@ -23,6 +22,7 @@
|
|||||||
$this->_startTime = $startTime;
|
$this->_startTime = $startTime;
|
||||||
$this->_seatPrice = $seatPrice;
|
$this->_seatPrice = $seatPrice;
|
||||||
$this->_format = $format;
|
$this->_format = $format;
|
||||||
|
$this->_seats_full = $seats_full;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getListSessions($hall,$cinema,$date){
|
public static function getListSessions($hall,$cinema,$date){
|
||||||
@ -83,11 +83,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Esto deberia estar en film.php? seguramente
|
//Esto deberia estar en film.php? seguramente
|
||||||
public static function getFilmTitle($idfilm){
|
public static function getThisSessionFilm($idfilm){
|
||||||
$bd = new Film_DAO('complucine');
|
$bd = new SessionDAO('complucine');
|
||||||
if($bd ) {
|
if($bd ) {
|
||||||
$film = mysqli_fetch_array($bd->FilmData($idfilm));
|
return $bd->filmTittle($idfilm);
|
||||||
return $film["tittle"];
|
}
|
||||||
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
$date = date('Y-m-d', strtotime( $date ) );
|
$date = date('Y-m-d', strtotime( $date ) );
|
||||||
$startTime = date('H:i:s', strtotime( $startTime ) );
|
$startTime = date('H:i:s', strtotime( $startTime ) );
|
||||||
|
|
||||||
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`)
|
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`, `seats_full`)
|
||||||
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s')",
|
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')",
|
||||||
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
|
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, "0");
|
||||||
|
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
@ -28,25 +28,35 @@
|
|||||||
$sql = sprintf( "SELECT * FROM `session` WHERE id = '%d'", $id );
|
$sql = sprintf( "SELECT * FROM `session` WHERE id = '%d'", $id );
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $id);
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $id);
|
||||||
|
|
||||||
|
$resul = mysqli_fetch_array($resul);
|
||||||
|
|
||||||
return $resul;
|
return $resul;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the count of the session searched
|
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);
|
||||||
|
|
||||||
|
$resul = mysqli_fetch_array($resul);
|
||||||
|
|
||||||
|
return $resul;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Returns a session
|
||||||
public function searchSession($cinema, $hall, $startTime, $date){
|
public function searchSession($cinema, $hall, $startTime, $date){
|
||||||
$date = date('Y-m-d', strtotime( $date ) );
|
$date = date('Y-m-d', strtotime( $date ) );
|
||||||
$startTime = date('H:i:s', strtotime( $startTime ) );
|
$startTime = date('H:i:s', strtotime( $startTime ) );
|
||||||
|
|
||||||
$sql = sprintf( "SELECT COUNT(*) FROM session WHERE
|
$sql = sprintf( "SELECT * FROM session WHERE
|
||||||
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
|
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
|
||||||
$cinema, $hall, $date, $startTime);
|
$cinema, $hall, $date, $startTime);
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
$session = null;
|
|
||||||
$session = mysqli_fetch_array($resul);
|
$session = mysqli_fetch_array($resul);
|
||||||
|
|
||||||
mysqli_free_result($resul);
|
mysqli_free_result($resul);
|
||||||
|
|
||||||
return $session[0];
|
return $session;
|
||||||
}
|
}
|
||||||
//Returns a query to get all the session's data.
|
//Returns a query to get all the session's data.
|
||||||
public function getAllSessions($hall, $cinema, $date){
|
public function getAllSessions($hall, $cinema, $date){
|
||||||
@ -60,7 +70,7 @@
|
|||||||
$sessions = null;
|
$sessions = null;
|
||||||
|
|
||||||
while($fila=mysqli_fetch_array($resul)){
|
while($fila=mysqli_fetch_array($resul)){
|
||||||
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"]);
|
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
|
||||||
}
|
}
|
||||||
mysqli_free_result($resul);
|
mysqli_free_result($resul);
|
||||||
|
|
||||||
@ -96,8 +106,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Create a new Session Data Transfer Object.
|
//Create a new Session Data Transfer Object.
|
||||||
public function loadSession( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
|
public function loadSession( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
|
||||||
return new Session( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
|
return new Session( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user