diff --git a/panel_admin/manage_promotions.php b/panel_admin/manage_promotions.php new file mode 100644 index 0000000..301bef7 --- /dev/null +++ b/panel_admin/manage_promotions.php @@ -0,0 +1,192 @@ +allPromotionData(); + $ids = array(); + $tittles = array(); + $descriptions = array(); + $codes = array(); + $actives = array(); + + 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 "
+
+
+ + + + + + + + + + + + "; + for($i = 0; $i < count($promos); $i++){ + echo ' + + + + + + + + + '; + } + echo' +
IdTítuloDescripcionCódigoActivo
'. $ids[$i] .''. $tittles[$i] .''. $descriptions[$i] .''. $codes[$i] .''. $actives[$i] .' +
+ + + + + + +
+
+
+ + + + + + +
+
+
+
+ '; + + } + + function addPromotion(){ + echo'
+
+

Añadir promoción

+
+
+ Datos dela Promoción +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+ '; + } + function deletePromotion() { + echo'
+
+

Editar Promoción

+
+
+
+ ¿Estás seguro de que quieres eliminar esta promoción? + +

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

+

Título: '.$_POST['tittle'].'

+

Descripción: '.$_POST['description'].'

+

Código: '.$_POST['code'].'

+

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

+
+
+ + +
+
+
+
+
+ '; + } + function editPromotion() { + echo'
+
+

Editar promoción

+
+
+
+ Datos de la promoción + +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+ '; + } + + // Logic Functions + function confirmDelete() { + $cine = new FormPromotion(); + $cine->processesForm($_POST['id'],null,null,null,null,"del"); + $_SESSION['message'] = $cine->getReply(); + header('Location: ../panel_admin/index.php?state=mp'); + } + function confirmEdit() { + $cine = new FormPromotion(); + $cine->processesForm($_POST['id'], $_POST['tittle'], $_POST['description'], $_POST['code'],$_POST['active'],"edit"); + $_SESSION['message']= $cine->getReply(); + header('Location: ../panel_admin/index.php?state=mp'); + } + function confirmAdd() { + $cine = new FormPromotion(); + $cine->processesForm(null,$_POST['tittle'], $_POST['description'], $_POST['code'],$_POST['active'],"new"); + $_SESSION['message'] = $cine->getReply(); + header('Location: ../panel_admin/index.php?state=mp'); + } + + +?> \ No newline at end of file diff --git a/panel_admin/panelAdmin.php b/panel_admin/panelAdmin.php index d1f7e94..fd9e4b3 100644 --- a/panel_admin/panelAdmin.php +++ b/panel_admin/panelAdmin.php @@ -34,6 +34,9 @@ }; break; case 'mf': require_once('manage_films.php'); + //echo $_SERVER['DOCUMENT_ROOT']."/../img"; + echo TMP_DIR; + //echo $_SERVER['PHP_SELF']; if(isset($_POST['edit_film'])) { editFilm(); } @@ -54,7 +57,28 @@ $template->print_fimls(); }; break; - case 'md': /*require_once('manage_discounts.php')*/;echo"

En construcción

"; break; + case 'mp': require_once('manage_promotions.php'); + if(isset($_POST['edit_promotion'])) { + editPromotion(); + } + else if(isset($_POST['delete_promotion'])) { + deletePromotion(); + } + else if(isset($_POST['add_promotion'])) { + confirmAdd(); + } + else if(isset($_POST['confirm_delete_promotion'])) { + confirmDelete(); + } + else if(isset($_POST['confirm_edit_promotion'])) { + confirmEdit(); + } + else { + addPromotion(); + print_promotions(); + + }; + break; case 'mm': /*require_once('manage_managers.php')*/;echo"

En construcción

"; break; case 'un': echo"

En construcción

"; break; case 'ur': echo"

En construcción

";; break;