Restructuracion de las salas

La lista de salas se obtiene de forma distinta, por eso editar/crear sessiones ha dejado de funcionar, pero bueno, estamos a la espera de ver como deberiamos estructurarlo y eso hay que cambiarlo asi que tampoco es problema.

El html del formulario de crear salas esta guardado en formhalls, haciendo mas sencillo el codigo de la vista y la logica de edit_halls
This commit is contained in:
Markines16 2021-05-03 12:40:59 +02:00 committed by GitHub
parent 02bb7938f0
commit d370d281f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 20 deletions

View File

@ -0,0 +1,16 @@
<?php
require_once('../assets/php/config.php');
include_once('./includes/formHall.php');
require_once('../assets/php/common/hall.php');
$form = new FormHall();
if(isset($_POST['new'])) {
$_SESSION["option"] = "new";
echo "<h1> Crear una Sala </h1>";
$form->gestiona();
}
?>

View File

@ -3,12 +3,12 @@
require_once($prefix.'assets/php/config.php'); require_once($prefix.'assets/php/config.php');
include_once('./includes/formHall.php'); include_once('./includes/formHall.php');
require_once($prefix.'assets/php/common/hall_dto.php'); require_once($prefix.'assets/php/common/hall.php');
require_once($prefix.'assets/php/common/session_dto.php'); require_once($prefix.'assets/php/common/session.php');
include_once($prefix.'assets/php/common/session_dao.php'); include_once($prefix.'assets/php/common/session_dao.php');
require_once($prefix.'assets/php/common/film_dto.php'); require_once($prefix.'assets/php/common/film.php');
include_once($prefix.'assets/php/common/film_dao.php'); include_once($prefix.'assets/php/common/film_dao.php');
$formHall = new FormHall(); $formHall = new FormHall();

View File

@ -16,6 +16,34 @@ class FormHall extends Form {
$this->reply = array(); $this->reply = array();
} }
protected function generaCamposFormulario($datos, $errores = array()){
$this->option = $_SESSION['option'];
$_SESSION['option'] = "";
$htmlform = "";
if($this->option == "new"){
$number = $datos['number'] ?? '';
$rows = $datos['rows'] ?? '';
$cols = $datos['cols'] ?? '';
$seats = $datos['seats'] ?? '';
$htmlform .= '
<fieldset>
<label>Numero de sala:</label> <input type="text" name="number" value="'.$number.'"/> <br>
<label>Filas:</label> <input type="text" name="rows" value= "'.$rows.'"/><br>
<label>Columnas:</label> <input type="text" name="cols" value= "'.$cols.'"/><br>
<label>Butacas totales:</label> <input type="text" name="seats" value= "'.$seats.'"/><br>
<button type="submit" name="newHall">Crear</button></div><br>
</fieldset>
';
}
return $htmlform;
}
//Methods: //Methods:
//Returns validation response: //Returns validation response:
@ -46,8 +74,7 @@ class FormHall extends Form {
} }
//Process form: //Process form:
public function processesForm($number, $cinema, $rows, $cols, $option) { public function processesForm($datos){
$this->option = $option;
$this->correct = true; $this->correct = true;
$bd = new HallDAO('complucine'); $bd = new HallDAO('complucine');

View File

@ -5,16 +5,9 @@
include_once('panel_manager.php'); include_once('panel_manager.php');
$login = false; $login = (isset($_SESSION["login"]) && $_SESSION["rol"] == "manager") ? true : false;
$panel = isset($_REQUEST['state']) ? new Panel($_REQUEST['state'],$login) : $panel = new Panel('',$login);
if(isset($_SESSION["login"]) && $_SESSION["rol"] == "manager") $login = true;
if(isset($_REQUEST['state'])) {
$panel = new Panel($_REQUEST['state'],$login);
}
else {
$panel = new Panel('',$login);
}
?> ?>
<!-- <!--
Práctica 2 - Sistemas Web | Grupo D Práctica 2 - Sistemas Web | Grupo D

View File

@ -0,0 +1,35 @@
<?php
require_once('../assets/php/common/hall.php');
require_once('../assets/php/config.php');
$listhalls = '<form method="post" action="./?state=edit_hall">
<table class="alt">
<thead>
<tr>
<th>Numero</th>
<th>Filas</th>
<th>Columnas</th>
</tr>
</thead>
<tbody>';
foreach(Hall::getListHalls("1") as $hall){
$listhalls .='
<tr>
<td> '. $hall->getNumber().'</td>
<td> '. $hall->getNumRows().'</td>
<td> '. $hall->getNumCol().'</td>
<td> <input type="submit" name="edit" value="Editar" class="button" ></td>
</tr>';
}
$listhalls.='
</tbody>
</table>
<input type="submit" name="new" value="Añadir" class="button large" >
</form>';
echo $listhalls;
?>

View File

@ -2,13 +2,13 @@
//General Config File: //General Config File:
require_once('../assets/php/config.php'); require_once('../assets/php/config.php');
include_once('../assets/php/common/hall_dto.php'); include_once('../assets/php/common/hall.php');
include_once('./includes/formHall.php'); include_once('./includes/formHall.php');
include_once('../assets/php/common/session_dto.php'); include_once('../assets/php/common/session.php');
include_once('./includes/formSession.php'); include_once('./includes/formSession.php');
include_once('../assets/php/common/film_dto.php'); include_once('../assets/php/common/film.php');
include_once('../assets/php/common/film_dao.php'); include_once('../assets/php/common/film_dao.php');
$formSession = new FormSession(); $formSession = new FormSession();
@ -28,7 +28,7 @@
$formSession->processesForm(null, $placeholder_hall, $_SESSION["cinema"], $placeholder_date, null, null, null, null, "list"); $formSession->processesForm(null, $placeholder_hall, $_SESSION["cinema"], $placeholder_date, null, null, null, null, "list");
echo" echo"
<!--Session Filter --> <!--Session Filter by Hall -->
<div class = \"column left\"> <div class = \"column left\">
<form method=\"post\" id=\"addfilter\"> <form method=\"post\" id=\"addfilter\">
<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\">

View File

@ -14,9 +14,10 @@
switch($this->state) { switch($this->state) {
case 'us_u': echo "<p> Esta vista no esta implementada </p>"; break; case 'us_u': echo "<p> Esta vista no esta implementada </p>"; break;
case 'us_r': echo "<p> Esta vista no esta implementada </p>"; break; case 'us_r': echo "<p> Esta vista no esta implementada </p>"; break;
case 'rooms': require_once('manage_rooms.php'); break; case 'rooms': require_once('manage_halls.php'); break;
case 'sessions': require_once('manage_sessions.php'); break; case 'sessions': require_once('manage_sessions.php'); break;
case 'edit_session': require_once('edit_sessions.php'); break; case 'edit_session': require_once('edit_sessions.php'); break;
case 'edit_hall': require_once('edit_halls.php'); break;
default: require('hello_panel.php'); break; default: require('hello_panel.php'); break;
} }
} }