Add files via upload

This commit is contained in:
Markines16 2021-05-04 21:14:18 +02:00 committed by GitHub
parent ea3fc5f55a
commit 43219ccefa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 142 additions and 26 deletions

View File

@ -1,13 +1,56 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../assets/php/config.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);
//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";
}
?>
<!--
Práctica - Sistemas Web | Grupo D
@ -37,7 +80,7 @@
?>
<!--Contents -->
<div class="row">
<?php $panel->showPanel(); ?>
<?php echo $panel; ?>
</div>
</div>
<!-- Footer -->

View File

@ -1,7 +1,10 @@
<?php
class Panel {
public $state;
public $login;
include_once('../assets/php/common/hall.php');
include_once('./includes/formHall.php');
class Manager_panel {
private $form;
function __construct($panel,$log){
$this->state = $panel;
@ -9,21 +12,91 @@
}
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;
}
}
else{
echo "<h1> Error no tienes los permisos necesarios de gerente</h1>";
}
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;
}
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>';
}
$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;
}
}
?>