Add files via upload
This commit is contained in:
		
							
								
								
									
										53
									
								
								panel_manager/includes/listFilms.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								panel_manager/includes/listFilms.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require('../panel_admin/includes/film_dao.php');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ListFilms{
 | 
			
		||||
	
 | 
			
		||||
    //Atributes:
 | 
			
		||||
	private $array;
 | 
			
		||||
	private $size;
 | 
			
		||||
 | 
			
		||||
    //Constructor:
 | 
			
		||||
    public function __construct() {
 | 
			
		||||
        $this->array = array();
 | 
			
		||||
		$this->updateArray();
 | 
			
		||||
    }
 | 
			
		||||
    //Methods:
 | 
			
		||||
 | 
			
		||||
    //Returns the whole session array
 | 
			
		||||
    public function getArray() {
 | 
			
		||||
        return $this->array;
 | 
			
		||||
    }
 | 
			
		||||
	
 | 
			
		||||
	//Returns the value i from the array
 | 
			
		||||
    public function getiArray($i) {
 | 
			
		||||
		if($i < $size){
 | 
			
		||||
			return $this->array($i);
 | 
			
		||||
		} else {
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Update the array with new values
 | 
			
		||||
    public function updateArray() {
 | 
			
		||||
		
 | 
			
		||||
		$bd = new Film_DAO('complucine');
 | 
			
		||||
		
 | 
			
		||||
		if($bd){
 | 
			
		||||
			$selectFilms = $bd->allFilmData();
 | 
			
		||||
			$selectFilms->data_seek(0);
 | 
			
		||||
			$this->size = 0;
 | 
			
		||||
			while ($fila = $selectFilms->fetch_assoc()) {
 | 
			
		||||
                $this->array[]= new Film_DTO($fila['id'], $fila['tittle'], $fila['duration'], $fila['language'], "no hay descripcion en la base de datos");
 | 
			
		||||
				$this->size++;
 | 
			
		||||
			}
 | 
			
		||||
			mysqli_free_result($selectFilms);	
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										55
									
								
								panel_manager/includes/listSessions.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								panel_manager/includes/listSessions.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
include_once('session_dao.php');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ListSessions{
 | 
			
		||||
	
 | 
			
		||||
    //Atributes:
 | 
			
		||||
	private $array;
 | 
			
		||||
	private $size;
 | 
			
		||||
 | 
			
		||||
    //Constructor:
 | 
			
		||||
    public function __construct() {
 | 
			
		||||
        $this->array = array();
 | 
			
		||||
    }
 | 
			
		||||
    //Methods:
 | 
			
		||||
 | 
			
		||||
    //Returns the whole session array
 | 
			
		||||
    public function getArray() {
 | 
			
		||||
        return $this->array;
 | 
			
		||||
    }
 | 
			
		||||
	
 | 
			
		||||
	//Returns the value i from the array
 | 
			
		||||
    public function getiArray($i) {
 | 
			
		||||
		if($i < $size){
 | 
			
		||||
			return $this->array($i);
 | 
			
		||||
		} else {
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Update the array with new values
 | 
			
		||||
    public function filterList($cinema, $hall, $date) {
 | 
			
		||||
 | 
			
		||||
        $date = date('Y-m-d', strtotime( $date ) );
 | 
			
		||||
		
 | 
			
		||||
		$bd = new sessionDAO('complucine');
 | 
			
		||||
		
 | 
			
		||||
		if($bd){
 | 
			
		||||
			$selectSession = $bd->selectSession($cinema, $hall, null, $date);
 | 
			
		||||
			$selectSession->data_seek(0);
 | 
			
		||||
			$this->size = 0;
 | 
			
		||||
			while ($fila = $selectSession->fetch_assoc()) {
 | 
			
		||||
                $this->array[]= new SessionDTO($fila['id'], $fila['idfilm'], $fila['idhall'], $fila['idcinema'], $fila['date'], date('H:i', strtotime( $fila['start_time'])) , $fila['seat_price'], $fila['format']);
 | 
			
		||||
				$this->size++;
 | 
			
		||||
			}
 | 
			
		||||
			mysqli_free_result($selectSession);	
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										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();
 | 
			
		||||
    }
 | 
			
		||||
?>
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
			$startTime = date('H:i:s', strtotime( $startTime ) );
 | 
			
		||||
			
 | 
			
		||||
			$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`) 
 | 
			
		||||
				VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%f', '%s')",
 | 
			
		||||
				VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s')",
 | 
			
		||||
					$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
 | 
			
		||||
			
 | 
			
		||||
			$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
 | 
			
		||||
@@ -75,7 +75,7 @@
 | 
			
		||||
			
 | 
			
		||||
            $sql = sprintf( "UPDATE `session`
 | 
			
		||||
                             SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
 | 
			
		||||
                                  `start_time` = '%s', `seat_price` = '%f', `format` = '%s'
 | 
			
		||||
                                  `start_time` = '%s', `seat_price` = '%d', `format` = '%s'
 | 
			
		||||
                             WHERE 
 | 
			
		||||
								idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", 
 | 
			
		||||
                $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user