Add files via upload
This commit is contained in:
parent
aacb6886bc
commit
ebc132e205
@ -556,6 +556,12 @@ textarea {
|
||||
border:#000000;
|
||||
background-color: #791515;
|
||||
}
|
||||
.file{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.file input{
|
||||
height: 110%;
|
||||
}
|
||||
|
||||
|
||||
/* Footer */
|
||||
|
@ -14,10 +14,10 @@
|
||||
//Methods:
|
||||
|
||||
//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`)
|
||||
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');
|
||||
return $resul;
|
||||
|
@ -10,7 +10,6 @@
|
||||
private $_language; //Film language.
|
||||
private $_description; //Film description.
|
||||
|
||||
|
||||
//Constructor:
|
||||
function __construct($id, $tittle, $duration, $language, $description){
|
||||
$this->_id = $id;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
include_once($prefix.'assets/php/common/hall_dao.php');
|
||||
include_once('../assets/php/common/hall_dao.php');
|
||||
|
||||
class Hall{
|
||||
|
||||
@ -25,18 +25,6 @@
|
||||
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:
|
||||
public function setNumber($number){ $this->_number = $number; }
|
||||
public function getNumber(){ return $this->_number; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once($prefix.'assets/php/dao.php');
|
||||
require_once('../assets/php/dao.php');
|
||||
include_once('hall.php');
|
||||
|
||||
class HallDAO extends DAO {
|
||||
@ -18,8 +18,6 @@
|
||||
VALUES ( '%d', '%d', '%i', '%i')",
|
||||
$number, $idcinema, $numRows, $numCol );
|
||||
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
@ -42,23 +40,6 @@
|
||||
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.
|
||||
public function loadHall($number, $idcinema, $numrows, $numcolumns){
|
||||
return new Hall($number, $idcinema, $numrows, $numcolumns);
|
||||
|
@ -7,6 +7,11 @@
|
||||
define('BD_USER', 'sw');
|
||||
define('BD_PASS', '_admin_');
|
||||
|
||||
/**
|
||||
* Temprarl files directory.
|
||||
*/
|
||||
define('TMP_DIR', __DIR__.'/img/');
|
||||
|
||||
/**
|
||||
* Utf-8 support settings, location (language and country) and time zone.
|
||||
*/
|
||||
@ -23,7 +28,7 @@
|
||||
$prefix = $template->get_prefix();
|
||||
|
||||
//Depuración (BORRAR):
|
||||
//ini_set('display_errors', 1);
|
||||
//ini_set('display_startup_errors', 1);
|
||||
//error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
?>
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
class Template {
|
||||
|
||||
//Constants:
|
||||
private const _NUMPAGES = 10;
|
||||
|
||||
//Attributes:
|
||||
public $page; //Page Name.
|
||||
public $prefix; //Page prefix.
|
||||
@ -183,14 +186,14 @@
|
||||
|
||||
case "manager": array_push($menus, "<li>Ver como...
|
||||
<ul>
|
||||
<a href='./?state=view_user'><li>Usuario</li></a>
|
||||
<a href='./?state=view_ruser'><li>Usuario registrado</li></a>
|
||||
<a href='./?state=us_u'><li>Usuario</li></a>
|
||||
<a href='./?state=us_r'><li>Usuario registrado</li></a>
|
||||
</ul>
|
||||
</li>");
|
||||
array_push($menus, "<li>Modificar
|
||||
<ul>
|
||||
<a href='./?state=manage_halls'><li>Salas</li></a>
|
||||
<a href='./?state=manage_sessions'><li>Sesiones</li></a>
|
||||
<a href='./?state=rooms'><li>Salas</li></a>
|
||||
<a href='./?state=sessions'><li>Sesiones</li></a>
|
||||
</ul>
|
||||
</li>");
|
||||
break;
|
||||
@ -318,8 +321,7 @@
|
||||
</section>
|
||||
";
|
||||
}
|
||||
echo "</div>
|
||||
</div>\n";
|
||||
echo "</div>\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -359,6 +361,7 @@
|
||||
</div>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function print_cinemas(){
|
||||
|
@ -47,6 +47,7 @@ class FormLogin extends Form {
|
||||
$name = $this->test_input($name);
|
||||
$pass = $this->test_input($pass);
|
||||
|
||||
$name = strtolower($name);
|
||||
$username = isset($name) ? $name : null ;
|
||||
if (!$username) {
|
||||
$login = false;
|
||||
|
@ -62,10 +62,16 @@ class FormFilm extends Form {
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->reply = "<div class='column middle'>
|
||||
$this->reply = "<div class='row'>
|
||||
<div class='column side'></div>
|
||||
<div class='column middle'>
|
||||
<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>";
|
||||
|
||||
}
|
||||
@ -73,7 +79,7 @@ class FormFilm extends 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->option = $_option;
|
||||
|
||||
@ -83,6 +89,20 @@ class FormFilm extends Form {
|
||||
$language=$this->test_input($_language);
|
||||
$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
|
||||
|
||||
$bd = new Film_DAO('complucine');
|
||||
|
@ -11,28 +11,22 @@
|
||||
echo'<div class="column side"></div>
|
||||
<div class="column middle">
|
||||
<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">
|
||||
<fieldset id="film_form">
|
||||
<legend>Datos de pelicula</legend>
|
||||
<div>
|
||||
<input type="text" name="tittle" id="tittle" placeholder="Título" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="number" name="duration" id="duration" placeholder="Duración" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="language" id="language" placeholder="Idioma" />
|
||||
</div>
|
||||
<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>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Añadir pelicula" name="add_film" class="primary" />
|
||||
<input type="reset" id="reset" value="Borrar" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column side"></div>
|
||||
@ -41,7 +35,7 @@
|
||||
function deleteFilm() {
|
||||
echo'<div class="column side"></div>
|
||||
<div class="column middle">
|
||||
<h2>Editar pelicula</h2>
|
||||
<h2>Eliminar pelicula</h2>
|
||||
<form method="post" action="index.php?state=mf">
|
||||
<div class="row">
|
||||
<fieldset id="film_form">
|
||||
@ -72,18 +66,11 @@
|
||||
<fieldset id="film_form">
|
||||
<legend>Datos de pelicula</legend>
|
||||
<input type="hidden" name="id" value='.$_POST['id'].'/>
|
||||
<div>
|
||||
<input type="text" name="tittle" value="'.$_POST['tittle'].'" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' />
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="language" id="language" value="'.$_POST['language'].'" />
|
||||
</div>
|
||||
<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>
|
||||
</fieldset>
|
||||
<div class="actions">
|
||||
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
|
||||
@ -99,19 +86,19 @@
|
||||
// Logic Functions
|
||||
function confirmDelete() {
|
||||
$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();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
function confirmEdit() {
|
||||
$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();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
function confirmAdd() {
|
||||
$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();
|
||||
header('Location: ../panel_admin/index.php?state=mf');
|
||||
}
|
||||
|
16
panel_manager/edit_halls.php
Normal file
16
panel_manager/edit_halls.php
Normal 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();
|
||||
}
|
||||
|
||||
?>
|
9
panel_manager/hello_panel.php
Normal file
9
panel_manager/hello_panel.php
Normal 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>
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
include_once($prefix.'assets/php/common/hall_dao.php');
|
||||
include_once($prefix.'assets/php/form.php');
|
||||
include_once('../assets/php/common/hall_dao.php');
|
||||
include_once('../assets/php/form.php');
|
||||
|
||||
class FormHall extends Form {
|
||||
|
||||
@ -16,8 +16,14 @@ class FormHall extends Form {
|
||||
$this->reply = array();
|
||||
}
|
||||
|
||||
public static function generaCampoFormulario($datos, $errores = array(), $option){
|
||||
if($option == "new"){
|
||||
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'] ?? '';
|
||||
@ -25,15 +31,13 @@ class FormHall extends Form {
|
||||
|
||||
|
||||
$htmlform .= '
|
||||
<form method="post" id="new_hall" action="./includes/processForm.php"\>
|
||||
<fieldset>
|
||||
<label>Numero de sala:</label> <input type="number" name="number" value="'.$number.'" required/> <br>
|
||||
<label>Filas:</label> <input type="number" name="rows" value= "'.$rows.'" required/><br>
|
||||
<label>Columnas:</label> <input type="number" name="cols" value= "'.$cols.'" required/><br>
|
||||
<label>Butacas totales:</label> <input type="number" name="seats" value= "'.$seats.'"/><br>
|
||||
<button type="submit" name="new_hall" class="button large">Crear</button></div><br>
|
||||
<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>
|
||||
</form>
|
||||
';
|
||||
}
|
||||
|
||||
@ -70,11 +74,14 @@ class FormHall extends Form {
|
||||
}
|
||||
|
||||
//Process form:
|
||||
public static function processesForm($data){
|
||||
if($data["option"] == "new"){
|
||||
Hall::create_hall($data);
|
||||
$_SESSION['msg'] = "La sala se ha añadido correctamente";
|
||||
header( "Location: ../?state=success" );
|
||||
public function processesForm($datos){
|
||||
$this->correct = true;
|
||||
$bd = new HallDAO('complucine');
|
||||
|
||||
|
||||
if($bd ){
|
||||
if($option == "list"){
|
||||
$this->halls = $bd->getAllHalls($cinema);
|
||||
}else {
|
||||
/* TODO
|
||||
$start = date('H:i:s', strtotime( $start ) );
|
||||
@ -104,6 +111,8 @@ class FormHall extends Form {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
} else {$this->correct = false;}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,56 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<?php
|
||||
//ini_set('display_errors', 0);
|
||||
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
|
||||
//General Config File:
|
||||
require_once('../assets/php/config.php');
|
||||
//Controller file:
|
||||
|
||||
include_once('panel_manager.php');
|
||||
|
||||
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";
|
||||
}
|
||||
$login = (isset($_SESSION["login"]) && $_SESSION["rol"] == "manager") ? true : false;
|
||||
$panel = isset($_REQUEST['state']) ? new Panel($_REQUEST['state'],$login) : $panel = new Panel('',$login);
|
||||
|
||||
?>
|
||||
<!--
|
||||
Práctica - Sistemas Web | Grupo D
|
||||
@ -80,7 +37,7 @@
|
||||
?>
|
||||
<!--Contents -->
|
||||
<div class="row">
|
||||
<?php echo $panel; ?>
|
||||
<?php $panel->showPanel(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
|
35
panel_manager/manage_halls.php
Normal file
35
panel_manager/manage_halls.php
Normal 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;
|
||||
?>
|
||||
|
||||
|
37
panel_manager/manage_rooms.php
Normal file
37
panel_manager/manage_rooms.php
Normal 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);
|
||||
?>
|
||||
|
@ -1,10 +1,7 @@
|
||||
<?php
|
||||
include_once('../assets/php/common/hall.php');
|
||||
include_once('./includes/formHall.php');
|
||||
|
||||
class Manager_panel {
|
||||
|
||||
private $form;
|
||||
class Panel {
|
||||
public $state;
|
||||
public $login;
|
||||
|
||||
function __construct($panel,$log){
|
||||
$this->state = $panel;
|
||||
@ -12,91 +9,21 @@
|
||||
|
||||
}
|
||||
|
||||
static function welcome(){
|
||||
$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;
|
||||
function showPanel() {
|
||||
if($this->login){
|
||||
switch($this->state) {
|
||||
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 'rooms': require_once('manage_halls.php'); break;
|
||||
case 'sessions': require_once('manage_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;
|
||||
}
|
||||
|
||||
static function success(){
|
||||
$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>';
|
||||
else{
|
||||
echo "<h1> Error no tienes los permisos necesarios de gerente</h1>";
|
||||
}
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
77
panel_manager/validateSession.php
Normal file
77
panel_manager/validateSession.php
Normal 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>
|
@ -49,6 +49,7 @@ class FormRegister extends Form {
|
||||
$pass = $this->test_input($pass);
|
||||
$repass = $this->test_input($repass);
|
||||
|
||||
$name = strtolower($name);
|
||||
$username = isset($name) ? $name : null ;
|
||||
if (!$username) {
|
||||
$register = false;
|
||||
|
Loading…
Reference in New Issue
Block a user