Add files via upload
This commit is contained in:
parent
42d084ec5a
commit
68860539da
64
panel_manager/includes/hall_dao.php
Normal file
64
panel_manager/includes/hall_dao.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
require_once('../assets/php/dao.php');
|
||||
include_once('hall_dto.php');
|
||||
|
||||
class HallDAO extends DAO {
|
||||
|
||||
//Constructor:
|
||||
function __construct($bd_name){
|
||||
parent::__construct($bd_name);
|
||||
}
|
||||
|
||||
//Methods:
|
||||
|
||||
//Create a new Hall.
|
||||
public function createHall($number, $idcinema, $numCol, $numRows){
|
||||
|
||||
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`)
|
||||
VALUES ( '%d', '%d', '%i', '%i')",
|
||||
$number, $idcinema, $numRows, $numCol );
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
//Returns a query to get the halls data.
|
||||
public function hallData($id,$idcinema){
|
||||
$sql = sprintf( "SELECT * FROM `hall`
|
||||
WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",
|
||||
$id, $idcinema );
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
return $resul;
|
||||
}
|
||||
|
||||
//Create a new Hall Data Transfer Object.
|
||||
public function loadHall($id, $idcinema, $numCol, $numRows){
|
||||
return new HallDTO($id, $idcinema, $numCol, $numRows);
|
||||
}
|
||||
|
||||
//Edit Hall.
|
||||
public function editHall($id, $idcinema, $numCol, $numRows){
|
||||
|
||||
$sql = sprintf( "UPDATE `hall`
|
||||
SET `numrows` = '%i' , `numcolumns` = '%i'
|
||||
WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",
|
||||
$numRows,$numCol,$id, $idcinema );
|
||||
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
return $resul;
|
||||
}
|
||||
|
||||
//Delete Hall.
|
||||
public function deleteHall($id, $idcinema){
|
||||
|
||||
$sql = sprintf( "DELETE FROM `hall` WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",$id,$idcinema);
|
||||
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
return $resul;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
37
panel_manager/includes/hall_dto.php
Normal file
37
panel_manager/includes/hall_dto.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
include_once('hall_dto_interface.php');
|
||||
|
||||
class HallDTO implements HallsDTO {
|
||||
|
||||
//Attributes:
|
||||
private $_number; //Room number.
|
||||
private $_idcinema; //Cinema Id
|
||||
private $_numCol; //Num columns.
|
||||
private $_numRows; //Num rows.
|
||||
|
||||
|
||||
//Constructor:
|
||||
function __construct($number, $idcinema, $numCol, $numRows){
|
||||
$this->_number = $number;
|
||||
$this->_idcinema = $idcinema;
|
||||
$this->_numCol = $numCol;
|
||||
$this->_numRows = $numRows;
|
||||
}
|
||||
|
||||
//Methods:
|
||||
|
||||
//Getters && Setters:
|
||||
public function setNumber($number){ $this->_number = $number; }
|
||||
public function getNumber(){ return $this->_number; }
|
||||
|
||||
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/hall_dto_interface.php
Normal file
12
panel_manager/includes/hall_dto_interface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
interface HallsDTO {
|
||||
public function setNumber($number);
|
||||
public function getNumber();
|
||||
public function setIdcinema($idcinema);
|
||||
public function getIdcinema();
|
||||
public function setNumCol($numCol);
|
||||
public function getNumCol();
|
||||
public function setNumRows($numRows);
|
||||
public function getNumRows();
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user