From f1895fd4f6d6d46f787e9a91a34487fbcd272b41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernando=20M=C3=A9ndez?=
<45081533+FerMdez@users.noreply.github.com>
Date: Fri, 2 Jul 2021 17:54:32 +0200
Subject: [PATCH] Delete panel_admin directory
---
panel_admin/includes/formAddCinema.php | 90 ----
panel_admin/includes/formAddFilm.php | 151 ------
panel_admin/includes/formAddManager.php | 146 ------
panel_admin/includes/formAddPromotion.php | 162 ------
panel_admin/includes/formDeleteCinema.php | 76 ---
panel_admin/includes/formDeleteFilm.php | 88 ----
panel_admin/includes/formDeleteManager.php | 83 ---
panel_admin/includes/formDeletePromotion.php | 90 ----
panel_admin/includes/formEditCinema.php | 101 ----
panel_admin/includes/formEditFilm.php | 180 -------
panel_admin/includes/formEditManager.php | 113 -----
panel_admin/includes/formEditPromotion.php | 183 -------
panel_admin/index.php | 110 ----
panel_admin/panelAdmin.php | 500 -------------------
14 files changed, 2073 deletions(-)
delete mode 100644 panel_admin/includes/formAddCinema.php
delete mode 100644 panel_admin/includes/formAddFilm.php
delete mode 100644 panel_admin/includes/formAddManager.php
delete mode 100644 panel_admin/includes/formAddPromotion.php
delete mode 100644 panel_admin/includes/formDeleteCinema.php
delete mode 100644 panel_admin/includes/formDeleteFilm.php
delete mode 100644 panel_admin/includes/formDeleteManager.php
delete mode 100644 panel_admin/includes/formDeletePromotion.php
delete mode 100644 panel_admin/includes/formEditCinema.php
delete mode 100644 panel_admin/includes/formEditFilm.php
delete mode 100644 panel_admin/includes/formEditManager.php
delete mode 100644 panel_admin/includes/formEditPromotion.php
delete mode 100644 panel_admin/index.php
delete mode 100644 panel_admin/panelAdmin.php
diff --git a/panel_admin/includes/formAddCinema.php b/panel_admin/includes/formAddCinema.php
deleted file mode 100644
index b539ab9..0000000
--- a/panel_admin/includes/formAddCinema.php
+++ /dev/null
@@ -1,90 +0,0 @@
-"./?state=mc");
- parent::__construct('formAddCinema',$op);
- }
-
- protected function generaCamposFormulario($datos,$errores=array()){
-
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorName = self::createMensajeError($errores,'namecinema','span',array('class'=>'error'));
- $errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
- $errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
-
- $html = '
- '.$htmlErroresGlobales.'
- Añadir cine
- '.$errorName.'
- '.$errorDirection.'
- '.$errrorPhone.'
-
-
-
-
-
- ';
-
- return $html;
- }
-
- //Process form:
- public function procesaFormulario($datos) {
- $result =array();
-
- $name = $this->test_input($datos['namecinema'])??null;
-
- if(empty($name)){
- $result['namecinema']= "El nombre no es válido";
- }
-
- $direction = $this -> test_input($datos['direction']) ?? null;
-
- if(empty($direction)){
- $result['direction'] = "La dirección no es valida";
- }
-
- $phone = $this -> test_input($datos['phone']) ?? null;
-
- if(empty($phone)){
- $result['phone'] = "El teléfono no es valido";
- }
-
- if(count($result)===0){
-
- $bd = new Cinema_DAO('complucine');
- $exist = $bd -> GetCinema($name,$direction);
- if(mysqli_num_rows($exist)!=0){
- $result[] = "Ya existe un cine con ese nombre o dirección";
- }
- else{
- $bd->createCinema(null,$name,$direction,$phone);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha añadido el cine correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mc';
- }
- $exist->free();
- }
- return $result;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formAddFilm.php b/panel_admin/includes/formAddFilm.php
deleted file mode 100644
index 0d01233..0000000
--- a/panel_admin/includes/formAddFilm.php
+++ /dev/null
@@ -1,151 +0,0 @@
- "./?state=mf", 'enctype' => 'multipart/form-data');
- parent::__construct('formAddFilm', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- $errorDuration = self::createMensajeError($errores, 'duration', 'span', array('class' => 'error'));
- $errorLanguage = self::createMensajeError($errores, 'language', 'span', array('class' => 'error'));
- $errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- $errorImage = self::createMensajeError($errores, 'img', 'span', array('class' => 'error'));
-
- $html = '
- ';
-
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $t = $this->test_input($datos['tittle']) ?? null;
- $tittle = strtolower(str_replace(" ", "_", $t));
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle)
- if ( empty($tittle) ) {
- $result['tittle'] = "El título no es válido";
- }
-
- $duration = $this->test_input($datos['duration']) ?? null;
- //||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration)
- if ( empty($duration) || $duration <0) {
- $result['duration'] = "La duración no es válida";
- }
-
- $language = $this->test_input($datos['language']) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $language)
- if ( empty($language) ) {
- $result['language'] = "El idioma no es válido";
- }
-
- $description = $this->test_input($datos['description']) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
- if ( empty($language)) {
- $result['language'] = "La descripcion no es válida";
- }
-
- if (count($result) === 0) {
- $bd = new Film_DAO("complucine");
- $exist = $bd-> GetFilm($tittle,$language);
- if(mysqli_num_rows($exist) != 0){
- $result[] = "Ya existe una nueva pelicula con el mismo titulo e idioma.";
- }
- else{
- $ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
- if ( $ok ) {
- $archivo = $_FILES['archivo'];
- $nombre = $_FILES['archivo']['name'];
- //1.a) Valida el nombre del archivo
- $ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
-
- // 1.b) Sanitiza el nombre del archivo
- //$ok = $this->sanitize_file_uploaded_name($nombre);
- //
-
- // 1.c) Utilizar un id de la base de datos como nombre de archivo
-
- // 2. comprueba si la extensión está permitida
- $ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
-
- // 3. comprueba el tipo mime del archivo correspode a una imagen image
- $finfo = new \finfo(FILEINFO_MIME_TYPE);
- $mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
- $ok = preg_match('/image\/*./', $mimeType);
- //finfo_close($finfo);
-
- if ( $ok ) {
- $tmp_name = $_FILES['archivo']['tmp_name'];
- $nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
- if ( !move_uploaded_file($tmp_name, "../img/films/{$nombreBd}") ) {
- $result['img'] = 'Error al mover el archivo';
- }
-
- //if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
- // $result['img'] = 'Error al mover el archivo';
- //}
- //$nombreBd = str_replace("_", " ", $nombre);
- $bd->createFilm(null, $tittle,$duration,$language,$description, $nombreBd); //Null hasta tener $nombre
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha añadido la pelicula correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mf';
-
- }else {
- $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
- }
- } else {
- $result['img'] = 'Error al subir el archivo.';
- }
-
- }
- $exist->free();
- }
- return $result;
- }
-
- private function check_file_uploaded_name ($filename) {
- return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
- }
- private function check_file_uploaded_length ($filename) {
- return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
- }
-
-}
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formAddManager.php b/panel_admin/includes/formAddManager.php
deleted file mode 100644
index 03ae6dd..0000000
--- a/panel_admin/includes/formAddManager.php
+++ /dev/null
@@ -1,146 +0,0 @@
- "./?state=mg");
- parent::__construct('formAddManager', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html = "";
-
- if (!isset($_SESSION['message'])) {
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- $errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
-
- $html .= 'AÑADIR GERENTE
- '.$htmlErroresGlobales.'
- Selecciona usuario. '.$errorId.' '
- .$this->showUsers().
- '
-
- Selecciona cine. '.$errorIdCinema.' '
- .$this->showCinemas().
- '
-
-
-
-
-
- ';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($datos['id']) ?? null;
- if (is_null($id) ) {
- $result['id'] = "ERROR. No existe un usuario con ese ID";
- }
-
- $idcinema = $this->test_input($datos['idcinema']) ?? null;
- //||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration)
- if (empty($idcinema)) {
- $result['idcinema'] = "ERROR. No existe un cine con ese ID";
- }
-
-
- if (count($result) === 0) {
- $bd = new Manager_DAO("complucine");
-
- // check if already exist a manager with same name
- $exist = $bd->GetManagerCinema($id, $idcinema);
- if( mysqli_num_rows($exist) != 0){
- $result[] = "Ya existe un manager asociado a este usuario y cine";
- }
- else{
- $bd->createManager($id, $idcinema);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha añadido el gerente correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
- ";
- //$result = './?state=mg';
- }
- $exist->free();
-
-
- }
- return $result;
- }
-
- private function showUsers() {
- $user = new UserDAO("complucine");
- $users = $user->allUsersNotM();
- $ids = array();
- $usernames = array();
- $emails = array();
- $roles = array();
-
-
- foreach($users as $key => $value){
- $ids[$key] = $value->getId();
- $usernames[$key] = $value->getName();
- $emails[$key] = $value->getEmail();
- $roles[$key] = $value->getRol();
- }
- $html='';
- for($i = 0; $i < count($users); $i++){
- $html .= '
-
'.$ids[$i].', '.$usernames[$i].
- ', '.$usernames[$key].
- '
-
- ';
- }
- return $html;
- }
-
- private function showCinemas() {
- $cine = new Cinema_DAO("complucine");
- $cinemas = $cine->allCinemaData();
- $ids = array();
- $names = array();
- $directions = array();
- $phones = array();
-
- foreach($cinemas as $key => $value){
- $ids[$key] = $value->getId();
- $names[$key] = $value->getName();
- $directions[$key] = $value->getDirection();
- $phones[$key] = $value->getPhone();
- }
- $html = '';
- for($i = 0; $i < count($cinemas); $i++){
- $html.= '
-
'.$ids[$i].', '.$names[$i].'
-
- ';
- }
- return $html;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formAddPromotion.php b/panel_admin/includes/formAddPromotion.php
deleted file mode 100644
index 0ba6b0b..0000000
--- a/panel_admin/includes/formAddPromotion.php
+++ /dev/null
@@ -1,162 +0,0 @@
- "./?state=mp", 'enctype' => 'multipart/form-data');
- parent::__construct('formAddPromotion', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- $errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- $errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
- $errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
- //$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
-
- $html = '
-
';
-
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $t = $this->test_input($datos['tittle']) ?? null;
- $tittle = strtolower(str_replace(" ", "_", $t));
-
- if ( empty($tittle) ) {
- $result['tittle'] = "El título no es válido";
- }
-
- $description = $this->test_input($datos['description']) ?? null;
-
- if ( empty($description)) {
- $result['description'] = "La descripcion no es válida";
- }
-
- $code = $this->test_input($datos['code']) ?? null;
-
- if ( empty($code) ) {
- $result['code'] = "El idioma no es válido";
- }
-
- $active = strtolower($this->test_input($datos['active'])) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
- if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
- if ( strcmp($active,"si") == 0 ) {
- $boolean = 1;
- }
- else {
- $boolean = 0;
- }
- }
- else {
- $result['active'] = "El valor activo debe ser si/no";
- }
-
- if (count($result) === 0) {
- $bd = new Promotion_DAO("complucine");
- $exist = $bd-> GetPromotion($code);
- if(mysqli_num_rows($exist) != 0){
- $result[] = "Ya existe una nueva promocion con el mismo codigo.";
- }
- else{
- $ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
- if ( $ok ) {
- $archivo = $_FILES['archivo'];
- $nombre = $_FILES['archivo']['name'];
- //1.a) Valida el nombre del archivo
- $ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
-
- // 1.b) Sanitiza el nombre del archivo
- //$ok = $this->sanitize_file_uploaded_name($nombre);
- //
-
- // 1.c) Utilizar un id de la base de datos como nombre de archivo
-
- // 2. comprueba si la extensión está permitida
- $ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
-
- // 3. comprueba el tipo mime del archivo correspode a una imagen image
- $finfo = new \finfo(FILEINFO_MIME_TYPE);
- $mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
- $ok = preg_match('/image\/*./', $mimeType);
- //finfo_close($finfo);
-
- if ( $ok ) {
- $tmp_name = $_FILES['archivo']['tmp_name'];
- $nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
- if ( !move_uploaded_file($tmp_name, "../img/promos/{$nombreBd}") ) {
- $result['img'] = 'Error al mover el archivo';
- }
-
- //if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
- // $result['img'] = 'Error al mover el archivo';
- //}
- //$nombreBd = str_replace("_", " ", $nombre);
- $bd->createPromotion(null, $tittle,$description,$code,$boolean, $nombreBd);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha añadido la promocion correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mp';
-
- }else {
- $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
- }
- }
- else {
- $result['img'] = 'Error al subir el archivo.';
- }
-
- }
- $exist->free();
- }
- return $result;
- }
-
- private function check_file_uploaded_name ($filename) {
- return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
- }
- private function check_file_uploaded_length ($filename) {
- return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formDeleteCinema.php b/panel_admin/includes/formDeleteCinema.php
deleted file mode 100644
index b046694..0000000
--- a/panel_admin/includes/formDeleteCinema.php
+++ /dev/null
@@ -1,76 +0,0 @@
-"./?state=mc");
- parent::__construct('formAddCinema',$op);
- }
-
- protected function generaCamposFormulario($datos,$errores=array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
-
- $html .= '
- '.$htmlErroresGlobales.'
- ¿Estás seguro de que quieres eliminar este cine?
- '.$errorId.'
- Name: '.$_POST['name'].'
- Dirección: '.$_POST['direction'].'
- Teléfono: '.$_POST['phone'].'
-
-
-
-
-
';
- }
- return $html;
- }
-
- //Process form:
- public function procesaFormulario($datos) {
- $result =array();
-
- $id = $this->test_input($datos['id'])??null;
-
- if(is_null($id)){
- $result['id']= "El nombre no es válido";
- }
-
- if(count($result)===0){
- $bd = new Cinema_DAO('complucine');
- $exist = $bd -> existCinema($id);
- if(mysqli_num_rows($exist)==1){
- $bd->deleteCinema($id);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha eliminado el cine correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mc';
- }
- $exist->free();
- }
- else{
- $result[] = "El cine seleccionado no existe.";
- }
- return $result;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formDeleteFilm.php b/panel_admin/includes/formDeleteFilm.php
deleted file mode 100644
index f56d363..0000000
--- a/panel_admin/includes/formDeleteFilm.php
+++ /dev/null
@@ -1,88 +0,0 @@
- "./?state=mf");
-
- parent::__construct('formDeleteFilm', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- //$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- //$errorDuration = self::createMensajeError($errores, 'duration', 'span', array('class' => 'error'));
- //$errorLanguage = self::createMensajeError($errores, 'language', 'span', array('class' => 'error'));
- //$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- //$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
-
- $html .= '
-
'.$htmlErroresGlobales.'
- ¿Estás seguro de que quieres eliminar esta pelicula?
- '.$errorId.'
- Id: '.$_POST['id'].'
- Título: '.$_POST['tittle'].'
- Duración: '.$_POST['duration'].'
- Idioma: '.$_POST['language'].'
- Descripción: '.$_POST['description'].'
-
-
-
-
-
-
';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
- $id = $this->test_input($datos['id']) ?? null;
- if ( is_null($id)) {
- $result['id'] = "La pelicula seleccionada no existe.";
- }
-
- if (count($result) === 0) {
- $bd = new Film_DAO("complucine");
- $exist = $bd-> existFilm($id);
- if( mysqli_num_rows($exist) == 1){
- $bd->deleteFilm($id);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha eliminado la pelicula correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mf';
- }
- else{
- $result[] = "La pelicula seleccionada no existe.";
- }
-
- $exist->free();
- }
- return $result;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formDeleteManager.php b/panel_admin/includes/formDeleteManager.php
deleted file mode 100644
index 39c8621..0000000
--- a/panel_admin/includes/formDeleteManager.php
+++ /dev/null
@@ -1,83 +0,0 @@
- "./?state=mg");
- parent::__construct('formDeleteManager', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- //$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
-
- $html .= '
-
ELIMINAR GERENTE
-
'.$htmlErroresGlobales.'
- ¿Estás seguro de que quieres eliminar este gerente? '.$errorId.'
-
- Id: '.$_POST['id'].'
- IdCinema: '.$_POST['idcinema'].'
- Nombre: '.$_POST['username'].'
- Email: '.$_POST['email'].'
- Rol: '.$_POST['rol'].'
-
-
-
-
-
-
';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($datos['id']) ?? null;
- if (is_null($id) ) {
- $result['id'] = "ERROR. No existe un manager con ese ID";
- }
-
- if (count($result) === 0) {
- $bd = new Manager_DAO('complucine');
- $exist = $bd-> GetManager($id);
- if( mysqli_num_rows($exist) == 1){
- $bd->deleteManager($id);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha eliminado el gerente correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
";
- //$result = './?state=mg';
- }
- else{
- $result[] = "ERROR. No existe un manager con ese ID";
- }
-
-
- }
- return $result;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formDeletePromotion.php b/panel_admin/includes/formDeletePromotion.php
deleted file mode 100644
index d3438fd..0000000
--- a/panel_admin/includes/formDeletePromotion.php
+++ /dev/null
@@ -1,90 +0,0 @@
- "./?state=mp");
- parent::__construct('formEditPromotion', $op);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- //$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- //$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- //$errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
- //$errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
- //$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
-
- $html .= '
-
ELIMINAR PROMOCIÓN
-
'.$htmlErroresGlobales.'
- ¿Estás seguro de que quieres eliminar esta promocion?
- '.$errorId.'
- Id: '.$_POST['id'].'
- Nombre: '.$_POST['tittle'].'
- Description:'.$_POST['description'].'
- Codigo: '.$_POST['code'].'
- Activa: '.$_POST['active'].'
-
-
-
-
-
-
-
';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($_POST['id']) ?? null;
- if ( is_null($id)) {
- $result['id'] = "La promoción seleccionada no existe.";
- }
-
- if (count($result) === 0) {
- $bd = new Promotion_DAO("complucine");
-
-
- $exist = $bd-> promotionData($id);
- if(mysqli_num_rows($exist) == 1){
- $bd->deletePromotion($id);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha eliminado la promocion correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mp';
- }
- else{
-
- $result[] = "La promocion seleccionada no existe.";
- }
- $exist->free();
- }
- return $result;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formEditCinema.php b/panel_admin/includes/formEditCinema.php
deleted file mode 100644
index 2d17339..0000000
--- a/panel_admin/includes/formEditCinema.php
+++ /dev/null
@@ -1,101 +0,0 @@
-"./?state=mc");
- parent::__construct('formAddCinema',$op);
- }
-
- protected function generaCamposFormulario($datos,$errores=array()){
- $html ="";
- if(!isset($_SESSION['message'])) {
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId= self::createMensajeError($errores,'id','span',array('class'=>'error'));
- $errorName = self::createMensajeError($errores,'name','span',array('class'=>'error'));
- $errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
- $errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
-
- $html .= '
-
- ';
- }
-
- return $html;
- }
-
- //Process form:
- public function procesaFormulario($datos) {
- $result =array();
-
-
- $id = $this->test_input($datos['id']) ?? null;
- // if (is_null($id)) {
- // $result['id'] = "El cine seleccionado no existe.";
- //}
-
- $name = $this->test_input($datos['name'])??null;
-
- if(empty($name)){
- $result['name']= "El nombre no es válido";
- }
-
- $direction = $this->test_input($datos['direction']) ?? null;
-
- if(empty($direction)){
- $result['direction'] = "La dirección no es valida";
- }
-
- $phone = $this -> test_input($datos['phone']) ?? null;
-
- if(empty($phone)){
- $result['phone'] = "El teléfono no es valido";
- }
-
- if(count($result)===0){
- $bd = new Cinema_DAO('complucine');
- $exist = $bd -> existCinema($id);
- if(mysqli_num_rows($exist)==1){
- $bd->editCinema($id,$name,$direction,$phone);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha editado el cine correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mc';
- }
- else{
- $result[] = "El cine seleccionado no existe.";
- }
- $exist->free();
- }
- return $result;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formEditFilm.php b/panel_admin/includes/formEditFilm.php
deleted file mode 100644
index 42acc29..0000000
--- a/panel_admin/includes/formEditFilm.php
+++ /dev/null
@@ -1,180 +0,0 @@
- "./?state=mf", 'enctype' => 'multipart/form-data');
- parent::__construct('formEditFilm', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- $errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- $errorDuration = self::createMensajeError($errores, 'duration', 'span', array('class' => 'error'));
- $errorLanguage = self::createMensajeError($errores, 'language', 'span', array('class' => 'error'));
- $errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- $errorImage = self::createMensajeError($errores, 'img', 'span', array('class' => 'error'));
-
- $html .= '
-
-
-
-
- ';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($datos['id']) ?? null;
- if (is_null($id)) {
- $result[] = "La pelicula seleccionada no existe.";
- }
-
- $t = $this->test_input($datos['tittle']) ?? null;
- $tittle = strtolower(str_replace(" ", "_", $t));
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle)
- if ( empty($tittle) ) {
- $result['tittle'] = "El título no es válido";
- }
-
- $duration = $this->test_input($datos['duration']) ?? null;
- //||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration)
- if ( empty($duration) || $duration <0) {
- $result['duration'] = "La duración no es válida";
- }
-
- $language = $this->test_input($datos['language']) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $language)
- if ( empty($language) ) {
- $result['language'] = "El idioma no es válido";
- }
-
- $description = $this->test_input($datos['description']) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
- if ( empty($language)) {
- $result['language'] = "La descripcion no es válida";
- }
-
-
-
- if (count($result) === 0) {
- $bd = new Film_DAO("complucine");
- $exist = $bd-> existFilm($id);
- if( mysqli_num_rows($exist) == 1){
- $ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
- if ( $ok ) {
- $archivo = $_FILES['archivo'];
- $nombre = $_FILES['archivo']['name'];
- //1.a) Valida el nombre del archivo
- $ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
-
- // 1.b) Sanitiza el nombre del archivo
- //$ok = $this->sanitize_file_uploaded_name($nombre);
- //
-
- // 1.c) Utilizar un id de la base de datos como nombre de archivo
-
- // 2. comprueba si la extensión está permitida
- $ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
-
- // 3. comprueba el tipo mime del archivo correspode a una imagen image
- $finfo = new \finfo(FILEINFO_MIME_TYPE);
- $mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
- $ok = preg_match('/image\/*./', $mimeType);
- //finfo_close($finfo);
-
- if ( $ok ) {
- $tmp_name = $_FILES['archivo']['tmp_name'];
- $nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
- if ( !move_uploaded_file($tmp_name, "../img/films/{$nombreBd}") ) {
- $result['img'] = 'Error al mover el archivo';
- }
-
- //if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
- // $result['img'] = 'Error al mover el archivo';
- //}
- //$nombreBd = str_replace("_", " ", $nombre);
- $bd->editFilm($id, $tittle, $duration, $language, $description, $nombreBd);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha editado la pelicula correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mf';
-
- }else {
- $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
- }
- } else {
- $bd->editFilmNoImg($id, $tittle, $duration, $language, $description);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha editado la pelicula correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mf';
- }
-
- }
- else{
- $result[] = "La pelicula seleccionada no existe.";
- }
- $exist->free();
- }
- return $result;
- }
-
- private function check_file_uploaded_name ($filename) {
- return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
- }
- private function check_file_uploaded_length ($filename) {
- return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formEditManager.php b/panel_admin/includes/formEditManager.php
deleted file mode 100644
index 0ce7477..0000000
--- a/panel_admin/includes/formEditManager.php
+++ /dev/null
@@ -1,113 +0,0 @@
- "./?state=mg");
- parent::__construct('formEditManager', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
-
- $html ="";
- if (!isset($_SESSION['message'])) {
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- $errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
-
- $html .= '
- EDITAR GERENTE ID:'.$_POST['id'].'
- '.$htmlErroresGlobales.'
- Selecciona cine. '.$errorIdCinema.'
- '.$errorId.' '
- .$this->showCinemas().
- '
-
-
-
-
- ';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($datos['id']) ?? null;
- if (is_null($id) ) {
- $result['id'] = "ERROR. No existe un usuario con ese ID";
- }
-
- $idcinema = $this->test_input($datos['idcinema']) ?? null;
- //||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration)
- if (is_null($idcinema)) {
- $result['idcinema'] = "ERROR. No existe un cine con ese ID";
- }
-
-
- if (count($result) === 0) {
- $bd = new Manager_DAO("complucine");
- $exist = $bd-> GetManager($id);
- if( mysqli_num_rows($exist) == 1){
- $bd->editManager($id,$idcinema);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha editado el gerente correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
";
- //$result = './?state=mg';
-
- }
- else{
- $result[] = "ERROR. No existe un cine con ese ID";
- }
- $exist->free();
-
-
- }
- return $result;
- }
-
- private function showCinemas() {
- $cine = new Cinema_DAO("complucine");
- $cinemas = $cine->allCinemaData();
- $ids = array();
- $names = array();
- $directions = array();
- $phones = array();
-
- foreach($cinemas as $key => $value){
- $ids[$key] = $value->getId();
- $names[$key] = $value->getName();
- $directions[$key] = $value->getDirection();
- $phones[$key] = $value->getPhone();
- }
- $html = '';
- for($i = 0; $i < count($cinemas); $i++){
- $html.= '
-
'.$ids[$i].', '.$names[$i].'
-
- ';
- }
- return $html;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/includes/formEditPromotion.php b/panel_admin/includes/formEditPromotion.php
deleted file mode 100644
index 0aefefb..0000000
--- a/panel_admin/includes/formEditPromotion.php
+++ /dev/null
@@ -1,183 +0,0 @@
- "./?state=mp", 'enctype' => 'multipart/form-data');
- parent::__construct('formEditPromotion', $options);
- }
-
- protected function generaCamposFormulario($datos, $errores = array()){
- $html ="";
- if (!isset($_SESSION['message'])) {
-
- // Se generan los mensajes de error si existen.
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
- $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
- $errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
- $errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
- $errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
- $errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
- $errorImg = self::createMensajeError($errores, 'img', 'span', array('class' => 'error'));
-
- $html .= '
-
';
- }
- return $html;
- }
-
- protected function procesaFormulario($datos){
- $result = array();
-
- $id = $this->test_input($_POST['id']) ?? null;
- if (is_null($id)) {
- $result['id'] = "La promoción seleccionada no existe.";
- }
-
- $t = $this->test_input($datos['tittle']) ?? null;
- $tittle = strtolower(str_replace(" ", "_", $t));
- if ( empty($tittle) ) {
- $result['tittle'] = "El título no es válido";
- }
-
- $description = $this->test_input($datos['description']) ?? null;
-
- if ( empty($description)) {
- $result['description'] = "La descripcion no es válida";
- }
-
- $code = $this->test_input($datos['code']) ?? null;
-
- if ( empty($code) ) {
- $result['code'] = "El idioma no es válido";
- }
-
- $active = strtolower($this->test_input($datos['active'])) ?? null;
- //|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
- if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
- if ( strcmp($active,"si") == 0 ) {
- $boolean = 1;
- }
- else {
- $boolean = 0;
- }
- }
- else {
- $result['active'] = "El valor activo debe ser si/no";
- }
-
- if (count($result) === 0) {
- $bd = new Promotion_DAO("complucine");
-
- $exist = $bd-> promotionData($id);
- if(mysqli_num_rows($exist) == 1){
- $ok = count($_FILES) == 1 && $_FILES['archivo']['error'] == UPLOAD_ERR_OK;
- if ( $ok ) {
- $archivo = $_FILES['archivo'];
- $nombre = $_FILES['archivo']['name'];
- //1.a) Valida el nombre del archivo
- $ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
-
- // 1.b) Sanitiza el nombre del archivo
- //$ok = $this->sanitize_file_uploaded_name($nombre);
- //
-
- // 1.c) Utilizar un id de la base de datos como nombre de archivo
-
- // 2. comprueba si la extensión está permitida
- $ok = $ok && in_array(pathinfo($nombre, PATHINFO_EXTENSION), self::EXTENSIONS);
-
- // 3. comprueba el tipo mime del archivo correspode a una imagen image
- $finfo = new \finfo(FILEINFO_MIME_TYPE);
- $mimeType = $finfo->file($_FILES['archivo']['tmp_name']);
- $ok = preg_match('/image\/*./', $mimeType);
- //finfo_close($finfo);
-
- if ( $ok ) {
- $tmp_name = $_FILES['archivo']['tmp_name'];
- $nombreBd = strtolower(str_replace(" ", "_", $tittle)).".".pathinfo($nombre, PATHINFO_EXTENSION);
- if ( !move_uploaded_file($tmp_name, "../img/promos/{$nombreBd}") ) {
- $result['img'] = 'Error al mover el archivo';
- }
-
- //if ( !copy("../img/tmp/{$nombre}", "/{$nombre}") ) {
- // $result['img'] = 'Error al mover el archivo';
- //}
- //$nombreBd = str_replace("_", " ", $nombre);
- $bd->editPromotion($id, $tittle,$description,$code,$boolean, $nombreBd);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha modificado la promocion correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mp';
-
- }else {
- $result['img'] = 'El archivo tiene un nombre o tipo no soportado';
- }
- } else {
- $bd->editPromotionNoImg($id, $tittle,$description,$code,$boolean);
- $_SESSION['message'] = "
-
-
-
-
Operacion realizada con exito
-
Se ha modificado la promocion correctamente en la base de datos.
-
Cerrar Mensaje
-
-
-
-
- ";
- //$result = './?state=mp';
- }
- }
- else{
-
- $result[] = "La promocion seleccionada no existe.";
- }
- $exist->free();
- }
- return $result;
- }
- private function check_file_uploaded_name ($filename) {
- return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
- }
- private function check_file_uploaded_length ($filename) {
- return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/panel_admin/index.php b/panel_admin/index.php
deleted file mode 100644
index 5b388e7..0000000
--- a/panel_admin/index.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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::print_managers();
- $reply.=AdminPanel::showAddBotton();
- };
- break;
- case 'un':
- $reply=AdminPanel::see_like_user();
- break;
- case 'ur':
- $reply=AdminPanel::see_like_registed_user();
- break;
- case 'ag':
- $reply=AdminPanel::see_like_manager();
- break;
- default:
- $reply=AdminPanel:: panel();
- break;
- }
- }
- else{
- $reply ='
-
-
-
No tienes permiso de administrador.
-
Inicia Sesión con una cuenta de administtación.
-
Iniciar Sesión
-
-
-
'."\n";
- }
-
- $section = '
- ';
-
- require RAIZ_APP.'/HTMLtemplate.php';
-
-?>
\ No newline at end of file
diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php
deleted file mode 100644
index 4caea37..0000000
--- a/panel_admin/panelAdmin.php
+++ /dev/null
@@ -1,500 +0,0 @@
-template;
- }
-
- static function panel(){
- include_once('../assets/php/includes/user.php');
-
- $name = strtoupper(unserialize($_SESSION['user'])->getName());
- $email = unserialize($_SESSION['user'])->getEmail();
- $userPic = USER_PICS.strtolower($name).".jpg";
-
- return $reply= '
-
Bienvenido al Panel de Administrador.
-
-
-
'.strftime("%A %e de %B de %Y | %H:%M").'
-
Administrador: '.$name.'
-
Email empresarial: '.$email.'
-
'."\n";
- }
-
- //Functions FILMS
- static function addFilm(){
- include_once('./includes/formAddFilm.php');
- $formAF = new formAddFilm();
- $htmlAForm = $formAF->gestiona();
- return $reply= '
-
-
- '.$htmlAForm."\n";
- }
-
- static function deleteFilm() {
- include_once('./includes/formDeleteFilm.php');
- $formDF = new formDeleteFilm();
- $htmlDForm = $formDF->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
'."\n";
- }
-
- static function editFilm() {
- include_once('./includes/formEditFilm.php');
- $formEF = new formEditFilm();
- $htmlDForm = $formEF->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
'."\n";
- }
-
- //Functions Cinemas
- static function addCinema(){
- include_once('./includes/formAddCinema.php');
- $formAC = new formAddCinema();
- $htmlAForm = $formAC->gestiona();
- return $reply= '
-
-
- '.$htmlAForm.'
-
'."\n";
- }
-
- static function deleteCinema() {
- include_once('./includes/formDeleteCinema.php');
- $formDC = new formDeleteCinema();
- $htmlDForm = $formDC->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
'."\n";
- }
-
- static function editCinema() {
- include_once('./includes/formEditCinema.php');
- $formEC = new formEditCinema();
- $htmlDForm = $formEC->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
'."\n";
- }
-
- static function showHalls($idCinema) {
- include_once('../assets/php/includes/hall.php');
- include_once('../assets/php/includes/hall_dao.php');
- $panel = '
-
';
- $listhall = Hall::getListHalls($idCinema);
- if(!$listhall){
- $panel .= "
No hay ninguna sala en este cine";
- }else{
- $panel .= '
-
-
- Sala
- Asientos
- Sesión
- ';
- $parity = "odd";
- foreach($listhall as $hall){
- $panel .='
-
'. $hall->getNumber().'
-
'.$hall->getTotalSeats().'
-
-
- Sesiones
-
-
- ';
- $parity = ($parity == "odd") ? "even" : "odd";
- }
- $panel.='
- ';
- }
- $panel.='
-
-
';
- return $panel;
-
- }
-
- static function showSessions($idCinema){
- include_once('../assets/php/includes/hall.php');
- include_once('../assets/php/includes/hall_dao.php');
- include_once('../assets/php/includes/session_dao.php');
- include_once('../assets/php/includes/session.php');
- //Base filtering values
- $date = $_POST['date'] ?? $_GET['date'] ?? date("Y-m-d");
- $hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
-
- //Session filter
- $panel='
-
-
- ';
- //Session list
- $panel .=' ';
- $sessions = Session::getListSessions($hall,$idCinema,$date);
-
- if($sessions) {
- $panel .='
-
';
- } else {
- $panel.='
No hay ninguna sesion ';
- }
- $panel.='
';
-
- return $panel;
- }
-
-
- //Functions MANAGERS
- static function print_managers(){
- include_once('../assets/php/includes/manager_dao.php');
- include_once('../assets/php/includes/manager.php');
- $manager = new Manager_DAO("complucine");
- $managers = $manager->allManagersData();
- $ids = array();
- $idscinemas = array();
- $usernames = array();
- $email = array();
- $rol = array();
- if(!is_array($managers)){
- $reply = " No hay ningun manager ";
- }
- else{
- 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();
- }
-
- $reply= "
-
- Id
- IdCinema
- Nombre
- Email
- Rol
- Editar
- Eliminar
- ";
- $parity = "odd";
- for($i = 0; $i < count($managers); $i++){
- $reply.= '
-
-
'. $ids[$i] .'
- '. $idscinemas[$i] .'
- '. $usernames[$i] .'
- '. $email[$i] .'
- '. $rol[$i] .'
-
-
-
-
-
-
-
- ';
- $parity = ($parity == "odd") ? "even" : "odd";
- }
-
- $reply.='
-
- ';
- }
- return $reply;
- }
- static function showAddBotton() {
- return $reply = '
-
-
-
- ';
- }
- static function addManager(){
- include_once('./includes/formAddManager.php');
- $formAM = new formAddManager();
- $htmlAForm = $formAM->gestiona();
- return $reply= '
-
-
- '.$htmlAForm.'
-
-
'."\n";
- }
- static function editManager(){
- include_once('./includes/formEditManager.php');
- $formEM = new formEditManager();
- $htmlEForm = $formEM->gestiona();
- return $reply= '
-
-
- '.$htmlEForm.'
-
';
- }
-
- static function deleteManager(){
- include_once('./includes/formDeleteManager.php');
- $formDM = new formDeleteManager();
- $htmlDForm = $formDM->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
-
'."\n";
- }
-
-
- //Functions PROMOTIONS
- static function addPromotion(){
- include_once('./includes/formAddPromotion.php');
- $formAP = new formAddPromotion();
- $htmlAForm = $formAP->gestiona();
- return $reply= '
-
-
- '.$htmlAForm.'
-
';
- }
-
- static function editPromotion(){
- include_once('./includes/formEditPromotion.php');
- $formEP = new formEditPromotion();
- $htmlEForm = $formEP->gestiona();
- return $reply= '
-
-
- '.$htmlEForm.'
-
-
'."\n";
- }
-
- static function deletePromotion(){
- include_once('./includes/formDeletePromotion.php');
- $formDP = new formDeletePromotion();
- $htmlDForm = $formDP->gestiona();
- return $reply= '
-
-
- '.$htmlDForm.'
-
'."\n";
- }
-
- static 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)){
- $reply = "
No hay promociones ";
- }
- else{
- foreach($promos as $key => $value){
- $ids[$key] = $value->getId();
- $tittles[$key] = $value->getTittle();
- $descriptions[$key] = $value->getDescription();
- $codes[$key] = $value->getCode();
- if ($value->getActive() == 0) {
- $actives[$key] = "no";
- }
- else{
- $actives[$key] = "si";
- }
- }
-
- $reply= "
-
- Id
- Título
- Descripcion
- Código
- Activo
- Editar
- Eliminar
- ";
- $parity ="odd";
- for($i = 0; $i < count($promos); $i++){
- $reply.= '
-
-
'. $ids[$i] .'
- '. $tittles[$i] .'
- '. $descriptions[$i] .'
- '. $codes[$i] .'
- '. $actives[$i] .'
-
-
-
-
-
-
-
-
- ';
- $parity = ($parity=="odd")? "even":"odd";
- }
-
- $reply.='
-
-
- ';
- }
- return $reply ;
- }
-
- static function see_like_user(){
- $_SESSION["lastRol"] = $_SESSION["rol"];
- //unset($_SESSION["rol"]);
- $_SESSION["rol"] = null;
- //header("Location: {$_SERVER['PHP_SELF']}");
- return $reply = "
-
-
-
-
¡ATENCIÓN!
-
Está viendo la web como un Usuario NO Registrado.
-
Cerrar Mensaje
-
-
-
-
- ";
- }
- static function see_like_registed_user(){
- $_SESSION["lastRol"] = $_SESSION["rol"];
- $_SESSION["rol"] = "user";
- //header("Location: {$_SERVER['PHP_SELF']}");
- return $reply = "
-
-
-
-
¡ATENCIÓN!
-
Está viendo la web como un Usuario Registrado.
-
Cerrar Mensaje
-
-
-
-
- ";
- }
- static function see_like_manager(){
- $_SESSION["lastRol"] = $_SESSION["rol"];
- $_SESSION["rol"] = "manager";
- //header("Location: {$_SERVER['PHP_SELF']}");
- return $reply = "
- ";
- }
- }
-
-?>
-
-
-