diff --git a/panel_admin/includes/formAddCinema.php b/panel_admin/includes/formAddCinema.php index 8bc4ab9..5d9887c 100644 --- a/panel_admin/includes/formAddCinema.php +++ b/panel_admin/includes/formAddCinema.php @@ -27,7 +27,7 @@ class formAddCinema extends Form{
'.$errrorPhone.'
- +
'; diff --git a/panel_admin/includes/formAddFilm.php b/panel_admin/includes/formAddFilm.php index 7027f20..d38cf65 100644 --- a/panel_admin/includes/formAddFilm.php +++ b/panel_admin/includes/formAddFilm.php @@ -35,7 +35,7 @@ class formAddFilm extends Form{
Imagen promocional:
- +
diff --git a/panel_admin/includes/formAddPromotion.php b/panel_admin/includes/formAddPromotion.php index 5dbb28c..d3167c9 100644 --- a/panel_admin/includes/formAddPromotion.php +++ b/panel_admin/includes/formAddPromotion.php @@ -35,7 +35,7 @@ class formAddPromotion extends Form{
Imagen promocional:
- +
diff --git a/panel_admin/includes/formDeleteCinema.php b/panel_admin/includes/formDeleteCinema.php index 5454c42..bd9d347 100644 --- a/panel_admin/includes/formDeleteCinema.php +++ b/panel_admin/includes/formDeleteCinema.php @@ -8,19 +8,19 @@ include_once('../assets/php/form.php'); class formDeleteCinema extends Form{ public function __construct(){ - $op = array("action"=>"./?state=mc">); + $op = array("action"=>"./?state=mc"); parent::__construct('formAddCinema',$op); } protected function generaCamposFormulario($datos,$errores=array()){ $htmlErroresGlobales = self::generaListaErroresGlobales($errores); - + $errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error')); $html = '
'.$htmlErroresGlobales.' ¿Estás seguro de que quieres eliminar este cine? - +

Name: '.$_POST['name'].'

Dirección: '.$_POST['direction'].'

Teléfono: '.$_POST['phone'].'

@@ -39,15 +39,15 @@ class formDeleteCinema extends Form{ $id = $this->test_input($datos['id'])??null; - if(empty($id)){ - $result['name']= "El nombre no es válido"; + if(is_null($id)){ + $result['id']= "El nombre no es válido"; } if(count($result)===0){ $bd = new Cinema_DAO('complucine'); $exist = $bd -> cinemaData($id); if(mysqli_num_rows($exist)==1){ - $bd->deleteFilm($id); + $bd->deleteCinema($id); $_SESSION['message'] = "
@@ -62,7 +62,7 @@ class formDeleteCinema extends Form{ "; $result = './?state=mc'; } - $exist->free() + $exist->free(); } else{ $result[] = "El cine seleccionado no existe."; diff --git a/panel_admin/includes/formDeleteFilm.php b/panel_admin/includes/formDeleteFilm.php index 58295d7..3d66b94 100644 --- a/panel_admin/includes/formDeleteFilm.php +++ b/panel_admin/includes/formDeleteFilm.php @@ -47,8 +47,8 @@ class formDeleteFilm extends Form{ protected function procesaFormulario($datos){ $result = array(); - $id = $this->test_input($_POST['id']) ?? null; - if ( empty($id)) { + $id = $this->test_input($datos['id']) ?? null; + if ( is_null($id)) { $result['id'] = "La pelicula seleccionada no existe."; } diff --git a/panel_admin/includes/formDeleteManager.php b/panel_admin/includes/formDeleteManager.php index 141150a..289cce3 100644 --- a/panel_admin/includes/formDeleteManager.php +++ b/panel_admin/includes/formDeleteManager.php @@ -23,7 +23,7 @@ class formDeleteManager extends Form{ //$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error')); $html = '
-
'.$htmlErroresGlobales.'
+
'.$htmlErroresGlobales.'
¿Estás seguro de que quieres eliminar este gerente?

Id: '.$_POST['id'].'

diff --git a/panel_admin/includes/formDeletePromotion.php b/panel_admin/includes/formDeletePromotion.php index 071954d..9cbebe7 100644 --- a/panel_admin/includes/formDeletePromotion.php +++ b/panel_admin/includes/formDeletePromotion.php @@ -19,6 +19,7 @@ class formDeletePromotion extends Form{ // 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')); @@ -26,14 +27,14 @@ class formDeletePromotion extends Form{ //$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error')); $html = '
-
+
'.$htmlErroresGlobales.'
¿Estás seguro de que quieres eliminar esta promocion?

Id: '.$_POST['id'].'

-

Nombre: '.$_POST['tittle']'

-

Description:'.$_POST['description']'

-

Codigo: '.$_POST['code']'

-

Activa: '.$_POST['active']'

+

Nombre: '.$_POST['tittle'].'

+

Description:'.$_POST['description'].'

+

Codigo: '.$_POST['code'].'

+

Activa: '.$_POST['active'].'

Imagen promocional:
@@ -51,7 +52,7 @@ class formDeletePromotion extends Form{ $id = $this->test_input($_POST['id']) ?? null; if ( is_null($id)) { - $result[] = "La promoción seleccionada no existe."; + $result['id'] = "La promoción seleccionada no existe."; } if (count($result) === 0) { diff --git a/panel_admin/includes/formEditCinema.php b/panel_admin/includes/formEditCinema.php index f85241a..5c8a9c3 100644 --- a/panel_admin/includes/formEditCinema.php +++ b/panel_admin/includes/formEditCinema.php @@ -8,31 +8,28 @@ include_once('../assets/php/form.php'); class formEditCinema extends Form{ public function __construct(){ - $op = array("action"=>"./?state=mc">); + $op = array("action"=>"./?state=mc"); parent::__construct('formAddCinema',$op); } protected function generaCamposFormulario($datos,$errores=array()){ $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 = '
-
- Editar cines cine -
-
-
+ $html = '
+
'.$htmlErroresGlobales.'
Datos de cine - +
'.$errorName.'
'.$errorDirection.'
'.$errrorPhone.'
- +
@@ -46,10 +43,10 @@ class formEditCinema extends Form{ $result =array(); - $id = $this->test_input($_POST['id']) ?? null; - if ( empty($id)) { - $result[] = "El cine seleccionado no existe."; - } + $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; @@ -57,7 +54,7 @@ class formEditCinema extends Form{ $result['name']= "El nombre no es válido"; } - $direction = $this -> test_input($datos['direction']) ?? null; + $direction = $this->test_input($datos['direction']) ?? null; if(empty($direction)){ $result['direction'] = "La dirección no es valida"; @@ -70,11 +67,9 @@ class formEditCinema extends Form{ } if(count($result)===0){ - $bd = new Cinema_DAO('complucine'); - $exist = $bd -> GetCinema($name,$direction); + $exist = $bd -> cinemaData($id); if(mysqli_num_rows($exist)==1){ - $bd->editCinema($id,$name,$direction,$phone); $_SESSION['message'] = "
diff --git a/panel_admin/includes/formEditFilm.php b/panel_admin/includes/formEditFilm.php index 02ceb0e..47b5147 100644 --- a/panel_admin/includes/formEditFilm.php +++ b/panel_admin/includes/formEditFilm.php @@ -54,8 +54,8 @@ class formEditFilm extends Form{ protected function procesaFormulario($datos){ $result = array(); - $id = $this->test_input($_POST['id']) ?? null; - if ( empty($id)) { + $id = $this->test_input($datos['id']) ?? null; + if (is_null($id)) { $result[] = "La pelicula seleccionada no existe."; } diff --git a/panel_admin/includes/formEditPromotion.php b/panel_admin/includes/formEditPromotion.php index f6d618d..4c0f498 100644 --- a/panel_admin/includes/formEditPromotion.php +++ b/panel_admin/includes/formEditPromotion.php @@ -19,6 +19,7 @@ class formEditPromotion extends Form{ // 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')); @@ -50,8 +51,8 @@ class formEditPromotion extends Form{ $result = array(); $id = $this->test_input($_POST['id']) ?? null; - if ( is_null($id)) { - $result[] = "La promoción seleccionada no existe."; + if (is_null($id)) { + $result['id'] = "La promoción seleccionada no existe."; } $tittle = $this->test_input($datos['tittle']) ?? null; diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php index 2f2e8c9..2f7f041 100644 --- a/panel_admin/panelAdmin.php +++ b/panel_admin/panelAdmin.php @@ -12,20 +12,16 @@ 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(); - echo ($template->print_cinemas()); - } - else { - $this-> addCinema(); - echo ($template->print_cinemas()); - - }; + $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(); @@ -33,10 +29,6 @@ else if(isset($_POST['delete_film'])) { $this->deleteFilm(); } - else if(isset($_POST['add_film'])) { - $this->addFilm(); - echo ( $template->print_fimls()); - } else { $this->addFilm(); echo( $template->print_fimls()); @@ -49,9 +41,6 @@ else if(isset($_POST['delete_promotion'])) { $this->deletePromotion(); } - else if(isset($_POST['add_promotion'])) { - $this->addPromotion(); - } else { $this->addPromotion(); $this->print_promotions(); @@ -145,8 +134,8 @@ } function editCinema() { - include_once('./includes/formEditFilm.php'); - $formEF = new formEditCinema(); + include_once('./includes/formEditCinema.php'); + $formEC = new formEditCinema(); $htmlDForm = $formEC->gestiona(); echo '
@@ -186,7 +175,6 @@ IdCinema Nombre Email - password Rol @@ -274,6 +262,8 @@
'."\n"; } + + //Functions PROMOTIONS function addPromotion(){ include_once('./includes/formAddPromotion.php'); $formAP = new formAddPromotion();