2021-03-26 15:45:16 +01:00
|
|
|
<?php
|
2021-04-15 20:53:01 +02:00
|
|
|
//General Config File:
|
|
|
|
require_once('../assets/php/config.php');
|
2021-04-13 21:16:07 +02:00
|
|
|
|
2021-04-15 20:53:01 +02:00
|
|
|
include_once('./includes/hall_dto.php');
|
|
|
|
include_once('./includes/formHall.php');
|
|
|
|
|
|
|
|
include_once('./includes/session_dto.php');
|
|
|
|
include_once('./includes/formSession.php');
|
2021-04-14 19:59:52 +02:00
|
|
|
|
2021-04-15 20:53:01 +02:00
|
|
|
include_once('../panel_admin/includes/film_dto.php');
|
|
|
|
include_once('../panel_admin/includes/film_dao.php');
|
2021-04-10 20:54:56 +02:00
|
|
|
|
2021-04-13 21:16:07 +02:00
|
|
|
$formSession = new FormSession();
|
|
|
|
$formHall = new FormHall();
|
2021-04-11 17:58:01 +02:00
|
|
|
|
|
|
|
$placeholder_date = date("Y-m-d");
|
|
|
|
$placeholder_hall = "1";
|
2021-04-13 21:16:07 +02:00
|
|
|
$cinema = "1";
|
2021-04-14 19:59:52 +02:00
|
|
|
|
2021-04-13 21:16:07 +02:00
|
|
|
if(isset($_POST['filter'])) {
|
2021-04-11 17:58:01 +02:00
|
|
|
$placeholder_date = $_POST["date"];
|
|
|
|
$placeholder_hall = $_POST["hall"];
|
|
|
|
}
|
2021-04-14 19:59:52 +02:00
|
|
|
|
|
|
|
$formHall->processesForm(null, $cinema, null, null, "list");
|
|
|
|
$formSession->processesForm(null, null, $placeholder_hall, $cinema, $placeholder_date, null, null, null, null, "list");
|
|
|
|
|
2021-04-15 20:53:01 +02:00
|
|
|
echo"
|
|
|
|
<!--Session Filter -->
|
|
|
|
<div class = \"column middle\">
|
|
|
|
<form method=\"post\" id=\"addfilter\">
|
2021-04-11 17:58:01 +02:00
|
|
|
<input type=\"date\" name=\"date\" value=\"". $placeholder_date . "\" min=\"2021-01-01\" max=\"2031-12-31\">
|
|
|
|
<select name=\"hall\" class=\"button large\">";
|
|
|
|
|
2021-04-13 21:16:07 +02:00
|
|
|
foreach($formHall->getReply() as $r){
|
2021-04-12 17:21:59 +02:00
|
|
|
if($r->getNumber() == $placeholder_hall){
|
2021-04-11 17:58:01 +02:00
|
|
|
echo "
|
2021-04-12 17:21:59 +02:00
|
|
|
<option value=\"". $r->getNumber() ." \"selected> Sala ". $r->getNumber() . "</option>";
|
2021-04-11 17:58:01 +02:00
|
|
|
}else{
|
|
|
|
echo "
|
2021-04-12 17:21:59 +02:00
|
|
|
<option value=\"". $r->getNumber() ." \"> Sala ". $r->getNumber() . "</option>";
|
2021-04-11 17:58:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
2021-04-15 20:53:01 +02:00
|
|
|
</select>
|
2021-04-13 21:16:07 +02:00
|
|
|
<input type=\"submit\" name=\"filter\" value=\"Filtrar\" class=\"button large\" />
|
2021-04-15 20:53:01 +02:00
|
|
|
</form>
|
|
|
|
</div>";
|
|
|
|
|
2021-04-14 19:59:52 +02:00
|
|
|
function drawSessions($sessions,$bd){
|
2021-04-13 21:16:07 +02:00
|
|
|
echo " <!--Session List -->
|
2021-04-15 20:53:01 +02:00
|
|
|
<div class=\"column side\">
|
2021-04-13 21:16:07 +02:00
|
|
|
<table class='alt'>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Hora</th>
|
|
|
|
<th>Pelicula</th>
|
|
|
|
<th>Formato</th>
|
|
|
|
<th>Precio</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>";
|
|
|
|
foreach($sessions as $s){
|
2021-04-14 19:59:52 +02:00
|
|
|
$film = mysqli_fetch_array($bd->FilmData($s->getIdfilm()));
|
2021-04-11 17:58:01 +02:00
|
|
|
echo "
|
2021-04-13 21:16:07 +02:00
|
|
|
<tr>
|
2021-04-14 19:59:52 +02:00
|
|
|
<td> " . date('H:i', strtotime( $s->getStartTime())) . "</a></td>
|
|
|
|
<td> " . str_replace('_', ' ', $film["tittle"]) . "</a></td>
|
|
|
|
<td> " . $s->getFormat() . "</a></td>
|
|
|
|
<td> " . $s->getSeatPrice() . "</a></td>
|
2021-04-15 20:53:01 +02:00
|
|
|
<form method=\"post\" action=\"./?state=edit_session&option=edit\">
|
|
|
|
|
|
|
|
<input name=\"id\" type=\"hidden\" value=\"".$s->getId()."\">
|
|
|
|
<input name=\"idfilm\" type=\"hidden\" value=\"".$s->getIdfilm()."\">
|
|
|
|
<input name=\"idhall\" type=\"hidden\" value=\"".$s->getIdhall()."\">
|
|
|
|
<input name=\"idcinema\" type=\"hidden\" value=\"".$s->getIdcinema()."\">
|
|
|
|
<input name=\"date\" type=\"hidden\" value=\"".$s->getDate()."\">
|
|
|
|
<input name=\"start\" type=\"hidden\" value=\"".$s->getStartTime()."\">
|
|
|
|
<input name=\"price\" type=\"hidden\" value=\"".$s->getSeatPrice()."\">
|
|
|
|
<input name=\"format\" type=\"hidden\" value=\"".$s->getFormat()."\">
|
|
|
|
|
|
|
|
<td> <input type=\"submit\" id=\"submit\" value=\"Editar\" class=\"button\" > </td>
|
|
|
|
</form>
|
2021-04-13 21:16:07 +02:00
|
|
|
</tr>";
|
2021-04-11 17:58:01 +02:00
|
|
|
}
|
|
|
|
echo "
|
2021-04-13 21:16:07 +02:00
|
|
|
<tbody>
|
|
|
|
</table>
|
2021-04-15 20:53:01 +02:00
|
|
|
<input type=\"submit\" name=\"submit\" form=\"addfilter\" value=\"Añadir\" class=\"button large\" formaction=\"./?state=edit_session&option=new\">
|
2021-04-13 21:16:07 +02:00
|
|
|
</div>";
|
2021-04-11 19:55:21 +02:00
|
|
|
|
2021-04-11 17:58:01 +02:00
|
|
|
}
|
2021-04-14 19:59:52 +02:00
|
|
|
if($formSession->getReply()){
|
|
|
|
$bd = new Film_DAO('complucine');
|
|
|
|
if($bd){
|
|
|
|
drawSessions($formSession->getReply(), $bd);
|
|
|
|
} else {
|
|
|
|
echo "<div class=\"column side\">
|
|
|
|
<p> Hay un error en la conexion </p>
|
|
|
|
</div>";
|
|
|
|
}
|
2021-04-13 21:16:07 +02:00
|
|
|
} else {
|
2021-04-15 20:53:01 +02:00
|
|
|
echo "
|
|
|
|
|
|
|
|
<div class=\"column side\">
|
|
|
|
<p> No hay ninguna session en la sala ". $placeholder_hall . " el dia ". $placeholder_date . "</p>
|
|
|
|
<input type=\"submit\" name=\"submit\" form=\"addfilter\" value=\"Añadir\" class=\"button large\" formaction=\"./?state=edit_session&option=new\">
|
|
|
|
</div>";
|
2021-04-13 21:16:07 +02:00
|
|
|
}
|
2021-04-15 20:53:01 +02:00
|
|
|
?>
|