Cambios a la estructura del índex y sus vistas

This commit is contained in:
Markines16 2021-04-13 21:16:07 +02:00 committed by GitHub
parent b0cf43c313
commit e716de272f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 160 additions and 73 deletions

View File

@ -18,7 +18,7 @@
if($bd){ if($bd){
$session = ($bd->sessionData($_GET["id"]))->fetch_assoc(); $session = ($bd->sessionData($_GET["id"]))->fetch_assoc();
echo "<h2>Editar/Eliminar Sesion</h2> echo "<h2>Editar/Eliminar Sesion</h2>
<form method=\"post\" id=\"new_ses\" action=\"validate.php\"> <form method=\"post\" id=\"edit_ses\" action=\"validate.php\">
<div class=\"row\"> <div class=\"row\">
<fieldset id=\"datos\"> <fieldset id=\"datos\">
<legend>Datos</legend> <legend>Datos</legend>
@ -61,7 +61,7 @@
</form> </form>
<div> <div>
<div class=\"column side\"> <div class=\"column side\">
<select name=\"film\" form=\"new_ses\" class=\"button large\">"; <select name=\"film\" form=\"edit_ses\" class=\"button large\">";
foreach($films as $f){ foreach($films as $f){
if($f->getId() == $session['idfilm']){ if($f->getId() == $session['idfilm']){
echo "<option value=\"". $f->getId() ." \"selected> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>"; echo "<option value=\"". $f->getId() ." \"selected> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>";
@ -74,7 +74,7 @@
} }
else{ else{
echo "<h2>Crear Sesion</h2> echo "<h2>Crear Sesion</h2>
<form method=\"post\" id=\"new_ses\" action=\"validate.php\"> <form method=\"post\" id=\"new_ses\" action=\"validateSession.php\">
<div class=\"row\"> <div class=\"row\">
<fieldset id=\"datos\"> <fieldset id=\"datos\">
<legend>Datos</legend> <legend>Datos</legend>

View File

@ -0,0 +1,5 @@
<div class="column middle">
<h1> Bienvenido al panel de Gerente </h1>
<br>
<p> Espero que este pasando un buen dia <p>
</div>

View File

@ -58,9 +58,8 @@
</ul> </ul>
</div> </div>
<!--Contents --> <!--Contents -->
<div class="row"> <div class="row">
<div class="column middle"> <?php $panel->showPanel(); ?>
<?php $panel->showPanel(); ?>
</div> </div>
</div> </div>
<!-- Footer --> <!-- Footer -->

View File

@ -9,6 +9,7 @@
function drawHalls($ros){ function drawHalls($ros){
echo " echo "
<div class=\"column middle\">
<table class='alt'> <table class='alt'>
<thead> <thead>
<tr> <tr>
@ -30,8 +31,9 @@
} }
echo "<tbody> echo "<tbody>
</table>\n"; </table>\n";
echo "<a href=\"index.php?edit_sessions=true\" class='button large'>Añadir</a>"; echo "<a href=\"index.php?edit_sessions=true\" class='button large'>Añadir</a>
</div>";
} }
drawHalls($rooms); drawHalls($rooms);
?> ?>
</div>

View File

@ -1,34 +1,38 @@
<?php <?php
require('./includes/hall_dto.php'); require('./includes/hall_dto.php');
require('./includes/formHall.php');
require('./includes/session_dto.php'); require('./includes/session_dto.php');
require('./includes/formSession.php');
require('../panel_admin/includes/film_dto.php'); require('../panel_admin/includes/film_dto.php');
require('../panel_admin/includes/film_dao.php'); require('../panel_admin/includes/film_dao.php');
require_once('./includes/listSessions.php'); $formSession = new FormSession();
$sessionList = new ListSessions(); $formHall = new FormHall();
$placeholder_date = date("Y-m-d"); $placeholder_date = date("Y-m-d");
$placeholder_hall = "1"; $placeholder_hall = "1";
$filtered = false; $filtered = false;
$cinema = "1";
if(isset($_POST['submit'])) {
$sessionList->filterList(1,$_POST["hall"],$_POST["date"]); $formHall->processesForm(null, $cinema, null, null, "list");
if(isset($_POST['filter'])) {
$placeholder_date = $_POST["date"]; $placeholder_date = $_POST["date"];
$placeholder_hall = $_POST["hall"]; $placeholder_hall = $_POST["hall"];
$filtered = true; $filtered = true;
$formSession->processesForm(null, null, $placeholder_hall, $cinema, $placeholder_date, null, null, null, null, "list");
} }
$sessions = $sessionList->getArray(); echo" <form method=\"post\">
<!--Session Filter -->
$r1 = new HallDTO(1,20,20,30); //Esto se deberia cambiar por una llamada a una lista de salas <div class = \"column middle\">
$r2 = new HallDTO(2,10,30,30);
$rooms = array($r1, $r2);
echo"
<form method=\"post\">
<input type=\"date\" name=\"date\" value=\"". $placeholder_date . "\" min=\"2021-01-01\" max=\"2031-12-31\"> <input type=\"date\" name=\"date\" value=\"". $placeholder_date . "\" min=\"2021-01-01\" max=\"2031-12-31\">
<select name=\"hall\" class=\"button large\">"; <select name=\"hall\" class=\"button large\">";
foreach($rooms as $r){ foreach($formHall->getReply() as $r){
if($r->getNumber() == $placeholder_hall){ if($r->getNumber() == $placeholder_hall){
echo " echo "
<option value=\"". $r->getNumber() ." \"selected> Sala ". $r->getNumber() . "</option>"; <option value=\"". $r->getNumber() ." \"selected> Sala ". $r->getNumber() . "</option>";
@ -39,47 +43,46 @@
} }
echo " echo "
<input type=\"submit\" name=\"submit\" value=\"Filtrar\" class=\"button large\" /> <input type=\"submit\" name=\"filter\" value=\"Filtrar\" class=\"button large\" />
</div>"; </div>";
?> function drawSessions($sessions){
echo " <!--Session List -->
<div class="column side"> <?php <div class=\"column side\">
function drawSessions($ses,$bd){ <table class='alt'>
echo " <thead>
<table class='alt'> <tr>
<thead> <th>Hora</th>
<tr> <th>Pelicula</th>
<th>Hora</th> <th>Formato</th>
<th>Pelicula</th> <th>Precio</th>
<th>Formato</th> </tr>
<th>Precio</th> </thead>
</tr> <tbody>";
</thead> foreach($sessions as $s){
<tbody>";
foreach($ses as $s){
$fila = ($bd->FilmData($s->getIdfilm()))->fetch_assoc();
echo " echo "
<tr> <tr>
<td> <a href=\"./?state=edit_session&option=edit\">" . $s->getStartTime() . "</a></td> <td> " . $s->getStartTime() . "</a></td>
<td> <a href=\"./?state=edit_session&option=edit\">" .$fila['tittle'] . "</a></td> <td> " . $s->getIdfilm() . "</a></td>
<td> <a href=\"./?state=edit_session&option=edit\">". $s->getSeatPrice() . "</a></td> <td> ". $s->getSeatPrice() . "</a></td>
<td> <input type=\"submit\" name=\"submit\" value=\"Editar\" class=\"button\" formaction=\"./?state=edit_session&option=edit&id=". $s->getid() ."\"/> </td> <td> <input type=\"submit\" name=\"submit\" value=\"Editar\" class=\"button\" formaction=\"./?state=edit_session&option=edit&id=". $s->getid() ."\"/> </td>
</tr>"; </tr>";
} }
echo " echo "
<tbody> <tbody>
</table>"; </table>
} <input type=\"submit\" name=\"submit\" value=\"Añadir\" class=\"button large\" formaction=\"./?state=edit_session&option=new\">
if($filtered){ </div>";
$bd = new Film_DAO('complucine');
if($bd){
drawSessions($sessions,$bd);
echo "
<input type=\"submit\" name=\"submit\" value=\"Añadir\" class=\"button large\" formaction=\"./?state=edit_session&option=new\">";
}
} }
echo " </form> if($formSession->getReply() != null){
</div>"; drawSessions($formSession->getReply());
} else {
echo "<div class=\"column side\">
<p> No hay ninguna session en la sala ". $placeholder_hall . " el dia ". $placeholder_date . "</p>
";
}
echo "
</form>";
?> ?>

View File

@ -0,0 +1,5 @@
<div class="column middle">
<h1> Entrada Impedida </h1>
<br>
<p> No estas logeado como gerente >.< </p>
</div>

View File

@ -16,17 +16,11 @@
case 'rooms': require('manage_rooms.php'); break; case 'rooms': require('manage_rooms.php'); break;
case 'sessions': require('manage_sessions.php'); break; case 'sessions': require('manage_sessions.php'); break;
case 'edit_session': require('edit_sessions.php'); break; case 'edit_session': require('edit_sessions.php'); break;
default: echo "<h1>BIENVENIDO AL PANEL DE GERENTE </h1> default: require('hello_panel.php'); break;
<br>
<p> Espero que este pasando un buen dia </p>
</div>"; break;
} }
} }
else{ else{
echo "<h1>ERROR </h1> require('no_permisions_panel.php');
<br>
<p> No tiene permiso en esta sección de la pagina web </p>
</div>";
} }
} }
} }

