Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-04 22:26:24 +02:00 committed by GitHub
parent aacb6886bc
commit ebc132e205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 319 additions and 261 deletions

View File

@ -556,6 +556,12 @@ textarea {
border:#000000; border:#000000;
background-color: #791515; background-color: #791515;
} }
.file{
margin-top: 10px;
}
.file input{
height: 110%;
}
/* Footer */ /* Footer */

View File

@ -14,10 +14,10 @@
//Methods: //Methods:
//Create a new Session. //Create a new Session.
public function createFilm($id, $tittle, $duration, $language,$description){ public function createFilm($id, $tittle, $duration, $language, $description){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`) $sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`)
VALUES ( '%d', '%s', '%d', '%s','%s')", VALUES ( '%d', '%s', '%d', '%s','%s')",
$id, $tittle, $duration, $language,$description); $id, $tittle, $duration, $language, $description);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul; return $resul;

View File

@ -9,7 +9,6 @@
private $_duration; //Film duration. private $_duration; //Film duration.
private $_language; //Film language. private $_language; //Film language.
private $_description; //Film description. private $_description; //Film description.
//Constructor: //Constructor:
function __construct($id, $tittle, $duration, $language, $description){ function __construct($id, $tittle, $duration, $language, $description){

View File

@ -1,5 +1,5 @@
<?php <?php
include_once($prefix.'assets/php/common/hall_dao.php'); include_once('../assets/php/common/hall_dao.php');
class Hall{ class Hall{
@ -25,18 +25,6 @@
return ""; return "";
} }
public static function create_hall($hall){
$bd = new HallDAO('complucine');
if($bd ){
if(!$bd->searchHall($hall['cinema'], $hall['number'])){
$bd->createHall($hall['number'], $hall['cinema'], $hall['cols'], $hall['rows']);
return "Se ha creado la sala con exito";
} else {
return "Esta sala ya existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
//Getters && Setters: //Getters && Setters:
public function setNumber($number){ $this->_number = $number; } public function setNumber($number){ $this->_number = $number; }
public function getNumber(){ return $this->_number; } public function getNumber(){ return $this->_number; }

View File

@ -1,5 +1,5 @@
<?php <?php
require_once($prefix.'assets/php/dao.php'); require_once('../assets/php/dao.php');
include_once('hall.php'); include_once('hall.php');
class HallDAO extends DAO { class HallDAO extends DAO {
@ -17,12 +17,10 @@
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`) $sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`)
VALUES ( '%d', '%d', '%i', '%i')", VALUES ( '%d', '%d', '%i', '%i')",
$number, $idcinema, $numRows, $numCol ); $number, $idcinema, $numRows, $numCol );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
return $sql; return $sql;
} }
//Returns a query to get the halls data. //Returns a query to get the halls data.
public function getAllHalls($cinema){ public function getAllHalls($cinema){
$sql = sprintf( "SELECT * FROM hall WHERE $sql = sprintf( "SELECT * FROM hall WHERE
@ -41,24 +39,7 @@
return $hall; return $hall;
} }
//Returns the count of the hall searched
public function searchHall($number, $cinema){
$sql = sprintf( "SELECT COUNT(*) FROM hall WHERE
idcinema = '%s' AND number = '%s'",
$cinema, $number);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = mysqli_fetch_array($resul);
mysqli_free_result($resul);
return $hall[0];
}
//Create a new Hall Data Transfer Object. //Create a new Hall Data Transfer Object.
public function loadHall($number, $idcinema, $numrows, $numcolumns){ public function loadHall($number, $idcinema, $numrows, $numcolumns){
return new Hall($number, $idcinema, $numrows, $numcolumns); return new Hall($number, $idcinema, $numrows, $numcolumns);

View File

@ -7,6 +7,11 @@
define('BD_USER', 'sw'); define('BD_USER', 'sw');
define('BD_PASS', '_admin_'); define('BD_PASS', '_admin_');
/**
* Temprarl files directory.
*/
define('TMP_DIR', __DIR__.'/img/');
/** /**
* Utf-8 support settings, location (language and country) and time zone. * Utf-8 support settings, location (language and country) and time zone.
*/ */
@ -23,7 +28,7 @@
$prefix = $template->get_prefix(); $prefix = $template->get_prefix();
//Depuración (BORRAR): //Depuración (BORRAR):
//ini_set('display_errors', 1); ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
//error_reporting(E_ALL); error_reporting(E_ALL);
?> ?>

View File

@ -1,6 +1,9 @@
<?php <?php
class Template { class Template {
//Constants:
private const _NUMPAGES = 10;
//Attributes: //Attributes:
public $page; //Page Name. public $page; //Page Name.
public $prefix; //Page prefix. public $prefix; //Page prefix.
@ -183,14 +186,14 @@
case "manager": array_push($menus, "<li>Ver como... case "manager": array_push($menus, "<li>Ver como...
<ul> <ul>
<a href='./?state=view_user'><li>Usuario</li></a> <a href='./?state=us_u'><li>Usuario</li></a>
<a href='./?state=view_ruser'><li>Usuario registrado</li></a> <a href='./?state=us_r'><li>Usuario registrado</li></a>
</ul> </ul>
</li>"); </li>");
array_push($menus, "<li>Modificar array_push($menus, "<li>Modificar
<ul> <ul>
<a href='./?state=manage_halls'><li>Salas</li></a> <a href='./?state=rooms'><li>Salas</li></a>
<a href='./?state=manage_sessions'><li>Sesiones</li></a> <a href='./?state=sessions'><li>Sesiones</li></a>
</ul> </ul>
</li>"); </li>");
break; break;
@ -318,8 +321,7 @@
</section> </section>
"; ";
} }
echo "</div> echo "</div>\n";
</div>\n";
break; break;
default: default:
@ -359,6 +361,7 @@
</div>\n"; </div>\n";
break; break;
} }
} }
function print_cinemas(){ function print_cinemas(){

View File

@ -47,6 +47,7 @@ class FormLogin extends Form {
$name = $this->test_input($name); $name = $this->test_input($name);
$pass = $this->test_input($pass); $pass = $this->test_input($pass);
$name = strtolower($name);
$username = isset($name) ? $name : null ; $username = isset($name) ? $name : null ;
if (!$username) { if (!$username) {
$login = false; $login = false;

View File

@ -62,10 +62,16 @@ class FormFilm extends Form {
} }
} else { } else {
$this->reply = "<div class='column middle'> $this->reply = "<div class='row'>
<h1>ERROR</h1><hr /> <div class='column side'></div>
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p> <div class='column middle'>
<a href='../panel_admin/index.php?state=mf'><button>Panel Admin</button></a> <div class='code info'>
<h1>ERROR</h1><hr />
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p>
<a href='../panel_admin/index.php?state=mf'><button>Panel Admin</button></a>
</div>
</div>
<div class='column side'></div>
</div>"; </div>";
} }
@ -73,7 +79,7 @@ class FormFilm extends Form {
} }
//Process form: //Process form:
public function processesForm($_id,$_tittle,$_duration,$_language,$_description, $_option) { public function processesForm($_id, $_tittle, $_duration, $_language, $_description, $_img, $_option) {
$this->correct = true; $this->correct = true;
$this->option = $_option; $this->option = $_option;
@ -82,6 +88,20 @@ class FormFilm extends Form {
$duration=$this->test_input($_duration); $duration=$this->test_input($_duration);
$language=$this->test_input($_language); $language=$this->test_input($_language);
$description=$this->test_input($_description); $description=$this->test_input($_description);
//Validate promotional film image.
$file_name = $_FILES['file']['name'];
$file_type = $_FILES['file']['type'];
$file_size = $_FILES['file']['size'];
if (strpos($file_type, "jpg") && $file_size < 100000) {
$uploadFile = TMP_DIR . basename($_FILES['file'][$_tittle]);
if (!move_uploaded_file($file_name, $uploadFile)){
print_r($_FILES);
}
}
else{
$this->correct =false;
}
//Habria que validar todo para que encaje en la base de datos //Habria que validar todo para que encaje en la base de datos

View File

@ -11,28 +11,22 @@
echo'<div class="column side"></div> echo'<div class="column side"></div>
<div class="column middle"> <div class="column middle">
<h2>Añadir pelicula</h2> <h2>Añadir pelicula</h2>
<form method="post" action="index.php?state=mf"> <form method="post" enctype="multipart/form-data" action="index.php?state=mf">
<div class="row"> <div class="row">
<fieldset id="film_form"> <fieldset id="film_form">
<legend>Datos de pelicula</legend> <legend>Datos de pelicula</legend>
<div>
<input type="text" name="tittle" id="tittle" placeholder="Título" /> <input type="text" name="tittle" id="tittle" placeholder="Título" />
</div>
<div>
<input type="number" name="duration" id="duration" placeholder="Duración" /> <input type="number" name="duration" id="duration" placeholder="Duración" />
</div>
<div>
<input type="text" name="language" id="language" placeholder="Idioma" /> <input type="text" name="language" id="language" placeholder="Idioma" />
</div> <input type="text" name="description" id="description" placeholder="Descripción" />
<div> <div class="file">Imagen promocional:<input type="file" name="file" placeholder="Imagen promocional" /></div>
<input type="text" name="description" id="description" placeholder="Descripción" />
</div>
</fieldset> </fieldset>
<div class="actions"> <div class="actions">
<input type="submit" id="submit" value="Añadir pelicula" name="add_film" class="primary" /> <input type="submit" id="submit" value="Añadir pelicula" name="add_film" class="primary" />
<input type="reset" id="reset" value="Borrar" /> <input type="reset" id="reset" value="Borrar" />
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>
<div class="column side"></div> <div class="column side"></div>
@ -41,7 +35,7 @@
function deleteFilm() { function deleteFilm() {
echo'<div class="column side"></div> echo'<div class="column side"></div>
<div class="column middle"> <div class="column middle">
<h2>Editar pelicula</h2> <h2>Eliminar pelicula</h2>
<form method="post" action="index.php?state=mf"> <form method="post" action="index.php?state=mf">
<div class="row"> <div class="row">
<fieldset id="film_form"> <fieldset id="film_form">
@ -71,19 +65,12 @@
<div class="row"> <div class="row">
<fieldset id="film_form"> <fieldset id="film_form">
<legend>Datos de pelicula</legend> <legend>Datos de pelicula</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/> <input type="hidden" name="id" value='.$_POST['id'].'/>
<div>
<input type="text" name="tittle" value="'.$_POST['tittle'].'" /> <input type="text" name="tittle" value="'.$_POST['tittle'].'" />
</div>
<div>
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' /> <input type="number" name="duration" id="duration" value='.$_POST['duration'].' />
</div>
<div>
<input type="text" name="language" id="language" value="'.$_POST['language'].'" /> <input type="text" name="language" id="language" value="'.$_POST['language'].'" />
</div> <input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
<div> <div class="file">Imagen promocional:<input type="file" name="file" placeholder="Imagen promocional" /></div>
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
</div>
</fieldset> </fieldset>
<div class="actions"> <div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" /> <input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
@ -99,19 +86,19 @@
// Logic Functions // Logic Functions
function confirmDelete() { function confirmDelete() {
$film = new FormFilm(); $film = new FormFilm();
$film->processesForm($_POST['id'],null,null,null,null,"del"); $film->processesForm($_POST['id'],null,null,null,null,null,"del");
$_SESSION['message'] = $film->getReply(); $_SESSION['message'] = $film->getReply();
header('Location: ../panel_admin/index.php?state=mf'); header('Location: ../panel_admin/index.php?state=mf');
} }
function confirmEdit() { function confirmEdit() {
$film = new FormFilm(); $film = new FormFilm();
$film->processesForm($_POST['id'], $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "edit"); $film->processesForm($_POST['id'], $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], $_POST['file'], "edit");
$_SESSION['message']= $film->getReply(); $_SESSION['message']= $film->getReply();
header('Location: ../panel_admin/index.php?state=mf'); header('Location: ../panel_admin/index.php?state=mf');
} }
function confirmAdd() { function confirmAdd() {
$film = new FormFilm(); $film = new FormFilm();
$film->processesForm(null, $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "new"); $film->processesForm(null, $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], $_POST['file'], "new");
$_SESSION['message'] = $film->getReply(); $_SESSION['message'] = $film->getReply();
header('Location: ../panel_admin/index.php?state=mf'); header('Location: ../panel_admin/index.php?state=mf');
} }

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

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

View File

@ -1,6 +1,6 @@
<?php <?php
include_once($prefix.'assets/php/common/hall_dao.php'); include_once('../assets/php/common/hall_dao.php');
include_once($prefix.'assets/php/form.php'); include_once('../assets/php/form.php');
class FormHall extends Form { class FormHall extends Form {
@ -16,8 +16,14 @@ class FormHall extends Form {
$this->reply = array(); $this->reply = array();
} }
public static function generaCampoFormulario($datos, $errores = array(), $option){ protected function generaCamposFormulario($datos, $errores = array()){
if($option == "new"){ $this->option = $_SESSION['option'];
$_SESSION['option'] = "";
$htmlform = "";
if($this->option == "new"){
$number = $datos['number'] ?? ''; $number = $datos['number'] ?? '';
$rows = $datos['rows'] ?? ''; $rows = $datos['rows'] ?? '';
$cols = $datos['cols'] ?? ''; $cols = $datos['cols'] ?? '';
@ -25,15 +31,13 @@ class FormHall extends Form {
$htmlform .= ' $htmlform .= '
<form method="post" id="new_hall" action="./includes/processForm.php"\> <fieldset>
<fieldset> <label>Numero de sala:</label> <input type="text" name="number" value="'.$number.'"/> <br>
<label>Numero de sala:</label> <input type="number" name="number" value="'.$number.'" required/> <br> <label>Filas:</label> <input type="text" name="rows" value= "'.$rows.'"/><br>
<label>Filas:</label> <input type="number" name="rows" value= "'.$rows.'" required/><br> <label>Columnas:</label> <input type="text" name="cols" value= "'.$cols.'"/><br>
<label>Columnas:</label> <input type="number" name="cols" value= "'.$cols.'" required/><br> <label>Butacas totales:</label> <input type="text" name="seats" value= "'.$seats.'"/><br>
<label>Butacas totales:</label> <input type="number" name="seats" value= "'.$seats.'"/><br> <button type="submit" name="newHall">Crear</button></div><br>
<button type="submit" name="new_hall" class="button large">Crear</button></div><br> </fieldset>
</fieldset>
</form>
'; ';
} }
@ -70,40 +74,45 @@ class FormHall extends Form {
} }
//Process form: //Process form:
public static function processesForm($data){ public function processesForm($datos){
if($data["option"] == "new"){ $this->correct = true;
Hall::create_hall($data); $bd = new HallDAO('complucine');
$_SESSION['msg'] = "La sala se ha añadido correctamente";
header( "Location: ../?state=success" );
}else { if($bd ){
/* TODO if($option == "list"){
$start = date('H:i:s', strtotime( $start ) ); $this->halls = $bd->getAllHalls($cinema);
}else {
if($option == "new"){ /* TODO
$start = date('H:i:s', strtotime( $start ) );
$selectSession = $bd->selectSession($cinema, $hall, $start, $date); if($option == "new"){
if($selectSession && $selectSession->num_rows >= 1) {
$this->correct = false; $selectSession = $bd->selectSession($cinema, $hall, $start, $date);
} else{ if($selectSession && $selectSession->num_rows >= 1) {
$bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format); $this->correct = false;
} else{
$bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format);
}
mysqli_free_result($selectSession);
} else if ($option == "del"){
$bd->deleteSession($id);
} else if ($option == "edit"){
$bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format);
} }
mysqli_free_result($selectSession); if($repeat > "0"){
$repeat--;
} else if ($option == "del"){ $date = date('Y-m-d', strtotime( $date. ' +1 day') );
$bd->deleteSession($id); $this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat);
}
} else if ($option == "edit"){ */
$bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format);
}
if($repeat > "0"){
$repeat--;
$date = date('Y-m-d', strtotime( $date. ' +1 day') );
$this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat);
} }
*/
} } else {$this->correct = false;}
} }
} }

View File

@ -1,56 +1,13 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<?php <?php
//ini_set('display_errors', 0); //General Config File:
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
//General Config File:
require_once('../assets/php/config.php'); require_once('../assets/php/config.php');
//Controller file:
include_once('panel_manager.php'); include_once('panel_manager.php');
$login = (isset($_SESSION["login"]) && $_SESSION["rol"] == "manager") ? true : false;
$panel = isset($_REQUEST['state']) ? new Panel($_REQUEST['state'],$login) : $panel = new Panel('',$login);
if($_SESSION["login"] && $_SESSION["rol"] === "manager"){
switch($_GET["state"]){
case "view_ruser":
case "view_user":
$panel = '<div class="column side"></div>
<div class="column middle">
<div class="code info">
<h1>Esta vista aun no esta implementada.</h1><hr />
</div>
</div>
<div class="column side"></div>'."\n";
break;
case "manage_halls":
$panel = Manager_panel::manage_halls();
break;
case "new_hall":
$panel = Manager_panel::new_hall();
break;
case "edit_hall":
$panel = Manager_panel::edit_hall();
break;
case "manage_sessions":
$panel = Manager_panel::manage_sessions();
break;
case "success":
$panel = Manager_panel::success();
break;
default:
$panel = Manager_panel::welcome();
break;
}
}
else{
$panel = '<div class="column side"></div>
<div class="column middle">
<div class="code info">
<h1>Debes iniciar sesión para ver el Panel de Manager.</h1><hr />
<p>Inicia Sesión en una cuenta con permisos.</p>
<a href="'.$prefix.'login/" ><button class="button large">Iniciar Sesión</button></a>
</div>
</div>
<div class="column side"></div>'."\n";
}
?> ?>
<!-- <!--
Práctica - Sistemas Web | Grupo D Práctica - Sistemas Web | Grupo D
@ -80,7 +37,7 @@
?> ?>
<!--Contents --> <!--Contents -->
<div class="row"> <div class="row">
<?php echo $panel; ?> <?php $panel->showPanel(); ?>
</div> </div>
</div> </div>
<!-- Footer --> <!-- Footer -->

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

@ -0,0 +1,37 @@
<?php
require('../assets/php/common/hall_dto.php');
$r1 = new HallDTO(0,20,20,30);
$r2 = new HallDTO(1,10,30,30);
$r3 = new HallDTO(2,30,10,30);
$r4 = new HallDTO(3,15,15,30);
$rooms = array($r1, $r2, $r3, $r4);
function drawHalls($ros){
echo " <div class='column side'></div>
<p> Esta vista esta en desarrollo <p>
<div class=\"column middle\">
<table class='alt'>
<thead>
<tr>
<th>Sala</th>
<th>Opción</th>
</tr>
</thead>
<tbody>";
foreach($ros as $r){
echo "
<tr>
<td><a href=\"\" class='button'>Sala". $r->getNumber() ."</a></td>
<td><a href=\"index.php?state=rooms\" class='button'>Editar</a></td>
</tr>";
}
echo "<tbody>
</table>\n";
echo "<a href=\"index.php?state=rooms\" class='button large'>Añadir</a>
</div>
<div class='column side'></div>";
}
drawHalls($rooms);
?>

View File

@ -1,10 +1,7 @@
<?php <?php
include_once('../assets/php/common/hall.php'); class Panel {
include_once('./includes/formHall.php'); public $state;
public $login;
class Manager_panel {
private $form;
function __construct($panel,$log){ function __construct($panel,$log){
$this->state = $panel; $this->state = $panel;
@ -12,91 +9,21 @@
} }
static function welcome(){ function showPanel() {
$name = strtoupper($_SESSION['nombre']); if($this->login){
switch($this->state) {
$panel = '<div class="code info"> case 'us_u': echo "<p> Esta vista no esta implementada </p>"; break;
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1> case 'us_r': echo "<p> Esta vista no esta implementada </p>"; break;
<hr /> case 'rooms': require_once('manage_halls.php'); break;
<p>Usuario: '.$name.'</p> case 'sessions': require_once('manage_sessions.php'); break;
<p>Espero que estes pasando un buen dia</p> case 'edit_session': require_once('edit_sessions.php'); break;
</div>'."\n"; case 'edit_hall': require_once('edit_halls.php'); break;
default: require('hello_panel.php'); break;
return $panel; }
} }
else{
static function success(){ echo "<h1> Error no tienes los permisos necesarios de gerente</h1>";
$panel = '<div class="code info"> }
<h1>Operacion completada.</h1>
<hr />
<p>'.$_SESSION['msg'].'</p>
</div>'."\n";
$_SESSION['msg'] = "";
return $panel;
}
static function manage_halls(){
$panel = '<form method="post" action="./?state=new_hall">
<table class="alt">
<thead>
<tr>
<th>Numero</th>
<th>Filas</th>
<th>Columnas</th>
</tr>
</thead>
<tbody>';
foreach(Hall::getListHalls("1") as $hall){
$panel .='
<tr>
<td> '. $hall->getNumber().'</td>
<td> '. $hall->getNumRows().'</td>
<td> '. $hall->getNumCol().'</td>
<td> <input type="submit" name="edit" value="Editar" class="button" formaction="./?state=edit_hall&number='.$hall->getNumber().'" ></td>
</tr>';
}
$panel.='
</tbody>
</table>
<input type="submit" name="new" value="Añadir" class="button large" >
</form>';
return $panel;
}
static function new_hall(){
$panel = '<div class="column side"></div>
<div class="column middle">
<h1>Crear una sala.</h1><hr /></br>
'.
FormHall::generaCampoFormulario(null, null, "new");
'.
</div>
<div class="column side"></div>'."\n";
return $panel;
}
static function edit_hall(){
$panel = '<div class="column side"></div>
<div class="column middle">
<h1>Editar una sala.</h1><hr /></br>
</div>
<div class="column side"></div>'."\n";
return $panel;
}
static function manage_sessions(){
$name = strtoupper($_SESSION['nombre']);
$panel = '<div class="code info">
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1>
<hr />
<p>Usuario: '.$name.'</p>
<p>Espero que estes pasando un buen dia</p>
</div>'."\n";
return $panel;
} }
} }
?> ?>

View File

@ -0,0 +1,77 @@
<?php
//General Config File:
require_once('../assets/php/config.php');
require_once('./includes/formSession.php');
$session = new FormSession();
$reply = "<p> ERROR DE ACCESO </p>" ;
if(isset($_POST['new'])){
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], "new");
$reply = $session->getReply();
$_SESSION["cinema"] = "";
$_SESSION["hall"] = "";
$_SESSION["date"] = "";
$_SESSION["start"] = "";
} else if (isset($_POST['edit'])){
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "edit");
$reply = $session->getReply();
$_SESSION["cinema"] = "";
$_SESSION["hall"] = "";
$_SESSION["date"] = "";
$_SESSION["start"] = "";
} else if (isset($_POST['del'])){
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "del");
$reply = $session->getReply();
$_SESSION["cinema"] = "";
$_SESSION["hall"] = "";
$_SESSION["date"] = "";
$_SESSION["start"] = "";
}
?>
<!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>

View File

@ -49,6 +49,7 @@ class FormRegister extends Form {
$pass = $this->test_input($pass); $pass = $this->test_input($pass);
$repass = $this->test_input($repass); $repass = $this->test_input($repass);
$name = strtolower($name);
$username = isset($name) ? $name : null ; $username = isset($name) ? $name : null ;
if (!$username) { if (!$username) {
$register = false; $register = false;