Add files via upload
This commit is contained in:
parent
31c54a5a0c
commit
2f4d5234ba
39
panel_manager/includes/room_dao.php
Normal file
39
panel_manager/includes/room_dao.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
require_once('../assets/php/dao.php');
|
||||||
|
include_once('room_dto.php');
|
||||||
|
|
||||||
|
class RoomDAO extends DAO {
|
||||||
|
|
||||||
|
//Constructor:
|
||||||
|
function __construct($bd_name){
|
||||||
|
parent::__construct($bd_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Methods:
|
||||||
|
|
||||||
|
//Create a new Room.
|
||||||
|
public function createRoom($id, $idcinema, $numCol, $numRows){
|
||||||
|
|
||||||
|
$sql = sprintf( "INSERT INTO rooms( id, idcinema, numCol, numRows)
|
||||||
|
VALUES ( '%s', '%s', '%i', '%i')",
|
||||||
|
$id, $idcinema, $numCol, $numRows );
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Returns a query to get the room's data.
|
||||||
|
public function roomData($id){
|
||||||
|
$sql = sprintf( "SELECT * FROM rooms WHERE id = '%d'", $id );
|
||||||
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
|
return $resul;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a new Room Data Transfer Object.
|
||||||
|
public function loadRoom($id, $idcinema, $numCol, $numRows){
|
||||||
|
return new RoomDTO($id, $idcinema, $numCol, $numRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
37
panel_manager/includes/room_dto.php
Normal file
37
panel_manager/includes/room_dto.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
include_once('room_dto_interface.php');
|
||||||
|
|
||||||
|
class RoomDTO implements RoomsDTO {
|
||||||
|
|
||||||
|
//Attributes:
|
||||||
|
private $_id; //Room Id.
|
||||||
|
private $_idcinema; //Cinema Id
|
||||||
|
private $_numCol; //Num columns.
|
||||||
|
private $_numRows; //Num rows.
|
||||||
|
|
||||||
|
|
||||||
|
//Constructor:
|
||||||
|
function __construct($id, $idcinema, $numCol, $numRows){
|
||||||
|
$this->_id = $id;
|
||||||
|
$this->_idcinema = $idcinema;
|
||||||
|
$this->_numCol = $numCol;
|
||||||
|
$this->_numRows = $numRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Methods:
|
||||||
|
|
||||||
|
//Getters && Setters:
|
||||||
|
public function setId($id){ $this->_id = $id; }
|
||||||
|
public function getId(){ return $this->_id; }
|
||||||
|
|
||||||
|
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
|
||||||
|
public function getIdcinema(){ return $this->_idcinema; }
|
||||||
|
|
||||||
|
public function setNumCol($numCol){ $this->_numCol = $numCol; }
|
||||||
|
public function getNumCol(){ return $this->_numCol; }
|
||||||
|
|
||||||
|
public function setNumRows($numRows){ $this->_numRows = $numRows; }
|
||||||
|
public function getNumRows(){ return $this->_numRows; }
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
12
panel_manager/includes/room_dto_interface.php
Normal file
12
panel_manager/includes/room_dto_interface.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
interface RoomsDTO {
|
||||||
|
public function setId($id);
|
||||||
|
public function getId();
|
||||||
|
public function setIdcinema($idcinema);
|
||||||
|
public function getIdcinema();
|
||||||
|
public function setNumCol($numCol);
|
||||||
|
public function getNumCol();
|
||||||
|
public function setNumRows($numRows);
|
||||||
|
public function getNumRows();
|
||||||
|
}
|
||||||
|
?>
|
39
panel_manager/includes/session_dao.php
Normal file
39
panel_manager/includes/session_dao.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
require_once('../assets/php/dao.php');
|
||||||
|
include_once('session_dto.php');
|
||||||
|
|
||||||
|
class SessionDAO extends DAO {
|
||||||
|
|
||||||
|
//Constructor:
|
||||||
|
function __construct($bd_name){
|
||||||
|
parent::__construct($bd_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Methods:
|
||||||
|
|
||||||
|
//Create a new Session.
|
||||||
|
public function createSession($id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format){
|
||||||
|
|
||||||
|
$sql = sprintf( "INSERT INTO sessions( $id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format)
|
||||||
|
VALUES ( '%s', '%s', '%s', '%date', '%time', '%d', '%s')",
|
||||||
|
$id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format );
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Returns a query to get the session's data.
|
||||||
|
public function sessionData($id){
|
||||||
|
$sql = sprintf( "SELECT * FROM sessions WHERE id = '%d'", $id );
|
||||||
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
|
return $resul;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a new Session Data Transfer Object.
|
||||||
|
public function loadSession( $id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format){
|
||||||
|
return new SessionDTO( $id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
51
panel_manager/includes/session_dto.php
Normal file
51
panel_manager/includes/session_dto.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
include_once('session_dto_interface.php');
|
||||||
|
|
||||||
|
class SessionDTO implements SessionsDTO {
|
||||||
|
|
||||||
|
//Attributes:
|
||||||
|
private $_id; //Session Id.
|
||||||
|
private $_idfilm; //Film Id
|
||||||
|
private $_idhall //Hall id
|
||||||
|
private $_date; //Session date.
|
||||||
|
private $_startTime; //Session start time.
|
||||||
|
private $_seatPrice; //Seat price.
|
||||||
|
private $_format; //Type of film: 3D | 4D | normal | subtitle | mute.
|
||||||
|
|
||||||
|
//Constructor:
|
||||||
|
function __construct($id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format){
|
||||||
|
$this->_id = $id;
|
||||||
|
$this->_idfilm = $idfilm;
|
||||||
|
$this->_idhall = $idhall;
|
||||||
|
$this->_date = $date;
|
||||||
|
$this->_startTime = $startTime;
|
||||||
|
$this->_seatPrice = $seatPrice;
|
||||||
|
$this->_format = $format;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Methods:
|
||||||
|
|
||||||
|
//Getters && Setters:
|
||||||
|
public function setId($id){ $this->_id = $id; }
|
||||||
|
public function getId(){ return $this->_id; }
|
||||||
|
|
||||||
|
public function setIdfilm($idfilm){ $this->_idfilm = $idfilm; }
|
||||||
|
public function getIdfilm(){ return $this->_idfilm; }
|
||||||
|
|
||||||
|
public function setIdhall($film){ $this->_idhall = $idhall; }
|
||||||
|
public function getIdhall(){ return $this->_idhall; }
|
||||||
|
|
||||||
|
public function setDate($date){ $this->_date = $date; }
|
||||||
|
public function getDate(){ return $this->_date; }
|
||||||
|
|
||||||
|
public function setStartTime($startTime){ $this->_startTime = $startTime; }
|
||||||
|
public function getStartTime(){ return $this->_startTime; }
|
||||||
|
|
||||||
|
public function setSeatPrice($seatPrice){ $this->_seatPrice = $seatPrice; }
|
||||||
|
public function getSeatPrice(){ return $this->_seatPrice; }
|
||||||
|
|
||||||
|
public function setFormat($format){ $this->_format = $format; }
|
||||||
|
public function getFormat(){ return $this->_format; }
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
18
panel_manager/includes/session_dto_interface.php
Normal file
18
panel_manager/includes/session_dto_interface.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
interface SessionsDTO {
|
||||||
|
public function setId($id);
|
||||||
|
public function getId();
|
||||||
|
public function setIdfilm($idfilm);
|
||||||
|
public function getIdfilm();
|
||||||
|
public function setIdhall($film);
|
||||||
|
public function getIdhall();
|
||||||
|
public function setDate($date);
|
||||||
|
public function getDate();
|
||||||
|
public function setStartTime($startTime);
|
||||||
|
public function getStartTime();
|
||||||
|
public function setSeatPrice($seatPrice);
|
||||||
|
public function getSeatPrice();
|
||||||
|
public function setFormat($format);
|
||||||
|
public function getFormat();
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user