Esta comentado las opciones de sesion

Hay un fallo con film.php que esperamos arreglarlo mañana con el join en sesion y el template
This commit is contained in:
Markines16 2021-05-06 23:25:38 +02:00 committed by GitHub
parent 8bb34474d6
commit d00c212e07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 125 additions and 26 deletions

View File

@ -12,24 +12,66 @@ class FormHall extends Form {
public static function generaCampoFormulario($data, $errores = array()){
$number = $data['number'] ?? '';
$rows = $data['rows'] ?? '';
$cols = $data['cols'] ?? '';
$rows = $data['rows'] ?? '14';
$cols = $data['cols'] ?? '8';
$seats = $data['seats'] ?? '';
$htmlform .= '<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
$htmlform .= '<div class="column left">
<form method="post" id="seat_filter" action="./?state='.$data['option'].'"\>
<fieldset>
<legend> Configuracion </legend>
<input type="number" name="rows" value="'.$rows.'" min="1" placeholder="Numero de filas" required/> <br>
<input type="number" name="cols" value="'.$cols.'" min="1" placeholder="Numero de cols" required/> <br>
<button type="submit" name="seat_filter" class="button large">Actualizar</button><br>
</fieldset>
</form>
<br>
<br>
<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
<fieldset>
<input type="number" name="number" value="'.$number.'" min="1" placeholder="Numero de la sala" required/> <br>
<input type="number" name="rows" value= "'.$rows.'" min="1" placeholder="Filas" required/><br>
<input type="number" name="cols" value= "'.$cols.'" min="1" placeholder="Columnas" required/><br>
<input type="number" name="seats" value= "'.$seats.'" min="1" placeholder="Total de butacas?" /><br>
<input type="hidden" name="rows" value="'.$rows.'" min="1"/>
<input type="hidden" name="cols" value="'.$cols.'" min="1"/>
';
if($data['option'] == "new_hall")
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button></div><br>';
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button><br>';
$htmlform .= '
</fieldset>
</form>';
return $htmlform;
</div>
<div class="column right">
<h3 class="table_title"> Pantalla </h3>
<table class="seat">
<thead>
<tr>
<th></th>';
for($j = 1; $j<=$cols; $j++){
$htmlform .= '<th>'.$j.'</th>';
}
$htmlform .= '</tr>
</thead>
<tbody>';
for($i = 1;$i<=$rows;$i++){
$htmlform .= '
<tr>
<td>'.$i.'</td>
';
for($j=1; $j<=$cols; $j++){
$htmlform .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" id="checkbox'.$i.$j.'" value="1" checked> <label for="checkbox'.$i.$j.'"> </td>'
;
}
$htmlform .='
</tr>';
}
$htmlform .= '
</tbody>
</table>
</form>
</div>
';
return $htmlform;
}
//Methods:

View File

@ -101,5 +101,4 @@ class FormSession extends Form {
}
}
?>
?>

View File

@ -0,0 +1,50 @@
h3.table_title{
text-align: center;
margin-bottom: 1em;
}
table.seat {
border: solid 10px #1f2c3d;
text-align: center;
background-color: rgba(215, 215, 215, 1);
}
table.seat tbody tr:nth-child(2n + 1) {
background-color: rgba(204, 255, 204, 0);
}
table.seat th{
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
border-bottom: solid 2px #1f2c3d;
}
table.seat th:first-child {
border-right: solid 2px #1f2c3d;
}
table.seat td {
padding: 0.35em 0.35em;
}
table.seat td:first-child {
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
font-weight: 600;
border-right: solid 2px #1f2c3d;
}
.check_box {
display:none;
}
.check_box+label{
background:url('../../img/seat_red.png') no-repeat;
height: 16px;
width: 16px;
display:inline-block;
}
.check_box:checked+label{
background:url('../../img/seat_green.png') no-repeat;
}

View File

@ -7,7 +7,16 @@
include_once('formSession.php');
if(isset($_POST['new_hall'])){
$data = array("option" => "new_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"]);
$data = array("option" => "new_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"], "seats" => 0);
//Check what checkboxs are seats or not
for($i = 1;$i<=$data["rows"];$i++){
for($j=1; $j<=$data["cols"]; $j++){
if(!empty($_POST['checkbox'.$i.$j.''])){
$data[$i][$j] = $_POST['checkbox'.$i.$j.''];
$data["seats"]++;
} else $data[$i][$j] = "-1";
}
}
FormHall::processesForm($data);
}
@ -16,7 +25,7 @@
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]);
FormSession::processesForm($data);
}
if(isset($_POST['edit_session'])){
$data = array("option" => "edit_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]
@ -29,4 +38,5 @@
,"date"=> $_POST["origin_date"],"start"=> $_POST["origin_start"]);
FormSession::processesForm($data);
}
?>

View File

@ -7,7 +7,7 @@
require_once('../assets/php/config.php');
//Controller file:
include_once('panel_manager.php');
if($_SESSION["login"] && $_SESSION["rol"] === "manager"){
$_SESSION["cinema"] = "1";
switch($_GET["state"]){
@ -64,9 +64,11 @@
CompluCine - FDI-cines
-->
<html lang="es">
<link id='estilo' rel='stylesheet' type='text/css' href='includes/manager.css'>
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->

View File

@ -1,8 +1,8 @@
<?php
include_once('../assets/php/common/hall.php');
include_once('../assets/php/common/session.php');
//include_once('./assets/php/common/session.php');
include_once('./includes/formHall.php');
include_once('./includes/formSession.php');
//include_once('./includes/formSession.php');
class Manager_panel {
@ -67,13 +67,9 @@
}
static function new_hall(){
$data = array("option" => "new_hall");
$panel = '<div class="column side"></div>
<div class="column middle">
<h1>Crear una sala.</h1><hr /></br>
'. FormHall::generaCampoFormulario($data, null).'
</div>
<div class="column side"></div>'."\n";
$data = array("option" => "new_hall", "cols" => $_POST["cols"], "rows" => $_POST["rows"]);
$panel = '<h1>Crear una sala.</h1><hr/></br>
'. FormHall::generaCampoFormulario($data, null);
return $panel;
}
@ -88,7 +84,7 @@
return $panel;
}
/*
static function manage_sessions(){
//Base filtering values
$date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d");
@ -178,11 +174,11 @@
}
static function edit_session(){
$data = array("option" => "edit_session","hall" => $_POST["hall"],"cinema" => $_SESSION["cinema"],"date" => $_POST['date'],"film" => $_POST['film'],"start" => $_POST['start'],"price" => $_POST['price'],"format" => $_POST['format']);
/*$data = array("option" => "edit_session","hall" => $_POST["hall"],"cinema" => $_SESSION["cinema"],"date" => $_POST['date'],"film" => $_POST['film'],"start" => $_POST['start'],"price" => $_POST['price'],"format" => $_POST['format']);
$panel = '<h1>Editar una sesión.</h1><hr /></br>
'.FormSession::generaCampoFormulario($data, null);
return $panel;
}
}*/
}
?>