diff --git a/panel_admin/index.php b/panel_admin/index.php index cd54087..e6d94ad 100644 --- a/panel_admin/index.php +++ b/panel_admin/index.php @@ -4,55 +4,139 @@ require_once($prefix.'panel_admin/panelAdmin.php'); - $login=false; - if(isset($_SESSION["login"]) && $_SESSION["rol"] == "admin") $login = true; - if(isset($_GET['state'])) { - $panel = new Panel($_GET['state'], $login); - } - else { - $panel = new Panel('', $login); - } - -?> - - - - - print_head(); - ?> - - - print_header(); - ?> - - print_main(); - ?> + if(($_SESSION["login"]) && $_SESSION["rol"] == "admin"){ + if(!isset($_GET["state"])) + $_GET["state"] =null; + switch($_GET["state"]){ + case 'mc': if(isset($_POST['edit_cinema'])) { + $reply=AdminPanel::editCinema(); + } + else if(isset($_POST['delete_cinema'])) { + $reply=AdminPanel::deleteCinema(); + } + else { + $reply=AdminPanel::addCinema(); + $reply.= ($template->print_cinemas()); + + }; + break; + case 'mf': if(isset($_POST['edit_film'])) { + $reply=AdminPanel::editFilm(); + } + else if(isset($_POST['delete_film'])) { + $reply=AdminPanel::deleteFilm(); + } + else { + $reply=AdminPanel::addFilm(); + $reply.= $template->print_fimls(); + }; + break; + case 'mp': + if(isset($_POST['edit_promotion'])) { + $reply=AdminPanel::editPromotion(); + } + else if(isset($_POST['delete_promotion'])) { + $reply=AdminPanel::deletePromotion(); + } + else { + $reply=AdminPanel::addPromotion(); + $reply.=AdminPanel::print_promotions(); + + }; + break; + case 'mg': if(isset($_POST['edit_manager'])) { + $reply=AdminPanel::editManager(); + } + else if(isset($_POST['delete_manager'])) { + $reply=AdminPanel::deleteManager(); + } + else if(isset($_POST['add_manager'])) { + $reply=AdminPanel::addManager(); + } + + else { + $reply=AdminPanel::showAddBotton(); + $reply.=AdminPanel::print_managers(); + }; + break; + case 'un': + $_SESSION["lastRol"] = $_SESSION["rol"]; + //unset($_SESSION["rol"]); + $_SESSION["rol"] = null; + header("Location: {$_SERVER['PHP_SELF']}"); + $_SESSION['message'] = "
+
+
+
+

¡ATENCIÓN!


+

Está viendo la web como un Usuario NO Registrado.

+ +
+
+
+
+ "; + break; + case 'ur': + $_SESSION["lastRol"] = $_SESSION["rol"]; + $_SESSION["rol"] = "user"; + header("Location: {$_SERVER['PHP_SELF']}"); + $_SESSION['message'] = "
+
+
+
+

¡ATENCIÓN!


+

Está viendo la web como un Usuario Registrado.

+ +
+
+
+
+ "; + break; + case 'ag': + $_SESSION["lastRol"] = $_SESSION["rol"]; + $_SESSION["rol"] = "manager"; + header("Location: {$_SERVER['PHP_SELF']}"); + $_SESSION['message'] = "
+
+
+
+

¡ATENCIÓN!


+

Está viendo la web como un Gerente.

+ +
+
+
+
+ "; + break; + default: + $reply=AdminPanel:: panel(); + break; + } + } + else{ + $reply ='
+
+
+

No tienes permiso de administrador.


+

Inicia Sesión con una cuenta de administtación.

+ +
+
+
'."\n"; + } + + $section = ' +
+ +
+ '.$reply.' +
+
'; - -
- - print_panelMenu($_SESSION["rol"]); - ?> - -
- print_msg(); - $panel->showPanel($template); - ?> -
-
- - print_footer(); - ?> - - - + require RAIZ_APP.'/HTMLtemplate.php'; + +?> \ No newline at end of file diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php index 7718524..8a60c17 100644 --- a/panel_admin/panelAdmin.php +++ b/panel_admin/panelAdmin.php @@ -1,172 +1,52 @@ state = $panel; - $this->login= $login; - } + function __construct(){} - function showPanel($template) { - $this->prefix = $template->get_prefix(); - if($this->login){ - switch($this->state) { - case 'mc': if(isset($_POST['edit_cinema'])) { - $this->editCinema(); - } - else if(isset($_POST['delete_cinema'])) { - $this->deleteCinema(); - } - else { - $this-> addCinema(); - echo ($template->print_cinemas()); - - }; - break; - case 'mf': if(isset($_POST['edit_film'])) { - $this->editFilm(); - } - else if(isset($_POST['delete_film'])) { - $this->deleteFilm(); - } - else { - $this->addFilm(); - echo( $template->print_fimls()); - }; - break; - case 'mp': - if(isset($_POST['edit_promotion'])) { - $this->editPromotion(); - } - else if(isset($_POST['delete_promotion'])) { - $this->deletePromotion(); - } - else { - $this->addPromotion(); - $this->print_promotions(); - - }; - break; - 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': - $_SESSION["lastRol"] = $_SESSION["rol"]; - //unset($_SESSION["rol"]); - $_SESSION["rol"] = null; - header("Location: {$_SERVER['PHP_SELF']}"); - $_SESSION['message'] = "
-
-
-
-

¡ATENCIÓN!


-

Está viendo la web como un Usuario NO Registrado.

- -
-
-
-
- "; - break; - case 'ur': - $_SESSION["lastRol"] = $_SESSION["rol"]; - $_SESSION["rol"] = "user"; - header("Location: {$_SERVER['PHP_SELF']}"); - $_SESSION['message'] = "
-
-
-
-

¡ATENCIÓN!


-

Está viendo la web como un Usuario Registrado.

- -
-
-
-
- "; - break; - case 'ag': - $_SESSION["lastRol"] = $_SESSION["rol"]; - $_SESSION["rol"] = "manager"; - header("Location: {$_SERVER['PHP_SELF']}"); - $_SESSION['message'] = "
-
-
-
-

¡ATENCIÓN!


-

Está viendo la web como un Gerente.

- -
-
-
-
- "; - break; - default: echo '
-

Bienvenido al Panel de Administrador.

-
-
'."\n"; break; - } - } - else { - echo '
-
-
-

No tienes permiso de administrador.


-

Inicia Sesión con una cuenta de administtación.

- -
-
-
'."\n"; - } - } function getTemplate(){ return $this->template; } + static function panel(){ + return $reply= '
+

Bienvenido al Panel de Administrador.

+
+
'."\n"; + } + //Functions FILMS - function addFilm(){ + static function addFilm(){ include_once('./includes/formAddFilm.php'); $formAF = new formAddFilm(); $htmlAForm = $formAF->gestiona(); - echo ' + return $reply= '
'.$htmlAForm.'
'."\n"; } - function deleteFilm() { + static function deleteFilm() { include_once('./includes/formDeleteFilm.php'); $formDF = new formDeleteFilm(); $htmlDForm = $formDF->gestiona(); - echo ' + return $reply= '
'.$htmlDForm.'
'."\n"; } - function editFilm() { + + static function editFilm() { include_once('./includes/formEditFilm.php'); $formEF = new formEditFilm(); $htmlDForm = $formEF->gestiona(); - echo ' + return $reply= '
'.$htmlDForm.' @@ -174,33 +54,33 @@ } //Functions Cinemas - function addCinema(){ + static function addCinema(){ include_once('./includes/formAddCinema.php'); $formAC = new formAddCinema(); $htmlAForm = $formAC->gestiona(); - echo ' + return $reply= '
'.$htmlAForm.'
'."\n"; } - function deleteCinema() { + static function deleteCinema() { include_once('./includes/formDeleteCinema.php'); $formDC = new formDeleteCinema(); $htmlDForm = $formDC->gestiona(); - echo ' + return $reply= '
'.$htmlDForm.'
'."\n"; } - function editCinema() { + static function editCinema() { include_once('./includes/formEditCinema.php'); $formEC = new formEditCinema(); $htmlDForm = $formEC->gestiona(); - echo ' + return $reply= '
'.$htmlDForm.' @@ -209,7 +89,7 @@ //Functions MANAGERS - function print_managers(){ + static function print_managers(){ include_once('../assets/php/common/manager_dao.php'); include_once('../assets/php/common/manager.php'); $manager = new Manager_DAO("complucine"); @@ -228,7 +108,7 @@ $rol[$key] = $value->getRoll(); } } - echo "
+ $reply= "
@@ -245,7 +125,7 @@ "; if(is_array($managers)){ for($i = 0; $i < count($managers); $i++){ - echo ' + $reply.= ' @@ -272,15 +152,16 @@ '; } } - echo' + $reply.='
'. $ids[$i] .' '. $idscinemas[$i] .' '. $usernames[$i] .'
'; + return $reply; } - function showAddBotton() { - echo'
+ static function showAddBotton() { + return $reply = '

Añadir gerente

@@ -293,11 +174,11 @@
'; } - function addManager(){ + static function addManager(){ include_once('./includes/formAddManager.php'); $formAM = new formAddManager(); $htmlAForm = $formAM->gestiona(); - echo ' + return $reply= '

AÑADIR GERENTE

@@ -305,11 +186,11 @@
'."\n"; } - function editManager(){ + static function editManager(){ include_once('./includes/formEditManager.php'); $formEM = new formEditManager(); $htmlEForm = $formEM->gestiona(); - echo ' + return $reply= '

EDITAR GERENTE

@@ -318,11 +199,11 @@
'."\n"; } - function deleteManager(){ + static function deleteManager(){ include_once('./includes/formDeleteManager.php'); $formDM = new formDeleteManager(); $htmlDForm = $formDM->gestiona(); - echo ' + return $reply= '

ELIMINAR GERENTE

@@ -333,11 +214,11 @@ //Functions PROMOTIONS - function addPromotion(){ + static function addPromotion(){ include_once('./includes/formAddPromotion.php'); $formAP = new formAddPromotion(); $htmlAForm = $formAP->gestiona(); - echo ' + return $reply= '

AÑADIR PROMOCIÓN

@@ -345,11 +226,12 @@
'."\n"; } - function editPromotion(){ + + static function editPromotion(){ include_once('./includes/formEditPromotion.php'); $formEP = new formEditPromotion(); $htmlEForm = $formEP->gestiona(); - echo ' + return $reply= '

EDITAR PROMOCIÓN

@@ -358,11 +240,11 @@
'."\n"; } - function deletePromotion(){ + static function deletePromotion(){ include_once('./includes/formDeletePromotion.php'); $formDP = new formDeletePromotion(); $htmlDForm = $formDP->gestiona(); - echo ' + return $reply= '

ELIMINAR PROMOCIÓN

@@ -370,7 +252,7 @@
'."\n"; } - function print_promotions(){ + static function print_promotions(){ $promo = new Promotion_DAO("complucine"); $promos = $promo->allPromotionData(); $ids = array(); @@ -389,60 +271,65 @@ } } - echo " -
- - - - - - - - - - - - "; + $reply= "
+ +
+
IdTítuloDescripcionCódigoActivo
+ + + + + + + + + + + "; if(is_array($promos)){ for($i = 0; $i < count($promos); $i++){ - echo ' - - - - - - - - + $reply.= ' + + + + + + + + '; } } - echo' -
IdTítuloDescripcionCódigoActivo
'. $ids[$i] .''. $tittles[$i] .''. $descriptions[$i] .''. $codes[$i] .''. $actives[$i] .' - - - - - - - - - -
- - - - - - -
-
'. $ids[$i] .''. $tittles[$i] .''. $descriptions[$i] .''. $codes[$i] .''. $actives[$i] .' +
+ + + + + + +
+
+
+ + + + + + +
+
-
-
+ $reply.=' + +
+
+
'; - + return $reply ; } + } ?> + +