From 985f353216964719f607bc225331c369c1c2d4cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mu=C3=B1oz=20Garcia?=
<73303506+danimu03@users.noreply.github.com>
Date: Wed, 5 May 2021 11:57:13 +0200
Subject: [PATCH] new functionality
---
panel_admin/manage_promotions.php | 192 ++++++++++++++++++++++++++++++
panel_admin/panelAdmin.php | 26 +++-
2 files changed, 217 insertions(+), 1 deletion(-)
create mode 100644 panel_admin/manage_promotions.php
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 "
+
+
+
+
+
+ Id |
+ Título |
+ Descripcion |
+ Código |
+ Activo |
+
+
+
+ ";
+ for($i = 0; $i < count($promos); $i++){
+ echo '
+ '. $ids[$i] .' |
+ '. $tittles[$i] .' |
+ '. $descriptions[$i] .' |
+ '. $codes[$i] .' |
+ '. $actives[$i] .' |
+
+
+ |
+
+
+ |
+
+ ';
+ }
+ echo'
+
+
+
+ ';
+
+ }
+
+ function addPromotion(){
+ echo'
+
+
+
+ ';
+ }
+ function deletePromotion() {
+ echo'
+
+
+ ';
+ }
+ function editPromotion() {
+ echo'
+
+
+ ';
+ }
+
+ // 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;