Cambiada la estructura de todo el panel

Cambiada la estructura de index, añadidos archivos php con cada vista del panel principal
This commit is contained in:
Markines16 2021-03-26 15:45:16 +01:00 committed by GitHub
parent e70bfdff7a
commit 61d4515ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 146 additions and 83 deletions

View File

@ -3,9 +3,16 @@
session_start();
require_once('../assets/php/template.php');
$template = new Template();
require_once('./session_dto.php');
require_once('./room_dto.php');
require_once('./panel_manager.php');
$template = new Template();
if(isset($_REQUEST['state'])) {
$panel = new Panel($_REQUEST['state']);
}
else {
$panel = new Panel('');
}
// IMPORTANTE:
// VERIFICAR QUE ES MANAGER(GERENTE), SI NO, MOSTRAR MENSAJE DE "ERROR"
?>
@ -29,89 +36,32 @@
$template->print_main();
?>
<!-- Panel -->
<!-- Panel -->
<div class="row">
<?php if(isset($_GET['edit_sessions'])){ ?>
<!-- Edit sessions panels -->
<p> Esto es solo una prueba para poder diseñar la vista de editar y añadir sesiones. hay 98% de probabilidades de que este mal o no sea optimo la forma de haber llegado a este panel <p>
<td> <button type="button" onClick="Javascript:window.location.href = 'index.php';")>Volver</button> </td>
<?php } elseif(isset($_GET['edit_rooms'])){ ?>
<!-- Edit rooms panels -->
<p> Esto es solo una prueba para poder diseñar la vista de editar y añadir salas. hay 94% de probabilidades de que este mal o no sea optimo la forma de haber llegado a este panel <p>
<td> <button type="button" onClick="Javascript:window.location.href = 'index.php';")>Volver</button> </td>
<?php } else { ?>
<!-- Choose Rooms and Date -->
<div class="column left">
<input type="date" name="fecha" min="2021-01-01" max="2031-12-31">
<?php
$r1 = new RoomDTO(0,20,20);
$r2 = new RoomDTO(1,10,30);
$r3 = new RoomDTO(2,30,10);
$r4 = new RoomDTO(3,15,15);
$rooms = array($r1, $r2, $r3, $r4);
function drawRooms($ros){
echo "<table>";
foreach($ros as $r){
echo "
<tr>
<td> <button type=\"button\"> Sala ". $r->getId() ."</button> </td>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_rooms=true';\")\">Editar</button> </td>
</tr>";
}
echo "
<tr>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_rooms=true';\")\">Añadir</button> </td>
</tr>
</table>\n";
}
drawRooms($rooms);
?>
<!-- Left Sidebar -->
<div class="sidebar left">
<ul>
<li>Ver como:</li>
<ul>
<li><a href="index.php?state=us_u">Usuario no registrado</a></li>
<li><a href="index.php?state=us_r">Usuario registrado</a></li>
</ul><br />
<li>Añadir/Editar/Eliminar:</li>
<ul>
<li><a href="index.php?state=rooms">Salas</a></li>
<li><a href="index.php?state=sessions">Películas</a></li>
</ul>
</ul>
</div>
<!-- Sessions List -->
<!-- Contents -->
<div class="row">
<div class="column left">
<?php
$s1 = new SessionDTO(0,"HOY","10:00","9,99€","normal","Los vengativos: final del juego");
$s2 = new SessionDTO(1,"HOY","12:00","10€","3D","Los vengativos: final del juego");
$s3 = new SessionDTO(2,"HOY","14:00","10€","subtitulado","Los vengativos: final del juego");
$s4 = new SessionDTO(3,"HOY","16:00","9,99€","normal","Los vengativos: final del juego");
$s5 = new SessionDTO(4,"HOY","18:00","9,99€","normal","Los vengativos: final del juego");
$s6 = new SessionDTO(5,"HOY","20:00","20€","4D","Los vengativos: final del juego");
$sessions = array($s1, $s2, $s3, $s4, $s5, $s6);
function drawSessions($ses){
echo "<table>";
foreach($ses as $s){
echo "
<tr>
<td>" . $s->getStartTime() . "</td>
<td>" . $s->getFilm() . "</td>
<td>" . $s->getFormat() . "</td>
<td>". $s->getSeatPrice() . "</td>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_sessions=true';\")\">Editar</button> </td>
</tr>";
}
echo "
<tr>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_sessions=true';\")\">Añadir</button> </td>
</tr>
</table>";
}
drawSessions($sessions);
?>
</div>
<div class="column side"></div>
</div>
<?php } ?>
<div class="column middle">
<?php
$panel->showPanel();
?>
</div>
</div>
</div>
<!-- Footer -->
<?php
$template->print_footer();

