diff --git a/Timeline/TODO.txt b/Timeline/TODO.txt index d808fda0f22cc4cf66ae5e6fde085fd9187a10c4..d8cac19d0e3b700ae3ccf2835c75dccac5e4137f 100755 --- a/Timeline/TODO.txt +++ b/Timeline/TODO.txt @@ -22,17 +22,17 @@ DONE : TO DO LATER : -- boutons j'aime, votes ect avec le bon nombre + - ajout commentaire sur click photo - faire le bouton j'aime qui marche +- acceuil +- identification de personnes rajouter un bouton et que ça marche (mettre qu'on aurait aimer elastic search ect) - - -- identification de personnes rajouter un bouton et que ça marche +- oubli de marquer qui a posté à raj ? - ajout concours admin, fin concours admin: Abandon -> probleme dans la table concours winner = identifiant photo - +LATER Base de données AJOUT DE CONTENU POUR TEST : - verifier si le script correspond OK - ajout de contenu -> mettre le script de réindexation de la base OK diff --git a/Timeline/acceuil.php b/Timeline/acceuil.php index 4cc7b7f8ed350e997484f014915cc878fe292eb2..9f666472d3ad372241eb620388da4ff72aabf5b2 100755 --- a/Timeline/acceuil.php +++ b/Timeline/acceuil.php @@ -1,8 +1,35 @@ <?php session_start(); + + include 'carousel.php'; + + + function getLastPhotos($db) { + $stmt = $db->query("SELECT soiree.annee, soiree.name, photo.idphoto, photo.extension, photo.composteur, soiree.theme, photo.date_mel, photo.heure_mel FROM photo INNER JOIN soiree ON photo.idsoiree=soiree.idsoiree ORDER BY photo.idphoto DESC LIMIT 10 "); + $stmt->setFetchMode(PDO::FETCH_NUM); + $result = $stmt->fetchAll(); + return $result; + } + + + + try{ + + $DB = new PDO("pgsql:host=localhost;dbname=projet_web", "postgres", "root"); + + $tabPhotosAcceuil = getLastPhotos($DB); + + $DB = null; + + } + + catch(PDOException $e){ + echo "Database Error"; + } ?> + <!DOCTYPE html > <html lang="fr"> <head> @@ -22,12 +49,20 @@ <!-- Latest compiled and minified JavaScript --> <script src="js/bootstrap.js"></script> + <!-- Js carousel --> + <script src="js/carousel.js"></script> + <script type="text/javascript" src="js/modal.js"></script> + <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="css/bootstrap.css"> - <!-- fichier css menu --> - <link rel="stylesheet" href="css/menu.css"> - <link rel="stylesheet" href="css/acceuil.css"> + <!-- fichier css perso --> + <link rel="stylesheet" href="css/menu.css"> + <link rel="stylesheet" href="css/mes_posts.css"> + <link rel="stylesheet" href="css/modal.css"> + <link rel="stylesheet" href="css/buttonLink.css"> + + </head> <html> @@ -35,9 +70,23 @@ <?php include 'header.php'; ?> - <h3 class="page-header"> Accueil </h3> - + <h3 class="page-header"> Les 10 dernières glorieuses contributions </h3> + <?php + if($tabPhotosAcceuil) + { + carousel($tabPhotosAcceuil,3); + } + else + { + echo "<div class='container-fluid'>"; + echo "<p class='nothing'>Tanche! Soit le premier à poster!<p>"; + echo '<div class="col-sm-3">'; + echo '<button class="btn btn-default btn-block" id="button"><a href="ajout.php">Poster une photo</a></button>'; + echo '</div>'; + echo '</div>'; + } + ?> <?php include 'footer.php'; ?> diff --git a/Timeline/carousel.php b/Timeline/carousel.php index 3eb1dbf53746b627a987cd425c705e7dbe28d464..bfb91d38853c7257221b98e9dbb0554e7cd90593 100755 --- a/Timeline/carousel.php +++ b/Timeline/carousel.php @@ -39,7 +39,7 @@ } } - /* Fonction qui va crée le texte afficher à côté de chaque photo dans le carousel (utilisée pour wins) */ + /* Fonction qui va crée le texte affiché à côté de chaque photo dans le carousel (utilisée pour wins) */ function panelCarouselWins($tab){ @@ -63,9 +63,31 @@ } } + /* Fonction qui va crée le texte affiché à côté de chaque photo dans le carousel (utilisée pour acceuil) */ + function panelCarouselAcceuil($tab){ - /* Carousel avec texte à droite + petites images en dessous (2eme argument : 2 pour le panel carousel wins, sinon panel carousel de base )*/ + $i=0; + foreach($tab as $a) + { + $annee=$a[0]; + $com=$a[4]; + + $theme=$a[5]; + $date=$a[6]; + $heure = date("H:i:s", strtotime($a[7])); + + echo "<div class='side-text' id='slide-content-".$i."'>"; + echo '<h3>'.$annee.' - '.$theme.'</h4>'; + echo '<p>'.$com.'</p>'; + echo '<p class="sub-text">Postée le '.$date.' à '.$heure.' </p>'; + echo '</div>'; + $i=$i+1; + } + } + + + /* Carousel avec texte à droite + petites images en dessous (2eme argument : 2 pour le panel carousel wins, 3 pour celui de l'acceuil, sinon panel carousel de base )*/ function carousel($tabPhotos,$version) { @@ -134,6 +156,10 @@ { panelCarouselWins($tabPhotos); } + elseif ($version == 3) + { + panelCarouselAcceuil($tabPhotos); + } else { panelCarousel($tabPhotos);