From 6f9be19aa1d749a76055ab6571bce9e5b4e7b0db Mon Sep 17 00:00:00 2001 From: Julie Choquet <julie.choquet@ensiie.fr> Date: Sun, 8 May 2016 17:50:41 +0200 Subject: [PATCH] mes wins + click photo done --- Timeline/carousel.php | 88 +++++++++------------- Timeline/css/mes_posts.css | 38 ++++------ Timeline/mes_identifications.php | 2 +- Timeline/mes_posts.php | 2 +- Timeline/mes_wins.php | 125 ++++++++++++++++++------------- Timeline/script_mes_wins.php | 34 --------- 6 files changed, 127 insertions(+), 162 deletions(-) delete mode 100755 Timeline/script_mes_wins.php diff --git a/Timeline/carousel.php b/Timeline/carousel.php index 223c31b..3eb1dbf 100755 --- a/Timeline/carousel.php +++ b/Timeline/carousel.php @@ -20,7 +20,7 @@ return $photos; } - /* Fonction qui va crée le texte afficher à côté de chaque photo dans le carousel */ + /* Fonction qui va crée le texte afficher à côté de chaque photo dans le carousel (utilisée pour posts, identifications) */ function panelCarousel($tab){ @@ -39,62 +39,35 @@ } } - /* Carousel de base */ + /* Fonction qui va crée le texte afficher à côté de chaque photo dans le carousel (utilisée pour wins) */ - function carousel($photos) { - - $first = 0; - - echo '<div class="container">'; - echo '<br>'; - echo '<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">'; - - /* Indicateurs : point en bas representant le nombre de slides */ - - $n = count($photos); /* Nombre de photos */ - echo '<ol class="carousel-indicators">'; - echo '<li data-target="#myCarousel" data-slide-to="0" class="active"></li>'; - for ($i = 1; $i < $n; $i++){ - echo "<li data-target='#myCarousel' data-slide-to='$i'></li>"; - } - echo '</ol>'; - - /* Wrapper pour les slides */ - echo '<div class="carousel-inner" role="listbox">'; - - - foreach ($photos as $pic) - { - /* On crée les slides une à une */ - if ($first == 0) - { - echo '<div class="item active">'; - } - else - { - echo '<div class="item">'; - } - echo "<img src='$pic' class='img-responsive img-rounded' style='margin:0px auto;max-height:400px;'>"; - echo "<div class='carousel-caption'><h4>Test</h4><p>Blablablabla</p></div>"; - echo '</div>'; - $first = 1; - } + function panelCarouselWins($tab){ - echo '</div>'; - - /* Fleches suivant, précédent */ - + $i=0; + foreach($tab as $a) + { + $annee=$a[0]; + $com=$a[4]; + + $nomConcours = $a[5]; + $themeSoiree = $a[7]; + $votes = $a[8]; + + echo "<div class='side-text' id='slide-content-".$i."'>"; + echo '<h3>Concours '.$nomConcours.'</h3>'; + echo '<h4>'.$annee.' - '.$themeSoiree.'</h4>'; + echo '<p>'.$com.'</p>'; + echo '<p class="sub-text">Dénoncée par '.$votes.' personnes</p>'; + echo '</div>'; + $i=$i+1; + } + } - echo'</div>'; - echo'</div>'; - - - } - /* Carousel avec texte à droite + petites images en dessous */ + /* Carousel avec texte à droite + petites images en dessous (2eme argument : 2 pour le panel carousel wins, sinon panel carousel de base )*/ - function carousel2($tabPhotos) + function carousel($tabPhotos,$version) { $photos = getPath($tabPhotos); @@ -157,7 +130,14 @@ echo '<div class="col-sm-4" id="carousel-text"></div>'; echo '<div id="slide-content" style="display: none;">'; - panelCarousel($tabPhotos); + if($version == 2) + { + panelCarouselWins($tabPhotos); + } + else + { + panelCarousel($tabPhotos); + } echo'</div>'; echo'</div>'; @@ -183,4 +163,8 @@ echo'</div>'; echo'</div>'; } + + + + ?> diff --git a/Timeline/css/mes_posts.css b/Timeline/css/mes_posts.css index 73773b8..dbdb0d0 100755 --- a/Timeline/css/mes_posts.css +++ b/Timeline/css/mes_posts.css @@ -1,12 +1,20 @@ -/* Decommenter le suivant pour carousel 1 */ -/* -.carousel-indicators { - bottom: 0; + +/***************** Mise en page pour le carousel ************************/ + +#carousel-text { + + text-align: center; + margin-left: -2%; + padding-top: 8%; } -*/ -/***************** Mise en page commune aux 2 carousels ************************/ +.border{ + /*border : solid grey 0.2px;*/ + padding: 20px; + background-color: #CFD8DC; + border-radius: 5px; +} .carousel-control.right, .carousel-control.left { @@ -19,27 +27,13 @@ margin-left: -40px; margin-top:20px; } - - -/***************** Mise en page pour le carousel 2 ************************/ - -#carousel-text { - - text-align: center; - margin-left: -2%; - padding-top: 8%; +.sub-text { + font-style: italic; } -.border{ - /*border : solid grey 0.2px;*/ - padding: 20px; - background-color: #CFD8DC; - border-radius: 5px; -} /***************** Cas où l'utilisateur n'a rien posté *****************/ .nothing { padding: 30px; } -} \ No newline at end of file diff --git a/Timeline/mes_identifications.php b/Timeline/mes_identifications.php index 4242f87..cb85e1c 100755 --- a/Timeline/mes_identifications.php +++ b/Timeline/mes_identifications.php @@ -71,7 +71,7 @@ <?php if($tabPhotos) { - carousel2($tabPhotos); + carousel($tabPhotos,1); } else { diff --git a/Timeline/mes_posts.php b/Timeline/mes_posts.php index d77f9ca..a55b98e 100755 --- a/Timeline/mes_posts.php +++ b/Timeline/mes_posts.php @@ -75,7 +75,7 @@ <?php if($tabPhotos) { - carousel2($tabPhotos); + carousel($tabPhotos,1); } else { diff --git a/Timeline/mes_wins.php b/Timeline/mes_wins.php index 99ec2eb..baf0f25 100755 --- a/Timeline/mes_wins.php +++ b/Timeline/mes_wins.php @@ -2,72 +2,93 @@ session_start(); + include 'carousel.php'; + + + function getPhotosMesWins($db) { + + $id=$_SESSION['login']; + $stmt = $db->query("SELECT soiree.annee, soiree.name, photo.idphoto, photo.extension, photo.composteur, concours.nom, soiree.idsoiree, soiree.theme, compteur.nbre_votes FROM concours + INNER JOIN soiree ON concours.idsoiree = soiree.idsoiree + INNER JOIN photo ON photo.idphoto = concours.winner + INNER JOIN compteur ON concours.idconcours = compteur.idconcours AND photo.idphoto = compteur.idphoto + WHERE photo.idposteur='$id' AND NOT encours"); + $stmt->setFetchMode(PDO::FETCH_NUM); + $result = $stmt->fetchAll(); + return $result; + } + + try{ + + $DB = new PDO("pgsql:host=localhost;dbname=projet_web", "postgres", "root"); + + $tabPhotos = getPhotosMesWins($DB); + + $DB = null; + + } + + catch(PDOException $e){ + echo "Database Error"; + } + ?> + <!DOCTYPE html > <html lang="fr"> <head> - <meta charset="utf-8"> - <title>Mes_Wins</title> + <meta charset="utf-8"/> + - <!-- icone du titre de la page --> - <link rel="shortcut icon" href="fonts/icone2.jpg"> - + <link rel="shortcut icon" href="fonts/icone.ico"> + <title>TIMELINE</title> + <!-- pour les moteurs de recherche --> <meta name="description" lang="fr" content="plateforme de timeline photo pour soirée et évènement" /> <meta name="keywords" lang="fr" content="photos, soirée, timeline, ENSIIE, iiens" /> - <!-- Latest compiled and minified CSS --> - #<link rel="stylesheet" href="css/bootstrap.css"> - <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> + <!-- Latest compiled and minified CSS --> + <link rel="stylesheet" href="css/bootstrap.css"> - <!-- jquery --> - <script src="js/jquery_library.js"></script> - <!-- Latest compiled and minified JavaScript --> - <script src="js/bootstrap.js"></script> - + <!-- jquery --> + <script src="js/jquery_library.js"></script> - </head> - - <body> - - <?php #include 'header.php'; - include 'script_mes_wins.php'; - include 'PicPopUp.php'; - ?> - + <!-- Latest compiled and minified JavaScript --> + <script src="js/bootstrap.js"></script> -#TO DELETE (TESTS) - <?php - $v1 = array( 'name' => 'trash', 'year' => '2015', 'theme'=>'BTP', 'Pic'=>'1.png', 'NbVote'=>'5'); - $v2 = array( 'name' => 'love', 'year' => '2014', 'theme'=>'A3A', 'Pic'=>'1.png', 'NbVote'=>'10'); - $v3 = array( 'name' => 'raoul', 'year' => '2016', 'theme'=>'Or', 'Pic'=>'1.png', 'NbVote'=>'3'); - $result1 = [$v1,$v2,$v3]; - ?> -#END TO DELETE + <!-- Js carousel --> + <script src="js/carousel.js"></script> + <script type="text/javascript" src="js/modal.js"></script> + <!-- fichier css perso --> + <link rel="stylesheet" href="css/menu.css"> + <link rel="stylesheet" href="css/mes_posts.css"> + <link rel="stylesheet" type="text/css" href="css/modal.css"> - <h1 class="page-header">Mes Wins</h1> - - <div class="container-fluid" style="/*overflow:scroll;*/ padding-left:100px"> - <?php - #$result = selectMesWins("dbname=projet_web_2016_h", $iduser); - foreach($result1 as $vic){ - echo "<div class='row'>"; - echo "<h2>Concours $vic[name] / $vic[year] / $vic[theme] </h2>"; - - /*Lien PicPopUp*/ - $idPopUp = "$vic[Pic]_$vic[name]"; - PicPopUp ($idPopUp,$vic[substr(Pic,0,-4)], "projet_web_2016_h"); - echo "<a data-toggle='modal' data-target='$idPopUp'>"; - echo "<img src='$vic[Pic]' alt='Echec chargement image'/>"; - echo "</a>"; - echo "</div>"; - } - - ?> - </div> +</head> + + <body> + <?php include 'header.php'; ?> + + <h3 class="page-header">Mes Wins</h3> - </body> -</html> + <?php + if($tabPhotos) + { + carousel($tabPhotos,2); + } + else + { + echo "<div class='container-fluid'>"; + echo "<p class='nothing'>Tanche ! Tu n'as encore rien gagné !<p>"; + echo '</div>'; + } + ?> + + + + <?php include 'modal.php'; ?> + + <?php include 'footer.php'; ?> \ No newline at end of file diff --git a/Timeline/script_mes_wins.php b/Timeline/script_mes_wins.php deleted file mode 100755 index faff86b..0000000 --- a/Timeline/script_mes_wins.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - - - - # Return the challenges won by a user as an array [name, year, theme, Pic] - # Pic : link to the physical location of the picture concerned by each victory ('id+extension') - # NbVote : Number of people who voted for Pic - - - - function selectMesWins($db,$IdUser){ - $stmt = $db->prepare(" - SELECT nom, annee, theme, winner, extension - FROM concours - INNER JOIN soiree ON concours.idsoiree = soiree.idsoiree - INNER JOIN photo ON photo.idphoto = concours.winner - WHERE photo.idposteur = $IdUser AND NOT encours - ; - - "); - - $stmt->execute(); - $stmt->setFetchMode(PDO::FETCH_NUM); - $result = $stmt->fetchAll(); - $info = array ( - "name" => "$result[nom]", - "year" => "$result[annee]", - "theme" => "$result[theme]", - "Pic" => "$result[winner].$result[extension]" - ); - return $info; - } - -?> \ No newline at end of file -- GitLab