2021-04-26 22:40:34 +02:00
|
|
|
<?php
|
|
|
|
class Panel {
|
2021-05-02 16:01:05 +02:00
|
|
|
private $state;
|
|
|
|
private $login;
|
|
|
|
|
2021-04-26 22:40:34 +02:00
|
|
|
function __construct($panel, $login){
|
|
|
|
$this->state = $panel;
|
|
|
|
$this->login= $login;
|
|
|
|
}
|
|
|
|
|
2021-05-02 16:01:05 +02:00
|
|
|
function showPanel($template) {
|
2021-04-26 22:40:34 +02:00
|
|
|
if($this->login){
|
|
|
|
switch($this->state) {
|
2021-05-13 11:27:17 +02:00
|
|
|
case 'mc': if(isset($_POST['edit_cinema'])) {
|
2021-05-13 11:47:47 +02:00
|
|
|
$this->editCinema();
|
|
|
|
}
|
|
|
|
else if(isset($_POST['delete_cinema'])) {
|
|
|
|
$this->deleteCinema();
|
|
|
|
}
|
|
|
|
else if(isset($_POST['add_cinema'])) {
|
|
|
|
$this->addCinema();
|
2021-05-13 12:44:12 +02:00
|
|
|
echo ($template->print_cinemas());
|
2021-05-13 11:47:47 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this-> addCinema();
|
2021-05-13 12:44:12 +02:00
|
|
|
echo ($template->print_cinemas());
|
2021-05-13 11:47:47 +02:00
|
|
|
|
|
|
|
};
|
2021-05-02 17:25:58 +02:00
|
|
|
break;
|
2021-05-13 11:27:17 +02:00
|
|
|
case 'mf': if(isset($_POST['edit_film'])) {
|
|
|
|
$this->editFilm();
|
2021-05-13 11:47:47 +02:00
|
|
|
}
|
2021-05-02 17:25:58 +02:00
|
|
|
else if(isset($_POST['delete_film'])) {
|
2021-05-13 11:27:17 +02:00
|
|
|
$this->deleteFilm();
|
2021-05-02 17:25:58 +02:00
|
|
|
}
|
|
|
|
else if(isset($_POST['add_film'])) {
|
2021-05-13 11:27:17 +02:00
|
|
|
$this->addFilm();
|
2021-05-13 12:44:12 +02:00
|
|
|
echo ( $template->print_fimls());
|
2021-05-02 17:25:58 +02:00
|
|
|
}
|
|
|
|
else {
|
2021-05-13 11:27:17 +02:00
|
|
|
$this->addFilm();
|
2021-05-13 12:44:12 +02:00
|
|
|
echo( $template->print_fimls());
|
2021-05-02 17:25:58 +02:00
|
|
|
};
|
|
|
|
break;
|
2021-05-05 11:57:13 +02:00
|
|
|
case 'mp': require_once('manage_promotions.php');
|
|
|
|
if(isset($_POST['edit_promotion'])) {
|
2021-05-13 12:29:47 +02:00
|
|
|
$this->editPromotion();
|
2021-05-05 11:57:13 +02:00
|
|
|
}
|
|
|
|
else if(isset($_POST['delete_promotion'])) {
|
2021-05-13 12:29:47 +02:00
|
|
|
$this->deletePromotion();
|
2021-05-05 11:57:13 +02:00
|
|
|
}
|
|
|
|
else if(isset($_POST['add_promotion'])) {
|
2021-05-13 12:29:47 +02:00
|
|
|
$this->addPromotion();
|
2021-05-05 11:57:13 +02:00
|
|
|
}
|
|
|
|
else {
|
2021-05-13 12:29:47 +02:00
|
|
|
$this->addPromotion();
|
|
|
|
$this->print_promotions();
|
2021-05-05 11:57:13 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
break;
|
2021-05-13 11:47:47 +02:00
|
|
|
case 'mg': if(isset($_POST['edit_manager'])) {
|
|
|
|
$this->editManager();
|
|
|
|
}
|
|
|
|
else if(isset($_POST['delete_manager'])) {
|
|
|
|
$this->deleteManager();
|
|
|
|
}
|
|
|
|
else if(isset($_POST['add_manager'])) {
|
|
|
|
$this->addManager();
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
$this->showAddBotton();
|
|
|
|
$this->print_managers();
|
|
|
|
};
|
2021-05-05 19:33:03 +02:00
|
|
|
break;
|
2021-04-26 22:40:34 +02:00
|
|
|
case 'un': echo"<h1>En construcción</h1>"; break;
|
|
|
|
case 'ur': echo"<h1>En construcción</h1>";; break;
|
|
|
|
case 'ag': echo"<h1>En construcción</h1>";; break;
|
|
|
|
default: echo "<h1>BIENVENIDO AL PANEL DE ADMINISTRADOR</h1>"; break;
|
|
|
|
}
|
2021-05-13 11:39:54 +02:00
|
|
|
}
|
2021-05-13 11:47:47 +02:00
|
|
|
else {
|
|
|
|
echo "<h1>NO TIENES PERMISOS DE ADMINISTRADOR</h1>";
|
|
|
|
}
|
2021-05-13 11:39:54 +02:00
|
|
|
}
|
2021-04-26 22:40:34 +02:00
|
|
|
|
2021-05-13 11:47:47 +02:00
|
|
|
function getTemplate(){
|
|
|
|
return $this->template;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Functions FILMS
|
|
|
|
function addFilm(){
|
|
|
|
include_once('./includes/formAddFilm.php');
|
|
|
|
$formAF = new formAddFilm();
|
|
|
|
$htmlAForm = $formAF->gestiona();
|
|
|
|
echo '<!-- Add film -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlAForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteFilm() {
|
|
|
|
include_once('./includes/formDeleteFilm.php');
|
|
|
|
$formDF = new formDeleteFilm();
|
|
|
|
$htmlDForm = $formDF->gestiona();
|
|
|
|
echo '<!-- Add film -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
function editFilm() {
|
|
|
|
include_once('./includes/formEditFilm.php');
|
|
|
|
$formEF = new formEditFilm();
|
|
|
|
$htmlDForm = $formEF->gestiona();
|
|
|
|
echo '<!-- Add film -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//Functions Cinemas
|
|
|
|
function addCinema(){
|
|
|
|
include_once('./includes/formAddCinema.php');
|
|
|
|
$formAC = new formAddCinema();
|
|
|
|
$htmlAForm = $formAC->gestiona();
|
|
|
|
echo '<!-- Add cinema -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlAForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteCinema() {
|
|
|
|
include_once('./includes/formDeleteCinema.php');
|
|
|
|
$formDC = new formDeleteCinema();
|
|
|
|
$htmlDForm = $formDC->gestiona();
|
|
|
|
echo '<!-- Delete cinema -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function editCinema() {
|
|
|
|
include_once('./includes/formEditFilm.php');
|
|
|
|
$formEF = new formEditCinema();
|
|
|
|
$htmlDForm = $formEC->gestiona();
|
|
|
|
echo '<!-- Edit cinema -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Functions MANAGERS
|
|
|
|
function print_managers(){
|
|
|
|
include_once('../assets/php/common/manager_dao.php');
|
|
|
|
include_once('../assets/php/common/manager.php');
|
|
|
|
$manager = new Manager_DAO("complucine");
|
|
|
|
$managers = $manager->allManagersData();
|
|
|
|
$ids = array();
|
|
|
|
$idscinemas = array();
|
|
|
|
$usernames = array();
|
|
|
|
$email = array();
|
|
|
|
$rol = array();
|
|
|
|
|
|
|
|
foreach($managers as $key => $value){
|
|
|
|
$ids[$key] = $value->getId();
|
|
|
|
$idscinemas[$key] = $value->getIdcinema();
|
|
|
|
$usernames[$key] = $value->getUsername();
|
|
|
|
$email[$key] = $value->getEmail();
|
|
|
|
$rol[$key] = $value->getRoll();
|
2021-05-13 11:27:17 +02:00
|
|
|
}
|
2021-05-13 11:47:47 +02:00
|
|
|
echo "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<table class='alt'>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Id</th>
|
|
|
|
<th>IdCinema</th>
|
|
|
|
<th>Nombre</th>
|
|
|
|
<th>Email</th>
|
|
|
|
<th>password</th>
|
|
|
|
<th>Rol</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
for($i = 0; $i < count($managers); $i++){
|
|
|
|
echo '<tr>
|
|
|
|
<td>'. $ids[$i] .'</td>
|
|
|
|
<td>'. $idscinemas[$i] .'</td>
|
|
|
|
<td>'. $usernames[$i] .'</td>
|
|
|
|
<td>'. $email[$i] .'</td>
|
|
|
|
<td>'. $rol[$i] .'</td>
|
|
|
|
<td>
|
|
|
|
<form method="post" action="index.php?state=mg">
|
|
|
|
<input name="id" type="hidden" value="'.$ids[$i].'">
|
|
|
|
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
|
|
|
|
<input type="submit" id="submit" value="Editar" name="edit_manager" class="primary" />
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<form method="post" action="index.php?state=mg">
|
|
|
|
<input name="id" type="hidden" value="'.$ids[$i].'">
|
|
|
|
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
|
|
|
|
<input name="username" type="hidden" value="'.$usernames[$i].'">
|
|
|
|
<input name="email" type="hidden" value="'.$email[$i].'">
|
|
|
|
<input name="rol" type="hidden" value="'.$rol[$i].'">
|
|
|
|
<input type="submit" id="submit" value="Eliminar" name="delete_manager" class="primary" />
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
';
|
|
|
|
}
|
|
|
|
echo'</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>
|
|
|
|
';
|
|
|
|
}
|
|
|
|
function showAddBotton() {
|
|
|
|
echo'<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h2>Añadir gerente</h2>
|
|
|
|
<form method="post" action="index.php?state=mg">
|
|
|
|
<div class="actions">
|
|
|
|
<input type="submit" id="submit" value="Añadir gerente" name="add_manager" class="primary" />
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
function addManager(){
|
|
|
|
include_once('./includes/formAddManager.php');
|
|
|
|
$formAM = new formAddManager();
|
|
|
|
$htmlAForm = $formAM->gestiona();
|
|
|
|
echo '<!-- ADD MANAGER -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>AÑADIR GERENTE</h3>
|
|
|
|
'.$htmlAForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
function editManager(){
|
|
|
|
include_once('./includes/formEditManager.php');
|
|
|
|
$formEM = new formEditManager();
|
|
|
|
$htmlEForm = $formEM->gestiona();
|
|
|
|
echo '<!-- EDIT MANAGER -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>EDITAR GERENTE</h3>
|
|
|
|
'.$htmlEForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteManager(){
|
|
|
|
include_once('./includes/formDeleteManager.php');
|
|
|
|
$formDM = new formDeleteManager();
|
|
|
|
$htmlDForm = $formDM->gestiona();
|
|
|
|
echo '<!-- DELETE MANAGER -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>ELIMINAR GERENTE</h3>
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
2021-05-13 12:29:47 +02:00
|
|
|
function addPromotion(){
|
|
|
|
include_once('./includes/formAddPromotion.php');
|
|
|
|
$formAP = new formAddPromotion();
|
|
|
|
$htmlAForm = $formAP->gestiona();
|
|
|
|
echo '<!-- ADD PROMOTION -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>AÑADIR PROMOCIÓN</h3>
|
|
|
|
'.$htmlAForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
function editPromotion(){
|
|
|
|
include_once('./includes/formEditPromotion.php');
|
|
|
|
$formEP = new formEditPromotion();
|
|
|
|
$htmlEForm = $formEP->gestiona();
|
|
|
|
echo '<!-- EDIT MANAGER -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>EDITAR PROMOCIÓN</h3>
|
|
|
|
'.$htmlEForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
2021-05-13 11:47:47 +02:00
|
|
|
|
2021-05-13 12:29:47 +02:00
|
|
|
function deletePromotion(){
|
|
|
|
include_once('./includes/formDeletePromotion.php');
|
|
|
|
$formDP = new formDeletePromotion();
|
|
|
|
$htmlDForm = $formDP->gestiona();
|
|
|
|
echo '<!-- DELETE MANAGER -->
|
|
|
|
<div class="column side"></div>
|
|
|
|
<div class="column middle">
|
|
|
|
<h3>ELIMINAR PROMOCIÓN</h3>
|
|
|
|
'.$htmlDForm.'
|
|
|
|
</div>'."\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_promotions(){
|
|
|
|
$promo = new Promotion_DAO("complucine");
|
|
|
|
$promos = $promo->allPromotionData();
|
|
|
|
$ids = array();
|
|
|
|
$tittles = array();
|
|
|
|
$descriptions = array();
|
|
|
|
$codes = array();
|
|
|
|
$actives = array();
|
|
|
|
|
|
|
|
if(is_array($promos)){
|
|
|
|
foreach($promos as $key => $value){
|
|
|
|
$ids[$key] = $value->getId();
|
|
|
|
$tittles[$key] = $value->getTittle();
|
|
|
|
$descriptions[$key] = $value->getDescription();
|
|
|
|
$codes[$key] = $value->getCode();
|
|
|
|
$actives[$key] = $value->getActive();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<div class='row'>
|
|
|
|
<div class='column side'></div>
|
|
|
|
<div class='column middle'>
|
|
|
|
<table class='alt'>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Id</th>
|
|
|
|
<th>Título</th>
|
|
|
|
<th>Descripcion</th>
|
|
|
|
<th>Código</th>
|
|
|
|
<th>Activo</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
if(is_array($promos)){
|
|
|
|
for($i = 0; $i < count($promos); $i++){
|
|
|
|
echo '<tr>
|
|
|
|
<td>'. $ids[$i] .'</td>
|
|
|
|
<td>'. $tittles[$i] .'</td>
|
|
|
|
<td>'. $descriptions[$i] .'</td>
|
|
|
|
<td>'. $codes[$i] .'</td>
|
|
|
|
<td>'. $actives[$i] .'</td>
|
|
|
|
<td>
|
|
|
|
<form method="post" action="index.php?state=mp">
|
|
|
|
<input name="id" type="hidden" value="'.$ids[$i].'">
|
|
|
|
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
|
|
|
|
<input name="description" type="hidden" value="'.$descriptions[$i].'">
|
|
|
|
<input name="code" type="hidden" value="'.$codes[$i].'">
|
|
|
|
<input name="active" type="hidden" value="'.$actives[$i].'">
|
|
|
|
<input type="submit" id="submit" value="Editar" name="edit_promotion" class="primary" />
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<form method="post" action="index.php?state=mp">
|
|
|
|
<input name="id" type="hidden" value="'.$ids[$i].'">
|
|
|
|
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
|
|
|
|
<input name="description" type="hidden" value="'.$descriptions[$i].'">
|
|
|
|
<input name="code" type="hidden" value="'.$codes[$i].'">
|
|
|
|
<input name="active" type="hidden" value="'.$actives[$i].'">
|
|
|
|
<input type="submit" id="submit" value="Eliminar" name="delete_promotion" class="primary" />
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo'</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="column side"></div>
|
|
|
|
';
|
|
|
|
|
|
|
|
}
|
2021-05-13 11:47:47 +02:00
|
|
|
}
|
|
|
|
|
2021-05-13 11:39:54 +02:00
|
|
|
?>
|
2021-05-13 11:47:47 +02:00
|
|
|
|