From f5ede5cb155b13b9145feeae898f0f65f02587de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Sat, 29 May 2021 17:06:35 +0200 Subject: [PATCH] Add files via upload --- assets/js/promotions.js | 14 +++++--------- assets/php/includes/promotion_dao.php | 2 +- index.php | 13 ++++++++++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/assets/js/promotions.js b/assets/js/promotions.js index 8176c85..5a182fd 100644 --- a/assets/js/promotions.js +++ b/assets/js/promotions.js @@ -3,16 +3,12 @@ * CompluCine - FDI-cines */ -/* TO-DO: enviar el contenido del array de promociones */ window.onload = function () { + //Promociones: var promos = document.getElementById("promotions").value; - console.log(promos); - // Promociones (Cambiar por el contenido del array "promotions") - const IMAGENES = [ - '../img/promos/promo_vuelve.jpg', - '../img/promos/promo_palomitas.jpg', - '../img/promos/promo_miercoles.jpg' - ]; + const prefix = "../img/promos/"; + const IMAGENES = JSON.parse(promos); + const TIEMPO_INTERVALO_MILESIMAS_SEG = 3500; let posicionActual = 0; let $botonRetroceder = document.querySelector('#retroceder'); @@ -52,7 +48,7 @@ window.onload = function () { * Funcion que actualiza la imagen de imagen dependiendo de posicionActual */ function renderizarImagen () { - $imagen.style.backgroundImage = `url(${IMAGENES[posicionActual]})`; + $imagen.style.backgroundImage = `url(${prefix+IMAGENES[posicionActual]})`; } /** diff --git a/assets/php/includes/promotion_dao.php b/assets/php/includes/promotion_dao.php index 73605d2..81bba8c 100644 --- a/assets/php/includes/promotion_dao.php +++ b/assets/php/includes/promotion_dao.php @@ -27,7 +27,7 @@ $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); while($fila=$resul->fetch_assoc()){ - $promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"], null); + $promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"], $fila["img"],); } $resul->free(); return $promotions; diff --git a/index.php b/index.php index a34b1d4..971a454 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,14 @@ //General Config File: require_once(__DIR__.'/assets/php/config.php'); - $promotions = "HOLA MUNDO"; + //Promotions: + include_once(__DIR__.'/assets/php/includes/promotion_dao.php'); + + $promotionsDAO = new Promotion_DAO("complucine"); + $promotions = $promotionsDAO->allPromotionData(); + foreach($promotions as $key=>$value){ + $promotions_img[$key] = $value->getImg(); + } //Page-specific content: $section = ' @@ -27,8 +34,8 @@ - - '; + '; + $section.=""; //General page content: require RAIZ_APP.'/HTMLtemplate.php';