View File

@ -1,4 +1,6 @@
<h1> Vista de usuario registrado </h1> <div class="column middle">
<br> <h1> Vista de usuario registrado </h1>
<p> Esta vista aun no esta implementada </p> <br>
<p> Esta vista aun no esta implementada </p>
</div>

View File

@ -1,3 +1,6 @@
<h1> Vista de usuario no registrado </h1>
<br> <div class="column middle">
<p> Esta vista aun no esta implementada </p> <h1> Vista de usuario no registrado </h1>
<br>
<p> Esta vista aun no esta implementada </p>
</div>

View File

@ -0,0 +1,74 @@
<?php
session_start();
//Depuración (BORRAR):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//HTML template:
require_once('../assets/php/template.php');
$template = new Template();
$action ="";
$id = null;
if(isset($_POST['new'])){
$action = "new";
} else if (isset($_POST['edit'])){
$action = "edit";
$id = $_POST["id"];
} else if (isset($_POST['del'])){
$action = "del";
$id = $_POST["id"];
}
//Login form validate:
require_once('./includes/formSession.php');
$session = new FormSession();
$session->processesForm($id, $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], $action);
$reply = $session->getReply();
?>
<!DOCTYPE HTML>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
</div>
<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
<?php
echo $reply;
?>
</div>
</div>
<div class="column side"></div>
</div>
</section>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>