en proceso para que admin pueda ver como gerente

por ahora peta esta en proceso, se sube para que mi compañero pueda unir su parte
This commit is contained in:
OscarRui 2021-05-20 10:53:47 +02:00 committed by GitHub
parent e93b191100
commit e799376cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 2 deletions

View File

@ -7,8 +7,48 @@
require_once('../assets/php/common/manager_dao.php');
require_once('../assets/php/common/manager.php');
require_once('../assets/php/common/user.php');
if($_SESSION["login"] && $_SESSION["rol"] === "manager"){
if($_SESSION["login"] && $_SESSION["lastRol"] === "admin" && $_SESSION["rol"] === "manager") {
$manager = false;
$manager = new Manager(null, null, null, null, null);
$state = isset($_GET['state']) ? $_GET['state'] : '';
switch($state){
case "view_user":
break;
case "view_ruser":
break;
case "manage_halls":
$panel = Manager_panel::manage_halls($manager);
break;
case "new_hall":
$panel = Manager_panel::new_hall($manager);
break;
case "edit_hall":
$panel = Manager_panel::edit_hall($manager);
break;
case "manage_sessions":
$panel = Manager_panel::manage_sessions($manager);
break;
case "new_session":
$panel = Manager_panel::new_session($manager);
break;
case "edit_session":
$panel = Manager_panel::edit_session($manager);
break;
case "select_film":
$panel = Manager_panel::select_film($template,$manager);
break;
case "success":
$panel = Manager_panel::success();
break;
default:
$panel = Manager_panel::welcomeAdmin($manager);
break;
}
}
else if($_SESSION["login"] && $_SESSION["rol"] === "manager"){
$bd = new Manager_DAO('complucine');
$manager = false;
if($bd && !$manager){

View File

@ -2,6 +2,7 @@
include_once($prefix.'assets/php/common/hall.php');
include_once($prefix.'assets/php/common/session.php');
require_once($prefix.'assets/php/common/manager.php');
require_once($prefix.'assets/php/common/cinema_dao.php');
include_once('./includes/formHall.php');
include_once('./includes/formSession.php');
@ -24,6 +25,45 @@
return $panel;
}
static function welcomeAdmin($manager) {
$cinemaList = new Cinema_DAO('complucine');
$cinemas = $cinemaList->allCinemaData();
$cinema = 1;
$name = strtoupper($_SESSION["nombre"]);
if(isset($_POST['change'])){
$manager->setIdcinema($_POST['cinema']);
}
if($manager->getIdcinema() != null) $cinema = strtoupper( $manager->getIdcinema());
$panel = '<div class="code info">
<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1>
<hr />
<p>Usuario: '.$name.'</p>
<p>Cine: '.$cinema.'</p>
<p>Espero que estes pasando un buen dia</p>
<form method="post" id="changecinema" action="index.php">
<select name="cinema" class="button">
';
foreach($cinemas as $c){
if($c->getId() == $cinema){
$panel .= "<option value=\"". $c->getId() ." \"selected> " . $c->getId() ."</option>
";
}else{
$panel .= "<option value=\"". $c->getId() ." \"> " . $c->getId() . "</option>
";
}
}
$panel .= ' <input type="submit" name="change" value="Cambiar" /><br>
</select>
</form>
</div>';
return $panel;
}
static function success(){
$panel = '<div class="code info">