diff --git a/WEB/Recherche.css b/WEB/Recherche.css
deleted file mode 100644
index 21aa5d2..0000000
--- a/WEB/Recherche.css
+++ /dev/null
@@ -1,27 +0,0 @@
-.centrage{
- text-align : center;
- font-size: 20px;
-}
-
-.global {
- position: absolute; /* postulat de départ */
- top: 45%; left: 50%; /* à 50%/50% du parent référent */
- transform: translate(-50%, -50%); /* décalage de 50% de sa propre taille */
- text-align : center;
-}
-
-.fort {
- font-weight: bold;
- text-align : center;
- text-decoration: underline;
- font-size : 30px;
-}
-
-.bord{
- border-radius: 20px;
- border-left: 2px solid black;
- border-right: 2px solid black;
- border-top: 2px solid black;
- border-bottom: 2px solid black;
- padding : 20px 80px 60px 80px;
-}
diff --git a/WEB/Recherche.php b/WEB/Recherche.php
deleted file mode 100644
index 8c55cbe..0000000
--- a/WEB/Recherche.php
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
+
Avis Laissés
diff --git a/WEB/deposerTrajet/depotTrajet.css b/WEB/deposerTrajet/depotTrajet.css
index 4c5d463..0759780 100644
--- a/WEB/deposerTrajet/depotTrajet.css
+++ b/WEB/deposerTrajet/depotTrajet.css
@@ -52,7 +52,6 @@ h1{
}
#formulaire{
- margin-top: ;
background-color: white;
border-radius: 10px;
padding: 4em;
diff --git a/WEB/liste_trajets/liste_trajet.css b/WEB/liste_trajets/liste_trajet.css
index ee12bc7..4761e0e 100755
--- a/WEB/liste_trajets/liste_trajet.css
+++ b/WEB/liste_trajets/liste_trajet.css
@@ -7,7 +7,7 @@ Page PHP : liste.php
body {
color:black;
background-color:white;
- background-image:url(../resources/background.jpg);
+ background-image:url("../ressources/image/background.jpg");
background-repeat:no-repeat;
background-size:104%;
margin: 0;
@@ -39,13 +39,14 @@ h2{
.separation{
margin-top : 5%;
margin-left : 20%;
- height: 200px;
+ min-height: 2em;
width : 5px;
background: black;
}
-#ligne{
- padding-left:10%;
+td{
+ padding-left: 1.5em;
+ padding-right: 1.5em;
width: 33%;
}
diff --git a/WEB/liste_trajets/liste_trajet.php b/WEB/liste_trajets/liste_trajet.php
index a1f83be..d3bd525 100755
--- a/WEB/liste_trajets/liste_trajet.php
+++ b/WEB/liste_trajets/liste_trajet.php
@@ -1,6 +1,7 @@
contact.php
-*/
-
-$source=$_POST['lieu_depart'];
-$dest=$_POST['lieu_arrivee'];
-$date_depart=$_POST['date_heure'];
-
-$requete="SELECT codeTrajet, dateDepart, dateArrivee, mailProposition FROM Trajet WHERE Trajet.dateDepart=$date_depart AND (SELECT codeTrajet FROM Traverser WHERE nomVille=$source AND nomVille=$dest)=Trajet.codeTrajet;";
+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'];
+}
-$envoi = pg_query($db,$requete);
+$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));
-if ($envoi == FALSE){
- echo 'Erreur !';
-}
?>
-
+
-
-
-
-
Liste des trajets
+
+
+
+
+
Liste des trajets
-
-
-
-
Liste des trajets
-
-
Trajets recherchés : ".$dest; ?>
-
-
-
-
-
-
- |
-
- $dest : $login";
- //sourcedest recupéré avec le code du trajet, afficher plusieurs avec un while
- ?>
- |
-
-
- |
-
-
-
-
+
+
+
+
+
Liste des trajets
+
+
Trajets recherchés :
+
+
+
+
| ";
+ echo " $date_depart - $source vers $dest proposé par : $login | ";
+ echo "Réserver | ";
+ echo "";
+ }
+ }
+ ?>
+
+
+
diff --git a/WEB/liste_trajets/reserver.php b/WEB/liste_trajets/reserver.php
new file mode 100644
index 0000000..31afc41
--- /dev/null
+++ b/WEB/liste_trajets/reserver.php
@@ -0,0 +1,29 @@
+
\ No newline at end of file
diff --git a/WEB/recherche/recherche.css b/WEB/recherche/recherche.css
new file mode 100644
index 0000000..cb02c7f
--- /dev/null
+++ b/WEB/recherche/recherche.css
@@ -0,0 +1,40 @@
+.centrage {
+ text-align: center;
+ font-size: 20px;
+}
+
+.global {
+
+ text-align: center;
+
+}
+
+br {
+ line-height: 50px;
+}
+
+body {
+ color: black;
+ background-color: white;
+ background-image: url("../ressources/image/background.jpg");
+ background-repeat: no-repeat;
+ background-size: 104%;
+ margin: 0;
+}
+
+#container {
+ margin: 5% 15% 2% 15%;
+ background-color: white;
+ border: 2px solid black;
+}
+
+h1 {
+ text-align: center;
+ font-size: 250%;
+}
+
+#form {
+ text-align: center;
+}
+
+
diff --git a/WEB/recherche/recherche.php b/WEB/recherche/recherche.php
new file mode 100644
index 0000000..99f7a5e
--- /dev/null
+++ b/WEB/recherche/recherche.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
Rechercher trajet
+
+
+
+
+
+
Rechercher trajet
+
+
+
+
+
+
+
+
+
+
diff --git a/WEB/ressources/trajet.php b/WEB/ressources/trajet.php
index 4af0ed8..de7fb2a 100644
--- a/WEB/ressources/trajet.php
+++ b/WEB/ressources/trajet.php
@@ -1,43 +1,79 @@
date('Y-m-d H:i:s');
$result = pg_query_params($db, "SELECT COUNT(*) From Trajet WHERE mailproposition = $1 AND $2 BETWEEN datedepart AND datearrivee;", array($mail, $dateDepart));
$row = pg_fetch_array($result);
return $row[0] == 0 && $valide;
}
+//Vérifier le nombre de places restantes
+function checkPlacesVoiture($db, $codetrajet)
+{
+ $result = pg_query_params($db, "SELECT nbplaces FROM Voiture vo, Trajet ta WHERE vo.mail = ta.mailproposition AND ta.codeTrajet = $1 LIMIT 1;", array($codetrajet));
+ $result2 = pg_query_params($db, "SELECT COUNT(*) FROM Reserver re, Trajet ta WHERE re.codetrajet.mail = ta.codetrajet AND ta.codetrajet = $1;", array($codetrajet));
+ if(!$result || !$result2){
+ return false;
+ }
+ $nbplaces = pg_fetch_array($result);
+ $nbreservations = pg_fetch_array($result);
+ return $nbplaces-1>$nbreservations;
+}
+
+//Vérifier la cohérence des dates
+function checkDatesReserve($db, $mail, $dateDepart)
+{
+ $result = pg_query_params($db, "SELECT COUNT(*) From Trajet ta, reserve re WHERE re.mailutilisateur = $1 AND re.codetrajet = ta.codetrajet AND $2 BETWEEN datedepart AND datearrivee;", array($mail, $dateDepart));
+ $row = pg_fetch_array($result);
+ return $row[0] == 0;
+}
+
//Vérifier que l'utilisateur est bien associé à cette voiture
-function checkVoiture($db, $mail, $matricule){
+function checkVoiture($db, $mail, $matricule)
+{
$result = pg_query_params($db, "SELECT matricule From Voiture WHERE mail = $1 AND matricule = $2;", array($mail, $matricule));
$row = pg_fetch_array($result);
return !strcmp($matricule, $row[0]);
}
-function getTrajetsProposes($db, $mail){
+function getTrajetsProposes($db, $mail)
+{
$result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@@ -46,8 +82,9 @@ function getTrajetsProposes($db, $mail){
return 0;
}
-function getTrajetsReserves($db, $mail){
- $result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($mail));
+function getTrajetsReserves($db, $mail)
+{
+ $result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
return $row[0];
@@ -55,7 +92,8 @@ function getTrajetsReserves($db, $mail){
return 0;
}
-function getMessagesNonLus($db, $mail){
+function getMessagesNonLus($db, $mail)
+{
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@@ -64,7 +102,8 @@ function getMessagesNonLus($db, $mail){
}
}
-function getAvisNonLus($db, $mail){
+function getAvisNonLus($db, $mail)
+{
global $db;
$result = pg_query_params($db, "SELECT COUNT(tr.mailProposition) FROM Trajet tr, Avis av WHERE tr.codeTrajet = av.codeTrajet AND av.estLu = false AND tr.mailProposition = $1;", array($mail));
if ($result) {
@@ -75,59 +114,66 @@ function getAvisNonLus($db, $mail){
}
//Récupérer la liste des voitures concernant un utilisateur
-function getListeVoitures($db, $mail){
+function getListeVoitures($db, $mail)
+{
$result = pg_query_params($db, "SELECT * FROM Voiture WHERE mail = $1;", array($mail));
return $result;
}
//Afficher les voitures dans un select
-function afficherVoitures($db, $mail){
- $voitures = getListeVoitures($db, $mail);
- while ($row = pg_fetch_array($voitures)) {
- $modele = $row['modele'];
- $matricule = $row['matricule'];
- echo "