Add files via upload
This commit is contained in:
parent
1c5e449cdb
commit
cdb9b25754
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once('film_dto.php');
|
include_once('film_dto.php');
|
||||||
$template = new Template();
|
|
||||||
$prefix = $template->get_prefix();
|
|
||||||
include_once($prefix.'assets/php/dao.php');
|
include_once($prefix.'assets/php/dao.php');
|
||||||
|
|
||||||
class Film_DAO extends DAO {
|
class Film_DAO extends DAO {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
public function createHall($number, $idcinema, $numCol, $numRows){
|
public function createHall($number, $idcinema, $numCol, $numRows){
|
||||||
|
|
||||||
$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', '%d', '%d')",
|
||||||
$number, $idcinema, $numRows, $numCol );
|
$number, $idcinema, $numRows, $numCol );
|
||||||
|
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?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{
|
||||||
|
|
||||||
private $_id;
|
private $_id;
|
||||||
@ -21,6 +25,46 @@
|
|||||||
$this->_format = $format;
|
$this->_format = $format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getListSessions($hall,$cinema,$date){
|
||||||
|
$bd = new SessionDAO('complucine');
|
||||||
|
if($bd ) {
|
||||||
|
return $bd->getAllSessions($hall, $cinema, $date);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_session($session){
|
||||||
|
$bd = new SessionDAO('complucine');
|
||||||
|
if($bd ){
|
||||||
|
if(!$bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){
|
||||||
|
$bd->createSession(null,$session['film'], $session['hall'], $session['cinema'], $session['date'],
|
||||||
|
$session['start'], $session['price'], $session['format']);
|
||||||
|
|
||||||
|
if($session['repeat'] > "0") {
|
||||||
|
$repeat = $session['repeat'];
|
||||||
|
$session['repeat'] = $session['repeat'] - 1;
|
||||||
|
$session['date'] = date('Y-m-d', strtotime( $session['date'] . ' +1 day') );
|
||||||
|
self::create_session($session);
|
||||||
|
return "Se han creado las ".$repeat ." sesiones con exito";
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return "Se ha creado la session con exito";
|
||||||
|
} else
|
||||||
|
return "Esta session ya existe";
|
||||||
|
|
||||||
|
} else return "Error al conectarse a la base de datos";
|
||||||
|
}
|
||||||
|
//Esto deberia estar en film.php? seguramente
|
||||||
|
public static function getFilmTitle($idfilm){
|
||||||
|
$bd = new Film_DAO('complucine');
|
||||||
|
if($bd ) {
|
||||||
|
$film = mysqli_fetch_array($bd->FilmData($idfilm));
|
||||||
|
return $film["tittle"];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public function setId($id){ $this->_id = $id; }
|
public function setId($id){ $this->_id = $id; }
|
||||||
public function getId(){ return $this->_id; }
|
public function getId(){ return $this->_id; }
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../assets/php/dao.php');
|
require_once($prefix.'assets/php/dao.php');
|
||||||
include_once('session_dto.php');
|
include_once('session.php');
|
||||||
|
|
||||||
class SessionDAO extends DAO {
|
class SessionDAO extends DAO {
|
||||||
//Constructor:
|
//Constructor:
|
||||||
@ -48,13 +48,12 @@
|
|||||||
|
|
||||||
return $session[0];
|
return $session[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns a query to get all the session's data.
|
//Returns a query to get all the session's data.
|
||||||
public function getAllSessionsFromACinemaHallDate($cinema, $hall, $date){
|
public function getAllSessions($hall, $cinema, $date){
|
||||||
$date = date('Y-m-d', strtotime( $date ) );
|
$date = date('Y-m-d', strtotime( $date ) );
|
||||||
|
|
||||||
$sql = sprintf( "SELECT * FROM session WHERE
|
$sql = sprintf( "SELECT * FROM session WHERE
|
||||||
idcinema = '%s' AND idhall = '%s' AND date = '%s'",
|
idcinema = '%s' AND idhall = '%s' AND date = '%s' ORDER BY start_time ASC;",
|
||||||
$cinema, $hall, $date);
|
$cinema, $hall, $date);
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
@ -98,7 +97,7 @@
|
|||||||
|
|
||||||
//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){
|
||||||
return new SessionDTO( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
|
return new Session( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user