From a2e72de86c0b5e7b75950f551216ca81dbb9c47e Mon Sep 17 00:00:00 2001 From: flavien Date: Thu, 9 May 2019 16:48:26 +0200 Subject: [PATCH] added navbar to tableaubord --- WEB/ressources/navbarhtml.css | 128 ++++++++++ WEB/ressources/navbarhtml.php | 5 + WEB/tableauBord/tableauBord.php | 440 +++++++++++++++----------------- 3 files changed, 341 insertions(+), 232 deletions(-) create mode 100644 WEB/ressources/navbarhtml.css create mode 100644 WEB/ressources/navbarhtml.php diff --git a/WEB/ressources/navbarhtml.css b/WEB/ressources/navbarhtml.css new file mode 100644 index 0000000..25c0e76 --- /dev/null +++ b/WEB/ressources/navbarhtml.css @@ -0,0 +1,128 @@ +*{ + margin: 0; + padding: 0; + font-family: "Calibri Light"; +} + +h1{ + font-size: 3em; + text-align: center; + text-decoration: underline; +} + +#content{ + min-width: 320px; + width: 100%; + display: flex; + flex-wrap: nowrap; + justify-content: center; + align-items: center; +} + +#tableauBord{ + margin: 2em; + padding: 1em; + width: 100%; +} + +.menu { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + background-color: rgb(65, 154, 28); +} + +.menuItem { + display: flex; + flex-wrap: nowrap; + align-items: center; + justify-content: center; + color: white; + width: 10%; + min-width: 5em; + font-weight: bold; + text-decoration: none; + padding: 0.8em; + border-bottom: 4px solid rgb(65, 154, 28); + font-size: 1.1em; + text-align: center; +} + +.menuItem:hover{ + cursor: pointer; + border-bottom: 4px solid orange; +} + +#divImgProfil{ + width: 100%; + display: flex; + flex-wrap: nowrap; + justify-content: center; +} + +#imgProfil{ + background-color: white; + margin-top: 2.5em; + width: 60%; + height: 60%; + max-width: 210px; + max-height: 210px; + border-radius: 10px; +} + +#trajet{ + margin-top: 2em; + display: flex; + flex-wrap: wrap; + flex-direction: row; + justify-content: center; + text-align: center; + width: 100%; +} + +.btnTrajet{ + display: flex; + flex-wrap: nowrap; + justify-content: center; + align-items: center; + text-decoration: none; + padding: 0.4em; + color: black; + background-color: lightgray; + border: 1px solid black; + +} + +.btnTrajet:hover{ + background-color: grey; +} + +#btnTrajet2{ + margin-left: 10%; +} + +#recap{ + margin-top: 2.5em; + width: 50%; + margin-left: 50%; + transform: translate(-50%); +} + +.recapLine{ + margin-bottom: 1.5em; + display: flex; + flex-wrap: nowrap; + justify-content: left; + align-items: center; + width: 100%; +} + +.recapIcon{ + width: 50px; + height: 50px; +} + +p{ + margin-left: 10%; +} diff --git a/WEB/ressources/navbarhtml.php b/WEB/ressources/navbarhtml.php new file mode 100644 index 0000000..aca21e8 --- /dev/null +++ b/WEB/ressources/navbarhtml.php @@ -0,0 +1,5 @@ +'.$title.''; +} +?> diff --git a/WEB/tableauBord/tableauBord.php b/WEB/tableauBord/tableauBord.php index 5dafd9f..a20fe97 100644 --- a/WEB/tableauBord/tableauBord.php +++ b/WEB/tableauBord/tableauBord.php @@ -1,245 +1,221 @@ = current_date;", array($mail)); - if($result){ - $row = pg_fetch_array($result); - return $row[0]; - } - return 0; - } - - function getTrajetsReserves($mail){ - global $db; - $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)); - if($result){ - $row = pg_fetch_array($result); - return $row[0]; - } - return 0; - } - - function getMessagesNonLus($mail){ - global $db; - $result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail)); - if($result){ - $row = pg_fetch_array($result); - $login = $row[0]; - return $login; - } +include '../ressources/navbarHTML.php'; +navbarHTML("Tableau de bord"); + +require ('../connectionBD.php'); +$mail = null; +$db = connexionBD(); +init(); + +$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index" +$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL; +$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL; +$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL; +$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL; + +if(isset($_POST['submitadd'])){ + addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab); +} +if(isset($_POST['submitchange'])){ + changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab); +} +if(isset($_POST['submitshow'])){ + showVoiture(); +} + +function init(){ + session_start(); + global $mail; + //Si on est pas connecté redirection vers la page de connexion + if(!isset($_SESSION['mail'])){ + header('Location: ../index.php'); + exit(); + } + else{ + $mail = $_SESSION['mail']; + } +} + +function getPrenom($mail){ + global $db; + $result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail)); + if($result){ + $row = pg_fetch_array($result); + $prenom = $row[0]; + return $prenom; + } + return null; +} + +function getLogin($mail){ + global $db; + $result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail)); + if($result){ + $row = pg_fetch_array($result); + $login = $row[0]; + return $login; + } + return null; +} + +function getTrajetsProposes($mail){ + global $db; + $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); + return $row[0]; + } + return 0; +} + +function getTrajetsReserves($mail){ + global $db; + $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)); + if($result){ + $row = pg_fetch_array($result); + return $row[0]; + } + return 0; +} + +function getMessagesNonLus($mail){ + global $db; + $result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail)); + if($result){ + $row = pg_fetch_array($result); + $login = $row[0]; + return $login; + } +} + +function getAvisNonLus($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){ + $row = pg_fetch_array($result); + $login = $row[0]; + return $login; + } +} + +function getPathImgProfil($mail){ + if (file_exists("../imageProfil/$mail.png")){ + return "../imageProfil/$mail.png"; + } + return "../imageProfil/default.svg"; +} + +function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){ + global $db; + $requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','".$_SESSION['mail']."');"; + pg_query($db, $requete); +} + +function changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){ + global $db; + $requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';"; + echo "requete =".$requete; + pg_query($db, $requete); +} + +function showVoiture(){ + global $db; + $requete = "SELECT * FROM public.voiture WHERE voiture.mail = '".$_SESSION['mail']."';"; + if($donnees = pg_query($db, $requete)){ + while($res = pg_fetch_assoc($donnees)){ + echo "matricule = ".$res['matricule']."
"; + echo "marque = ".$res['marque']."
"; + echo "modele = ".$res['modele']."
"; + echo "nombre de places = ".$res['nbplaces']."
"; + echo "année de fabrication = ".$res['anneefab']."
"; } - - function getAvisNonLus($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){ - $row = pg_fetch_array($result); - $login = $row[0]; - return $login; - } - } - - function getPathImgProfil($mail){ - if (file_exists("../imageProfil/$mail.png")){ - return "../imageProfil/$mail.png"; - } - return "../imageProfil/default.svg"; - } - - function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){ - global $db; - $requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','".$_SESSION['mail']."');"; - pg_query($db, $requete); - } - - function changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){ - global $db; - $requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';"; - echo "requete =".$requete; - pg_query($db, $requete); - } - - function showVoiture(){ - global $db; - $requete = "SELECT * FROM public.voiture WHERE voiture.mail = '".$_SESSION['mail']."';"; - if($donnees = pg_query($db, $requete)){ - while($res = pg_fetch_assoc($donnees)){ - echo "matricule = ".$res['matricule']."
"; - echo "marque = ".$res['marque']."
"; - echo "modele = ".$res['modele']."
"; - echo "nombre de places = ".$res['nbplaces']."
"; - echo "année de fabrication = ".$res['anneefab']."
"; - } - } - } - + } +} ?> - - - - - - - Tableau de bord - - - - -
+ +
-

Bienvenue

-
- +

Bienvenue

+
+ +
+ +
+
+ +

Vous avez trajets proposés à effectuer.

-
- Déposer un trajet - Rechercher un trajet +
+ +

Vous avez trajets réservés à effectuer.

-
-
- -

Vous avez trajets proposés à effectuer.

-
-
- -

Vous avez trajets réservés à effectuer.

-
-
- -

Vous avez messages non lus.

-
-
- -

Vous avez avis non lus.

-
+
+ +

Vous avez messages non lus.

-
-
- Ajouter une voiture - Modifier ma voiture - Afficher ma voiture -
-
- - - - -
+