View File

@ -0,0 +1,26 @@
<?php
require('room_dto.php');
$r1 = new RoomDTO(0,20,20);
$r2 = new RoomDTO(1,10,30);
$r3 = new RoomDTO(2,30,10);
$r4 = new RoomDTO(3,15,15);
$rooms = array($r1, $r2, $r3, $r4);
function drawRooms($ros){
echo "<table>";
foreach($ros as $r){
echo "
<tr>
<td> <button type=\"button\"> Sala ". $r->getId() ."</button> </td>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_rooms=true';\")\">Editar</button> </td>
</tr>";
}
echo "
<tr>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_rooms=true';\")\">Añadir</button> </td>
</tr>
</table>\n";
}
drawRooms($rooms);
?>

View File

@ -0,0 +1,59 @@
<?php
require('room_dto.php');
require('session_dto.php');
?>
<div class="column left">
<input type="date" name="fecha" min="2021-01-01" max="2031-12-31">
<?php
$r1 = new RoomDTO(0,20,20);
$r2 = new RoomDTO(1,10,30);
$r3 = new RoomDTO(2,30,10);
$r4 = new RoomDTO(3,15,15);
$rooms = array($r1, $r2, $r3, $r4);
function drawRooms($ros){
echo "<table>";
foreach($ros as $r){
echo "
<tr>
<td> <button type=\"button\"> Sala ". $r->getId() ."</button> </td>
</tr>";
}
echo "
</table>\n";
}
drawRooms($rooms);
?>
</div>
<div class="column right">
<?php
$s1 = new SessionDTO(0,"HOY","10:00","9,99€","normal","Los vengativos: final del juego");
$s2 = new SessionDTO(1,"HOY","12:00","10€","3D","Los vengativos: final del juego");
$s3 = new SessionDTO(2,"HOY","14:00","10€","subtitulado","Los vengativos: final del juego");
$s4 = new SessionDTO(3,"HOY","16:00","9,99€","normal","Los vengativos: final del juego");
$s5 = new SessionDTO(4,"HOY","18:00","9,99€","normal","Los vengativos: final del juego");
$s6 = new SessionDTO(5,"HOY","20:00","20€","4D","Los vengativos: final del juego");
$sessions = array($s1, $s2, $s3, $s4, $s5, $s6);
function drawSessions($ses){
echo "<table>";
foreach($ses as $s){
echo "
<tr>
<td>" . $s->getStartTime() . "</td>
<td>" . $s->getFilm() . "</td>
<td>" . $s->getFormat() . "</td>
<td>". $s->getSeatPrice() . "</td>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_sessions=true';\")\">Editar</button> </td>
</tr>";
}
echo "
<tr>
<td> <button type=\"button\" onClick=\"Javascript:window.location.href = 'index.php?edit_sessions=true';\")\">Añadir</button> </td>
</tr>
</table>";
}
drawSessions($sessions);
?>
</div>

View File

@ -0,0 +1,21 @@
<?php
class Panel {
public $state;
function __construct($panel){
$this->state = $panel;
}
function showPanel() {
switch($this->state) {
case 'us_u': require('user_unregistered_view.php'); break;
case 'us_r': require('user_registered_view.php'); break;
case 'rooms': require('manage_rooms.php'); break;
case 'sessions': require('manage_sessions.php'); break;
default: echo "<h1>BIENVENIDO AL PANEL DE GERENTE </h1>
<br>
<p> Espero que este pasando un buen dia </p>\n"; break;
}
}
}
?>

View File

@ -0,0 +1,4 @@
<h1> Vista de usuario registrado </h1>
<br>
<p> Esta vista aun no esta implementada </p>

View File

@ -0,0 +1,3 @@
<h1> Vista de usuario no registrado </h1>
<br>
<p> Esta vista aun no esta implementada </p>