2021-05-30 23:42:30 +02:00
|
|
|
<?php
|
2021-05-17 15:29:29 +02:00
|
|
|
//General Config File:
|
|
|
|
require_once('../assets/php/config.php');
|
|
|
|
//Controller file:
|
|
|
|
require_once('panel_manager.php');
|
2021-05-20 15:29:49 +02:00
|
|
|
require_once('../assets/php/includes/manager_dao.php');
|
|
|
|
require_once('../assets/php/includes/manager.php');
|
|
|
|
require_once('../assets/php/includes/user.php');
|
2021-05-20 10:53:47 +02:00
|
|
|
|
2021-06-02 09:36:59 +02:00
|
|
|
if($_SESSION["login"] && isset($_SESSION["lastRol"]) && ($_SESSION["lastRol"] === "admin" || $_SESSION["rol"] === "manager")) {
|
2021-05-20 10:53:47 +02:00
|
|
|
$manager = new Manager(null, null, null, null, null);
|
2021-06-01 12:30:28 +02:00
|
|
|
if(isset($_POST['changecinema']))$_SESSION['cinema'] = $_POST['cinema'];
|
|
|
|
|
2021-05-20 10:53:47 +02:00
|
|
|
|
|
|
|
$state = isset($_GET['state']) ? $_GET['state'] : '';
|
|
|
|
switch($state){
|
|
|
|
case "view_user":
|
2021-05-27 14:29:25 +02:00
|
|
|
$_SESSION["rol"] = null;
|
2021-06-03 14:09:25 +02:00
|
|
|
|
2021-05-27 14:29:25 +02:00
|
|
|
$panel .= "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<div class='code info'>
|
|
|
|
<h1> ¡ATENCIÓN! </h1><hr />
|
|
|
|
<p>Está viendo la web como un Usuario NO Registrado.</p>
|
2021-06-05 11:50:04 +02:00
|
|
|
<a href='".$prefix."'><button>Cerrar Mensaje</button></a>
|
2021-05-27 14:29:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class='column side'></div>
|
|
|
|
</div>
|
|
|
|
";
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "view_ruser":
|
2021-05-27 14:29:25 +02:00
|
|
|
$_SESSION["rol"] = "user";
|
2021-06-03 14:09:25 +02:00
|
|
|
unset($_SESSION["cinema"]);
|
2021-05-27 14:29:25 +02:00
|
|
|
$panel .= "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<div class='code info'>
|
|
|
|
<h1> ¡ATENCIÓN! </h1><hr />
|
|
|
|
<p>Está viendo la web como un Usuario Registrado.</p>
|
2021-06-05 11:50:04 +02:00
|
|
|
<a href='".$prefix."'><button>Cerrar Mensaje</button></a>
|
2021-05-27 14:29:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class='column side'></div>
|
|
|
|
</div>
|
|
|
|
";
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "manage_halls":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::manage_halls();
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "new_hall":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::new_hall();
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "edit_hall":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::edit_hall();
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "manage_sessions":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::calendar();
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
case "success":
|
2021-05-27 14:18:25 +02:00
|
|
|
$panel = Manager_panel::success();
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
default:
|
2021-05-27 14:18:25 +02:00
|
|
|
$panel = Manager_panel::welcomeAdmin($manager);
|
2021-05-20 10:53:47 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if($_SESSION["login"] && $_SESSION["rol"] === "manager"){
|
2021-06-03 14:09:25 +02:00
|
|
|
|
|
|
|
if(!isset($_SESSION['cinema'])){
|
|
|
|
$bd = new Manager_DAO('complucine');
|
|
|
|
if($bd){
|
|
|
|
$user = unserialize($_SESSION["user"]);
|
|
|
|
$manager = $bd->GetManager($user->getId());
|
|
|
|
$manager = $manager->fetch_assoc();
|
|
|
|
|
|
|
|
$_SESSION['cinema'] = $manager["idcinema"];
|
2021-05-17 15:29:29 +02:00
|
|
|
}
|
|
|
|
}
|
2021-06-03 14:09:25 +02:00
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
$state = isset($_GET['state']) ? $_GET['state'] : '';
|
2021-06-03 14:09:25 +02:00
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
switch($state){
|
|
|
|
case "view_user":
|
2021-05-18 09:20:24 +02:00
|
|
|
$_SESSION["lastRol"] = $_SESSION["rol"];
|
|
|
|
$_SESSION["rol"] = null;
|
2021-06-03 14:09:25 +02:00
|
|
|
unset($_SESSION["cinema"]);
|
2021-05-18 09:20:24 +02:00
|
|
|
$panel = "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<div class='code info'>
|
|
|
|
<h1> ¡ATENCIÓN! </h1><hr />
|
|
|
|
<p>Está viendo la web como un Usuario NO Registrado.</p>
|
2021-06-04 19:28:52 +02:00
|
|
|
<a href='".$prefix."'><button>Cerrar Mensaje</button></a>
|
2021-05-18 09:20:24 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class='column side'></div>
|
|
|
|
</div>
|
|
|
|
";
|
|
|
|
break;
|
|
|
|
case "view_ruser":
|
|
|
|
$_SESSION["lastRol"] = $_SESSION["rol"];
|
|
|
|
$_SESSION["rol"] = "user";
|
2021-06-03 14:09:25 +02:00
|
|
|
unset($_SESSION["cinema"]);
|
2021-05-18 09:20:24 +02:00
|
|
|
$panel = "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<div class='code info'>
|
|
|
|
<h1> ¡ATENCIÓN! </h1><hr />
|
|
|
|
<p>Está viendo la web como un Usuario Registrado.</p>
|
2021-06-05 11:50:04 +02:00
|
|
|
<a href='".$prefix."'><button>Cerrar Mensaje</button></a>
|
2021-05-18 09:20:24 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class='column side'></div>
|
2021-05-17 15:29:29 +02:00
|
|
|
</div>
|
2021-05-18 09:20:24 +02:00
|
|
|
";
|
2021-05-17 15:29:29 +02:00
|
|
|
break;
|
|
|
|
case "manage_halls":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::manage_halls();
|
2021-05-17 15:29:29 +02:00
|
|
|
break;
|
|
|
|
case "new_hall":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::new_hall();
|
2021-05-17 15:29:29 +02:00
|
|
|
break;
|
|
|
|
case "edit_hall":
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::edit_hall();
|
2021-05-17 15:29:29 +02:00
|
|
|
break;
|
|
|
|
case "manage_sessions":
|
2021-06-06 13:35:19 +02:00
|
|
|
$panel = Manager_panel::calendar();
|
2021-05-17 15:29:29 +02:00
|
|
|
break;
|
|
|
|
case "success":
|
|
|
|
$panel = Manager_panel::success();
|
|
|
|
break;
|
|
|
|
default:
|
2021-06-03 14:09:25 +02:00
|
|
|
$panel = Manager_panel::welcome();
|
2021-05-17 15:29:29 +02:00
|
|
|
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 con una cuenta de Gerente.</p>
|
|
|
|
<a href="'.$prefix.'login/" ><button class="button large">Iniciar Sesión</button></a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//Specific page content:
|
|
|
|
$section = '<!-- Manager Panel -->
|
2021-05-30 23:42:30 +02:00
|
|
|
|
|
|
|
|
2021-05-17 15:29:29 +02:00
|
|
|
<link rel="stylesheet" href="../assets/css/manager.css">
|
|
|
|
<section id="manager_panel">
|
|
|
|
<!-- Contents -->
|
|
|
|
<div class="row">
|
|
|
|
'.$panel.'
|
|
|
|
</div>
|
|
|
|
</section>';
|
|
|
|
|
|
|
|
//General page content:
|
|
|
|
require RAIZ_APP.'/HTMLtemplate.php';
|
|
|
|
?>
|
2021-05-30 23:42:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.css" />
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
|
2021-06-06 13:53:07 +02:00
|
|
|
<script src="../assets/js/sessionCalendar.js"></script>
|
|
|
|
<script src="../assets/js/sessionFormProcess.js"></script>
|