Compare commits
10 Commits
avisTrajet
...
master
Author | SHA1 | Date |
---|---|---|
Flavien Haas | c139f83edf | 5 years ago |
PALAFFRE Raphaël | 0d256c60ef | 5 years ago |
PALAFFRE Raphaël | 6e0465379e | 5 years ago |
PALAFFRE Raphaël | 77796e4df8 | 5 years ago |
PALAFFRE Raphaël | 13064316fd | 5 years ago |
PALAFFRE Raphaël | 508c84a04f | 5 years ago |
PALAFFRE Raphaël | bd4163c5fa | 5 years ago |
PALAFFRE Raphaël | 7c73030e97 | 5 years ago |
PALAFFRE Raphaël | 598feef1f7 | 5 years ago |
PALAFFRE Raphaël | 65b1254997 | 5 years ago |
@ -1,46 +1,44 @@
|
||||
/*
|
||||
Crée par PALAFFRE Raphael
|
||||
Fonction: Lister les avis laisses
|
||||
Page CSS : avis_laisses.css
|
||||
*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage avis*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
||||
|
@ -1,76 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once ("../connexionBD.php");
|
||||
require_once ("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db,$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));
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "avis_laisses.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico" />
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
|
||||
<title>Avis Laissés</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
|
||||
<div id = "container">
|
||||
|
||||
<div id ="entete">
|
||||
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
|
||||
<h1 id = "titre">Avis Laissés</h1>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id = "avis">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) {
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>";
|
||||
echo "<td class='avis_tab'>";
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
//Importation des fichiers necessaires au fonctionnement
|
||||
session_start();
|
||||
require_once ("../connexionBD.php");
|
||||
require_once ("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//Recuperation de la variables de session
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db,$mail);
|
||||
|
||||
|
||||
//Création et envoie de la requete SQL
|
||||
$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));
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "avis_laisses.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico" />
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
|
||||
<title>Avis Laissés</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
|
||||
<div id = "container">
|
||||
|
||||
<div id ="entete"> <-- Entete de la page -->
|
||||
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
|
||||
<h1 id = "titre">Avis Laissés</h1>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id = "avis">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) { //Stockage des resultats des requete SQL
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>";
|
||||
echo "<td class='avis_tab'>"; //Affichage sous forme de tableau pour la mise en page
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){ //Affichage de la note laisses
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,46 +1,44 @@
|
||||
/*
|
||||
Crée par PALAFFRE Raphael
|
||||
Fonction: Lister les avis recus
|
||||
Page CSS : avis_recu.css
|
||||
*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage avis*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
||||
|
@ -1,69 +1,76 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db, $mail);
|
||||
|
||||
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Trajet.mailproposition = Utilisateur.mail;";
|
||||
$result = pg_query_params($db, $requete, array($mail));
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="avis_recus.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Avis Recus</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
<div id="container">
|
||||
<div id="entete">
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
|
||||
src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 id="titre">Avis Recus</h1>
|
||||
<br>
|
||||
</div>
|
||||
<div id="avis">
|
||||
<table>
|
||||
<?php while ($row = pg_fetch_array($result)) {
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>";
|
||||
echo "<td class='avis_tab'>";
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
//Importation des fichiers
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//Recuperation variable session
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db, $mail);
|
||||
|
||||
//Creation et envoie de la requete SQL
|
||||
|
||||
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Trajet.mailproposition = Utilisateur.mail;";
|
||||
$result = pg_query_params($db, $requete, array($mail));
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="avis_recus.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Avis Recus</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
|
||||
<div id="container">
|
||||
<div id="entete"> <-- Entete -->
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
|
||||
src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 id="titre">Avis Recus</h1>
|
||||
<br>
|
||||
</div>
|
||||
<div id="avis"> <-- Avis recus -->
|
||||
<table>
|
||||
<?php while ($row = pg_fetch_array($result)) { //Stockage des valeurs de retour de la requete SQL
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>"; //Affichage des resultat sour forme de tableau
|
||||
echo "<td class='avis_tab'>";
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){ //Affichage des notes recus
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,55 +1,61 @@
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 15% 5% 15%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#form{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#avis_laisse{
|
||||
box-sizing: border-box;
|
||||
resize: none;
|
||||
width: 70%;
|
||||
height: 16em;
|
||||
}
|
||||
|
||||
#submit{
|
||||
margin-bottom: 1%;
|
||||
}
|
||||
|
||||
.rating {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.rating a {
|
||||
color: #aaa;
|
||||
text-decoration: none;
|
||||
font-size: 3em;
|
||||
transition: color .4s;
|
||||
}
|
||||
|
||||
.rating a:hover,
|
||||
.rating a:focus,
|
||||
.rating a:hover ~ a,
|
||||
.rating a:focus ~ a {
|
||||
color: orange;
|
||||
cursor: pointer;
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 15% 5% 15%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Formulaire*/
|
||||
|
||||
#form{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#avis_laisse{
|
||||
box-sizing: border-box;
|
||||
resize: none;
|
||||
width: 70%;
|
||||
height: 16em;
|
||||
}
|
||||
|
||||
#submit{
|
||||
margin-bottom: 1%;
|
||||
}
|
||||
|
||||
/*Etoile de notation*/
|
||||
|
||||
.rating {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.rating a {
|
||||
color: #aaa;
|
||||
text-decoration: none;
|
||||
font-size: 3em;
|
||||
transition: color .4s;
|
||||
}
|
||||
|
||||
.rating a:hover,
|
||||
.rating a:focus,
|
||||
.rating a:hover ~ a,
|
||||
.rating a:focus ~ a {
|
||||
color: orange;
|
||||
cursor: pointer;
|
||||
}
|
@ -1,86 +1,92 @@
|
||||
<?php
|
||||
|
||||
function checkAvis($db, $mail, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM avis WHERE mailEmetteur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] == 0;
|
||||
}
|
||||
|
||||
function checkCodeTrajetAvis($db, $mail, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE tr.codetrajet = $1 AND tr.codetrajet = re.codetrajet AND re.mailutilisateur = $2;", array($codetrajet, $mail));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] >= 1;
|
||||
}
|
||||
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$mail = $_SESSION['mail'];
|
||||
if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
|
||||
$avis = $_POST['avislaisse'];
|
||||
$note = $_POST['note'];
|
||||
$codetrajet = intval($_POST['codetrajet']);
|
||||
$date = date('Y-m-d H:i:s');
|
||||
if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) {
|
||||
$requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);";
|
||||
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note));
|
||||
if (!$envoi) {
|
||||
echo "Erreur d'ecriture dans la BD";
|
||||
echo "<br><a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
} else {
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="deposer_avis.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Deposer un avis</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once("../ressources/navbarhtml.php"); ?>
|
||||
<div id="container">
|
||||
<div id="entete">
|
||||
<h1 id="titre">Deposer un avis</h1>
|
||||
</div>
|
||||
<div id="form">
|
||||
<form id="formulaire_avis" enctype="multipart/form-data" action="deposer_avis.php" method="post">
|
||||
<textarea id="avis_laisse" name="avislaisse" form="formulaire_avis" placeholder="Avis"></textarea>
|
||||
<h2>NOTE</h2>
|
||||
<div class="rating">
|
||||
<input type="radio" name="note" id="note3" value="3">
|
||||
<a href="#3" label for="note3" title="Donner 3 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note2" value="2">
|
||||
<a href="#2" label for="note2" title="Donner 2 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note1" value="1">
|
||||
<a href="#1" label for="note1" title="Donner 1 étoiles">☆</a>
|
||||
<?php
|
||||
if (isset($_GET['codetrajet'])) {
|
||||
$codeTrajet = $_GET['codetrajet'];
|
||||
echo "<input type='hidden' name='codetrajet' value='$codeTrajet'>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" value="Valider" id="submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
//Declaration des fonctions
|
||||
|
||||
function checkAvis($db, $mail, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM avis WHERE mailEmetteur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] == 0;
|
||||
}
|
||||
|
||||
function checkCodeTrajetAvis($db, $mail, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE tr.codetrajet = $1 AND tr.codetrajet = re.codetrajet AND re.mailutilisateur = $2;", array($codetrajet, $mail));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] >= 1;
|
||||
}
|
||||
|
||||
//Importation des fichiers necessaires
|
||||
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$mail = $_SESSION['mail'];
|
||||
if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
|
||||
//Recuperation des variables passer par le formulaire
|
||||
$avis = $_POST['avislaisse'];
|
||||
$note = $_POST['note'];
|
||||
$codetrajet = intval($_POST['codetrajet']);
|
||||
$date = date('Y-m-d H:i:s');
|
||||
if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) {
|
||||
$requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);"; //Requete d'insertion
|
||||
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note)); // Envoie de la requete
|
||||
if (!$envoi) { //Erreur
|
||||
echo "Erreur d'ecriture dans la BD";
|
||||
echo "<br><a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
} else { //Redirection en cas de reussite
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="deposer_avis.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Deposer un avis</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once("../ressources/navbarhtml.php"); ?>
|
||||
<div id="container">
|
||||
<div id="entete"> <--Entete-->
|
||||
<h1 id="titre">Deposer un avis</h1>
|
||||
</div>
|
||||
<div id="form"><--Formulaire-->
|
||||
<form id="formulaire_avis" enctype="multipart/form-data" action="deposer_avis.php" method="post">
|
||||
<textarea id="avis_laisse" name="avislaisse" form="formulaire_avis" placeholder="Avis"></textarea> <--Champ_de_saisie_d_avis-->
|
||||
<h2>NOTE</h2>
|
||||
<div class="rating"><--Bouton_note-->
|
||||
<input type="radio" name="note" id="note3" value="3">
|
||||
<a href="#3" label for="note3" title="Donner 3 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note2" value="2">
|
||||
<a href="#2" label for="note2" title="Donner 2 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note1" value="1">
|
||||
<a href="#1" label for="note1" title="Donner 1 étoiles">☆</a>
|
||||
<?php
|
||||
if (isset($_GET['codetrajet'])) {
|
||||
$codeTrajet = $_GET['codetrajet'];
|
||||
echo "<input type='hidden' name='codetrajet' value='$codeTrajet'>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" value="Valider" id="submit"><--Envoie-->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,49 +1,53 @@
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.separation{
|
||||
margin-top : 5%;
|
||||
margin-left : 20%;
|
||||
min-height: 2em;
|
||||
width : 5px;
|
||||
background: black;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-left: 1.5em;
|
||||
padding-right: 1.5em;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
#info{
|
||||
width: 60%;
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage liste trajets*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.separation{
|
||||
margin-top : 5%;
|
||||
margin-left : 20%;
|
||||
min-height: 2em;
|
||||
width : 5px;
|
||||
background: black;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-left: 1.5em;
|
||||
padding-right: 1.5em;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
#info{
|
||||
width: 60%;
|
||||
}
|
@ -1,73 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/trajet.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
if (!(isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure']))){
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
if (isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure'])) {
|
||||
$source = $_POST['lieu_depart'];
|
||||
$dest = $_POST['lieu_arrivee'];
|
||||
$date_depart = $_POST['date_heure'];
|
||||
if ($date_depart < date('Y-m-d')){
|
||||
echo "Erreur date</br>";
|
||||
echo "<a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$result = pg_query_params($db, "(SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($1)))
|
||||
INTERSECT (SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($2)));", array($source, $dest, $date_depart));
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../ressources/navbarhtml.php");
|
||||
?>
|
||||
<div id="container">
|
||||
<div id="entete">
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 class="float" id="titre">Liste des trajets</h1>
|
||||
<br>
|
||||
<h2>Trajets recherchés : <?php echo $source . " vers " . $dest; ?></h2>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) {
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$login = $row['login'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
$date_depart = $row['datedepart'];
|
||||
if (checkPlacesVoiture($db, $codetrajet) && $date_depart >= date('Y-m-d H:i:s')){
|
||||
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
||||
echo "<p>$date_depart - $source vers $dest proposé par : $login</p></td>";
|
||||
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
//Importation des fichiers necessaires
|
||||
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/trajet.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$mail = $_SESSION['mail'];
|
||||
if (!(isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure']))){
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure'])) {
|
||||
$source = $_POST['lieu_depart']; //Recuperation des valeurs passé par le form
|
||||
$dest = $_POST['lieu_arrivee'];
|
||||
$date_depart = $_POST['date_heure'];
|
||||
if ($date_depart < date('Y-m-d')){ //Verification de date
|
||||
echo "Erreur date</br>";
|
||||
echo "<a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//Requete de selection des trajets a affiché
|
||||
|
||||
$result = pg_query_params($db, "(SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($1)))
|
||||
INTERSECT (SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($2)));", array($source, $dest, $date_depart));
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../ressources/navbarhtml.php");
|
||||
?>
|
||||
<div id="container">
|
||||
<div id="entete"> <--Entete-->
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 class="float" id="titre">Liste des trajets</h1>
|
||||
<br>
|
||||
<h2>Trajets recherchés : <?php echo $source . " vers " . $dest; ?></h2>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) { //Recuperation des resultats de la requete
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$login = $row['login'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
$date_depart = $row['datedepart'];
|
||||
if (checkPlacesVoiture($db, $codetrajet) && $date_depart >= date('Y-m-d H:i:s')){ //Affichage des resultats sous forme de tableau
|
||||
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
||||
echo "<p>$date_depart - $source vers $dest proposé par : $login</p></td>";
|
||||
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue