Add files via upload
This commit is contained in:
@ -22,6 +22,25 @@
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
//Returns the hall's data by ID.
|
||||
public function HallData($id){
|
||||
$id = $this->mysqli->real_escape_string($id);
|
||||
|
||||
$sql = sprintf( "SELECT * FROM hall WHERE number = '%d'", $id );
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
$resul->data_seek(0);
|
||||
$hall = null;
|
||||
while ($fila = $resul->fetch_assoc()) {
|
||||
$hall = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
|
||||
}
|
||||
|
||||
//mysqli_free_result($selectUser);
|
||||
$resul->free();
|
||||
|
||||
return $hall;
|
||||
}
|
||||
|
||||
//Returns a query to get the halls data.
|
||||
public function getAllHalls($cinema){
|
||||
|
43
assets/php/includes/purchase.php
Normal file
43
assets/php/includes/purchase.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class Purchase {
|
||||
|
||||
//Attributes:
|
||||
private $_idUser; //User Id.
|
||||
private $_idSession; //Session Id.
|
||||
private $_idHall; //Hall Id.
|
||||
private $_idCinema; //Cinema Id.
|
||||
private $_numRow; //Number of row seat.
|
||||
private $_numColumn; //Number of column seat.
|
||||
private $_timePurchase; //Time of purchase.
|
||||
|
||||
//Constructor:
|
||||
function __construct($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
|
||||
$this->_idUser = $idUser;
|
||||
$this->_idSession = $idSession;
|
||||
$this->_idHall = $idHall;
|
||||
$this->_idCinema = $idCinema;
|
||||
$this->_numRow = $row;
|
||||
$this->_numColumn = $column;
|
||||
$this->_timePurchase = $time;
|
||||
}
|
||||
|
||||
//Methods:
|
||||
|
||||
//Getters && Setters:
|
||||
public function setUserId($idUser){ $this->_idUser = $id; }
|
||||
public function getUserId(){ return $this->_idUser; }
|
||||
public function setSessionId($idSession){ $this->_idSession = $idSession; }
|
||||
public function getSessionId(){ return $this->_idSession; }
|
||||
public function setHallId($idHall){ $this->_idHall = $idHall; }
|
||||
public function getHallId(){ return $this->_idHall; }
|
||||
public function setCinemaId($idCinema){ $this->_idCinema = $idCinema; }
|
||||
public function getCinemaId(){ return $this->_idCinema; }
|
||||
public function setRow($row){ $this->_numRow = $row; }
|
||||
public function getRow(){ return $this->_numRow; }
|
||||
public function setColumn($column){ $this->_numColumn = $column; }
|
||||
public function getColumn(){ return $this->_numColumn; }
|
||||
public function setTime($time){ $this->_timePurchase = $time; }
|
||||
public function getTime(){ return $this->_timePurchase; }
|
||||
|
||||
}
|
||||
?>
|
46
assets/php/includes/purchase_dao.php
Normal file
46
assets/php/includes/purchase_dao.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
include_once('purchase.php');
|
||||
|
||||
class PurchaseDAO extends DAO {
|
||||
|
||||
//Attributes:
|
||||
|
||||
//Constructor:
|
||||
function __construct($bd_name){
|
||||
parent::__construct($bd_name);
|
||||
}
|
||||
|
||||
//Methods:
|
||||
|
||||
//Create a new Purchase.
|
||||
public function createPurchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
|
||||
$sql = sprintf( "INSERT INTO purchase( iduser, idsession, idhall, idcinema, numrow, numcolum, time_purchase )
|
||||
VALUES ( '%d', '%d', '%d', '%d', '%d', '%d', '%s' )",
|
||||
$idUser, $idSession, $idHall, $idCinema, $row, $column, $time );
|
||||
|
||||
$resul = mysqli_query($this->mysqli, $sql);
|
||||
|
||||
return $resul;
|
||||
}
|
||||
|
||||
//All purchases of one user.
|
||||
public function allPurchasesData($idUser){
|
||||
$sql = sprintf( "SELECT * FROM purchase WHERE iduser = '%d' ", $idUser);
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
$purchases = null;
|
||||
while($fila=$resul->fetch_assoc()){
|
||||
$purchases[] = $this->loadPurchase($fila["iduser"], $fila["idsession"], $fila["idhall"], $fila["idcinema"], $fila["numrow"], $fila["numcolum"], $fila["time_purchase"]);
|
||||
}
|
||||
$resul->free();
|
||||
return $purchases;
|
||||
}
|
||||
|
||||
//Create a new User Data Transfer Object.
|
||||
public function loadPurchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time){
|
||||
return new Purchase($idUser, $idSession, $idHall, $idCinema, $row, $column, $time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -120,5 +120,8 @@
|
||||
public function setFormat($format){ $this->_format = $format; }
|
||||
public function getFormat(){ return $this->_format; }
|
||||
|
||||
public function setSeatsFull($bool){ $this->_seats_full = $bool; }
|
||||
public function getSeatsFull(){ return $this->_seats_full; }
|
||||
|
||||
}
|
||||
?>
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
<?php
|
||||
class User {
|
||||
|
||||
//Attributes:
|
||||
|
Reference in New Issue
Block a user