Mettre à jour 'WEB/avis_laisses/avis_laisses.php'

master
PALAFFRE Raphaël 6 years ago
parent 78eac17d42
commit 65b1254997

@ -1,76 +1,81 @@
<?php <?php
session_start(); //Importation des fichiers necessaires au fonctionnement
require_once ("../connexionBD.php"); session_start();
require_once ("../ressources/user.php"); require_once ("../connexionBD.php");
require_once ("../ressources/user.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) { //Si on est pas connecté redirection vers la page de connexion
header('Location: ../index.php'); if (!isset($_SESSION['mail'])) {
exit(); header('Location: ../index.php');
} exit();
$mail = $_SESSION['mail']; }
$login = getLogin($db,$mail); //Recuperation de la variables de session
$mail = $_SESSION['mail'];
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.mailemetteur = $1 AND Avis.mailemetteur = Utilisateur.mail;";
$result = pg_query_params($db, $requete, array($mail)); $login = getLogin($db,$mail);
?>
//Création et envoie de la requete SQL
<!DOCTYPE html> $requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.mailemetteur = $1 AND Avis.mailemetteur = Utilisateur.mail;";
<html lang = "fr"> $result = pg_query_params($db, $requete, array($mail));
<head> ?>
<meta charset = "UTF-8">
<link rel = "stylesheet" href = "avis_laisses.css"> <!DOCTYPE html>
<link rel="icon" href="../ressources/favicon.ico" /> <html lang = "fr">
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
<title>Avis Laissés</title> <head>
</head> <meta charset = "UTF-8">
<link rel = "stylesheet" href = "avis_laisses.css">
<body> <link rel="icon" href="../ressources/favicon.ico" />
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
<?php require_once ("../ressources/navbarhtml.php"); ?> <title>Avis Laissés</title>
</head>
<div id = "container">
<body>
<div id ="entete">
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a> <?php require_once ("../ressources/navbarhtml.php"); ?>
<h1 id = "titre">Avis Laissés</h1>
<br> <div id = "container">
</div>
<div id ="entete"> <-- Entete de la page -->
<div id = "avis"> <a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
<table> <h1 id = "titre">Avis Laissés</h1>
<?php <br>
while ($row = pg_fetch_array($result)) { </div>
$nom = $row['login'];
$date = $row['dateavis']; <div id = "avis">
$commentaire = $row['commentaire']; <table>
$note = $row['note']; <?php
echo "<tr>"; while ($row = pg_fetch_array($result)) { //Stockage des resultats des requete SQL
echo "<td class='avis_tab'>"; $nom = $row['login'];
echo "<h3 id='nom'>$nom</h3>"; $date = $row['dateavis'];
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>"; $commentaire = $row['commentaire'];
echo "<h5 id='avis'>$commentaire</h5>"; $note = $row['note'];
echo "</td>"; echo "<tr>";
echo "<td id='note_tab'>"; echo "<td class='avis_tab'>"; //Affichage sous forme de tableau pour la mise en page
$i=0; echo "<h3 id='nom'>$nom</h3>";
while ($i<intval($note)){ echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>"; echo "<h5 id='avis'>$commentaire</h5>";
$i++; echo "</td>";
} echo "<td id='note_tab'>";
$i = $note; $i=0;
while ($i<3){ while ($i<intval($note)){ //Affichage de la note laisses
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>"; echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
$i++; $i++;
} }
echo "</td>"; $i = $note;
} while ($i<3){
?> echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
</tr> $i++;
</table> }
</div> echo "</td>";
</div> }
</body> ?>
</html> </tr>
</table>
</div>
</div>
</body>
</html>

Loading…
Cancel
Save