2021-04-10 20:54:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once('session_dao.php');
|
|
|
|
|
|
|
|
|
|
|
|
class ListSessions{
|
|
|
|
|
|
|
|
//Atributes:
|
|
|
|
private $array;
|
|
|
|
private $size;
|
|
|
|
|
|
|
|
//Constructor:
|
2021-04-11 17:58:01 +02:00
|
|
|
public function __construct() {
|
2021-04-10 20:54:56 +02:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-04-11 17:58:01 +02:00
|
|
|
|
|
|
|
//Update the array with new values
|
|
|
|
public function filterList($cinema, $hall, $date) {
|
|
|
|
|
|
|
|
$date = date('Y-m-d', strtotime( $date ) );
|
2021-04-10 20:54:56 +02:00
|
|
|
|
|
|
|
$bd = new sessionDAO('complucine');
|
|
|
|
|
|
|
|
if($bd){
|
2021-04-11 17:58:01 +02:00
|
|
|
$selectSession = $bd->selectSession($cinema, $hall, null, $date);
|
2021-04-10 20:54:56 +02:00
|
|
|
$selectSession->data_seek(0);
|
|
|
|
$this->size = 0;
|
|
|
|
while ($fila = $selectSession->fetch_assoc()) {
|
2021-04-11 17:58:01 +02:00
|
|
|
$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']);
|
2021-04-10 20:54:56 +02:00
|
|
|
$this->size++;
|
|
|
|
}
|
|
|
|
mysqli_free_result($selectSession);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|