Add files via upload
This commit is contained in:
parent
7c130693fe
commit
aacb6886bc
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once('../assets/php/common/hall_dao.php');
|
include_once($prefix.'assets/php/common/hall_dao.php');
|
||||||
|
|
||||||
class Hall{
|
class Hall{
|
||||||
|
|
||||||
@ -25,6 +25,18 @@
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function create_hall($hall){
|
||||||
|
$bd = new HallDAO('complucine');
|
||||||
|
if($bd ){
|
||||||
|
if(!$bd->searchHall($hall['cinema'], $hall['number'])){
|
||||||
|
$bd->createHall($hall['number'], $hall['cinema'], $hall['cols'], $hall['rows']);
|
||||||
|
return "Se ha creado la sala con exito";
|
||||||
|
} else {
|
||||||
|
return "Esta sala ya existe";
|
||||||
|
}
|
||||||
|
} else { return "Error al conectarse a la base de datos"; }
|
||||||
|
}
|
||||||
|
|
||||||
//Getters && Setters:
|
//Getters && Setters:
|
||||||
public function setNumber($number){ $this->_number = $number; }
|
public function setNumber($number){ $this->_number = $number; }
|
||||||
public function getNumber(){ return $this->_number; }
|
public function getNumber(){ return $this->_number; }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../assets/php/dao.php');
|
require_once($prefix.'assets/php/dao.php');
|
||||||
include_once('hall.php');
|
include_once('hall.php');
|
||||||
|
|
||||||
class HallDAO extends DAO {
|
class HallDAO extends DAO {
|
||||||
@ -17,10 +17,12 @@
|
|||||||
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`)
|
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`)
|
||||||
VALUES ( '%d', '%d', '%i', '%i')",
|
VALUES ( '%d', '%d', '%i', '%i')",
|
||||||
$number, $idcinema, $numRows, $numCol );
|
$number, $idcinema, $numRows, $numCol );
|
||||||
|
|
||||||
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns a query to get the halls data.
|
//Returns a query to get the halls data.
|
||||||
public function getAllHalls($cinema){
|
public function getAllHalls($cinema){
|
||||||
$sql = sprintf( "SELECT * FROM hall WHERE
|
$sql = sprintf( "SELECT * FROM hall WHERE
|
||||||
@ -39,7 +41,24 @@
|
|||||||
|
|
||||||
return $hall;
|
return $hall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Returns the count of the hall searched
|
||||||
|
public function searchHall($number, $cinema){
|
||||||
|
|
||||||
|
$sql = sprintf( "SELECT COUNT(*) FROM hall WHERE
|
||||||
|
idcinema = '%s' AND number = '%s'",
|
||||||
|
$cinema, $number);
|
||||||
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
|
$hall = mysqli_fetch_array($resul);
|
||||||
|
|
||||||
|
mysqli_free_result($resul);
|
||||||
|
|
||||||
|
return $hall[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Create a new Hall Data Transfer Object.
|
//Create a new Hall Data Transfer Object.
|
||||||
public function loadHall($number, $idcinema, $numrows, $numcolumns){
|
public function loadHall($number, $idcinema, $numrows, $numcolumns){
|
||||||
return new Hall($number, $idcinema, $numrows, $numcolumns);
|
return new Hall($number, $idcinema, $numrows, $numcolumns);
|
||||||
|
Loading…
Reference in New Issue
Block a user