From 258829ae2ee9716d40b697fe81fddb90f56f602e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mu=C3=B1oz=20Garcia?= <73303506+danimu03@users.noreply.github.com> Date: Thu, 13 May 2021 11:47:47 +0200 Subject: [PATCH] update --- panel_admin/panelAdmin.php | 339 ++++++++++++++++++++++++------------- 1 file changed, 225 insertions(+), 114 deletions(-) diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php index f05779b..6d35ad1 100644 --- a/panel_admin/panelAdmin.php +++ b/panel_admin/panelAdmin.php @@ -12,24 +12,24 @@ if($this->login){ switch($this->state) { case 'mc': if(isset($_POST['edit_cinema'])) { - $this->editCinema(); - } - else if(isset($_POST['delete_cinema'])) { - $this->deleteCinema(); - } - else if(isset($_POST['add_cinema'])) { - $this->addCinema(); - $template->print_cinemas(); - } - else { - $this-> addCinema(); - $template->print_cinemas(); - - }; + $this->editCinema(); + } + else if(isset($_POST['delete_cinema'])) { + $this->deleteCinema(); + } + else if(isset($_POST['add_cinema'])) { + $this->addCinema(); + $template->print_cinemas(); + } + else { + $this-> addCinema(); + $template->print_cinemas(); + + }; break; case 'mf': if(isset($_POST['edit_film'])) { $this->editFilm(); - } + } else if(isset($_POST['delete_film'])) { $this->deleteFilm(); } @@ -64,34 +64,20 @@ }; break; - case 'mg': require_once('manage_managers.php'); - if(isset($_POST['edit_manager'])) { - editManager(); - } - else if(isset($_POST['delete_manager'])) { - deleteManager(); - } - else if(isset($_POST['select_user'])) { - selectUser(); - } - else if(isset($_POST['select_cinema'])) { - selectCinema(); - } - else if(isset($_POST['add_manager'])) { - confirmAdd(); - } - - else if(isset($_POST['confirm_delete_manager'])) { - confirmDelete(); - } - else if(isset($_POST['confirm_edit_manager'])) { - confirmEdit(); - } - else { - addManager(); - print_managers(); - - }; + 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(); + }; break; case 'un': echo"

En construcción

"; break; case 'ur': echo"

En construcción

";; break; @@ -99,76 +85,201 @@ default: echo "

BIENVENIDO AL PANEL DE ADMINISTRADOR

"; break; } } - } - function getTemplate(){ - return $this->template; - } - - //Functions FILMS - function addFilm(){ - include_once('./includes/formAddFilm.php'); - $formAF = new formAddFilm(); - $htmlAForm = $formAF->gestiona(); - echo ' -
-
- '.$htmlAForm.' -
'."\n"; - } - - function deleteFilm() { - include_once('./includes/formDeleteFilm.php'); - $formDF = new formDeleteFilm(); - $htmlDForm = $formDF->gestiona(); - echo ' -
-
- '.$htmlDForm.' -
'."\n"; - } - function editFilm() { - include_once('./includes/formEditFilm.php'); - $formEF = new formEditFilm(); - $htmlDForm = $formEF->gestiona(); - echo ' -
-
- '.$htmlDForm.' -
'."\n"; - } - //Functions Cinemas - function addCinema(){ - include_once('./includes/formAddCinema.php'); - $formAC = new formAddCinema(); - $htmlAForm = $formAC->gestiona(); - echo ' -
-
- '.$htmlAForm.' -
'."\n"; - } - - function deleteCinema() { - include_once('./includes/formDeleteCinema.php'); - $formDC = new formDeleteCinema(); - $htmlDForm = $formDC->gestiona(); - echo ' -
-
- '.$htmlDForm.' -
'."\n"; - } - - function editCinema() { - include_once('./includes/formEditFilm.php'); - $formEF = new formEditCinema(); - $htmlDForm = $formEC->gestiona(); - echo ' -
-
- '.$htmlDForm.' -
'."\n"; - } + else { + echo "

NO TIENES PERMISOS DE ADMINISTRADOR

"; } - + } + + function getTemplate(){ + return $this->template; + } + + //Functions FILMS + function addFilm(){ + include_once('./includes/formAddFilm.php'); + $formAF = new formAddFilm(); + $htmlAForm = $formAF->gestiona(); + echo ' +
+
+ '.$htmlAForm.' +
'."\n"; + } + + function deleteFilm() { + include_once('./includes/formDeleteFilm.php'); + $formDF = new formDeleteFilm(); + $htmlDForm = $formDF->gestiona(); + echo ' +
+
+ '.$htmlDForm.' +
'."\n"; + } + function editFilm() { + include_once('./includes/formEditFilm.php'); + $formEF = new formEditFilm(); + $htmlDForm = $formEF->gestiona(); + echo ' +
+
+ '.$htmlDForm.' +
'."\n"; + } + + //Functions Cinemas + function addCinema(){ + include_once('./includes/formAddCinema.php'); + $formAC = new formAddCinema(); + $htmlAForm = $formAC->gestiona(); + echo ' +
+
+ '.$htmlAForm.' +
'."\n"; + } + + function deleteCinema() { + include_once('./includes/formDeleteCinema.php'); + $formDC = new formDeleteCinema(); + $htmlDForm = $formDC->gestiona(); + echo ' +
+
+ '.$htmlDForm.' +
'."\n"; + } + + function editCinema() { + include_once('./includes/formEditFilm.php'); + $formEF = new formEditCinema(); + $htmlDForm = $formEC->gestiona(); + echo ' +
+
+ '.$htmlDForm.' +
'."\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(); + } + echo "
+
+
+ + + + + + + + + + + + + "; + for($i = 0; $i < count($managers); $i++){ + echo ' + + + + + + + + + '; + } + echo' +
IdIdCinemaNombreEmailpasswordRol
'. $ids[$i] .''. $idscinemas[$i] .''. $usernames[$i] .''. $email[$i] .''. $rol[$i] .' +
+ + + +
+
+
+ + + + + + +
+
+
+
+ '; + } + function showAddBotton() { + echo'
+
+

Añadir gerente

+
+
+ +
+
+
+
'; + } + function addManager(){ + include_once('./includes/formAddManager.php'); + $formAM = new formAddManager(); + $htmlAForm = $formAM->gestiona(); + echo ' +
+
+

AÑADIR GERENTE

+ '.$htmlAForm.' +
'."\n"; + } + function editManager(){ + include_once('./includes/formEditManager.php'); + $formEM = new formEditManager(); + $htmlEForm = $formEM->gestiona(); + echo ' +
+
+

EDITAR GERENTE

+ '.$htmlEForm.' +
'."\n"; + } + + function deleteManager(){ + include_once('./includes/formDeleteManager.php'); + $formDM = new formDeleteManager(); + $htmlDForm = $formDM->gestiona(); + echo ' +
+
+

ELIMINAR GERENTE

+ '.$htmlDForm.' +
'."\n"; + } + + + + } + ?> +