Merge branch 'bandeau' into profil

admin
remi.biette 6 years ago
commit 6b1e6bf907

@ -1,7 +1,7 @@
*{ *{
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: "Calibri Light"; font-family: "Arial";
} }
h1{ h1{

@ -25,7 +25,8 @@ if(isset($_POST['submitshow'])){
showVoiture($db); showVoiture($db);
} }
function getPrenom($db, $mail){ function getPrenom($db, $mail)
{
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail)); $result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
if ($result) { if ($result) {
$row = pg_fetch_array($result); $row = pg_fetch_array($result);
@ -35,7 +36,8 @@ function getPrenom($db, $mail){
return null; return null;
} }
function getLogin($db, $mail){ function getLogin($db, $mail)
{
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail)); $result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
if ($result) { if ($result) {
$row = pg_fetch_array($result); $row = pg_fetch_array($result);
@ -45,7 +47,8 @@ function getLogin($db, $mail){
return null; return null;
} }
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)); $result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
if ($result) { if ($result) {
$row = pg_fetch_array($result); $row = pg_fetch_array($result);
@ -54,7 +57,8 @@ function getTrajetsProposes($db, $mail){
return 0; return 0;
} }
function getTrajetsReserves($db, $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 etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($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));
if ($result) { if ($result) {
$row = pg_fetch_array($result); $row = pg_fetch_array($result);
@ -63,7 +67,8 @@ function getTrajetsReserves($db, $mail){
return 0; 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)); $result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
if ($result) { if ($result) {
$row = pg_fetch_array($result); $row = pg_fetch_array($result);
@ -72,7 +77,8 @@ function getMessagesNonLus($db, $mail){
} }
} }
function getAvisNonLus($db, $mail){ function getAvisNonLus($db, $mail)
{
global $db; 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)); $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) { if ($result) {
@ -82,25 +88,29 @@ function getAvisNonLus($db, $mail){
} }
} }
function getPathImgProfil($mail){ function getPathImgProfil($mail)
{
if (file_exists("../imageProfil/$mail.png")) { if (file_exists("../imageProfil/$mail.png")) {
return "../imageProfil/$mail.png"; return "../imageProfil/$mail.png";
} }
return "../imageProfil/default.svg"; return "../imageProfil/default.svg";
} }
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){ function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab)
{
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "','" . $_SESSION['mail'] . "');"; $requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "','" . $_SESSION['mail'] . "');";
pg_query($db, $requete); pg_query($db, $requete);
} }
function changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){ function changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab)
{
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "') WHERE mail = '" . $_SESSION['mail'] . "';"; $requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "') WHERE mail = '" . $_SESSION['mail'] . "';";
echo "requete =" . $requete; echo "requete =" . $requete;
pg_query($db, $requete); pg_query($db, $requete);
} }
function showVoiture($db){ function showVoiture($db)
{
$requete = "SELECT * FROM public.voiture WHERE voiture.mail = '" . $_SESSION['mail'] . "';"; $requete = "SELECT * FROM public.voiture WHERE voiture.mail = '" . $_SESSION['mail'] . "';";
if ($donnees = pg_query($db, $requete)) { if ($donnees = pg_query($db, $requete)) {
while ($res = pg_fetch_assoc($donnees)) { while ($res = pg_fetch_assoc($donnees)) {
@ -112,12 +122,15 @@ function showVoiture($db){
} }
} }
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" href="tableauBord.css"><link rel="icon" type="image/png" href=""/> <link rel="stylesheet" href="tableauBord.css">
<link rel="stylesheet" href="../ressources/navbarhtml.css">
<link rel="icon" type="image/png" href=""/>
<title>Tableau de bord</title> <title>Tableau de bord</title>
</head> </head>
<body> <body>
@ -169,12 +182,29 @@ function showVoiture($db){
<fieldset> <fieldset>
<form action="tableauBord.php" method="post"> <form action="tableauBord.php" method="post">
<table> <table>
<tr><td><p>matricule :</p></td><td><input type="text" name="matricule"/></td></tr> <tr>
<tr><td><p>marque :</p></td><td><input type="text" name="marque"/></td></tr> <td><p>matricule :</p></td>
<tr><td><p>modele :</p></td><td><input type="text" name="modele"/></td></tr> <td><input type="text" name="matricule"/></td>
<tr><td><p>nombre de places :</p></td><td><input type="number" maxlength="1" name="nbplaces"/></td></tr> </tr>
<tr><td><p>année de fabrication :</p></td><td><input type="number" nmaxlength="4" name="anneefab"/></td></tr> <tr>
<tr><td><p><input type="submit" name="submitadd" value="ajouter une voiture"></td></tr> <td><p>marque :</p></td>
<td><input type="text" name="marque"/></td>
</tr>
<tr>
<td><p>modele :</p></td>
<td><input type="text" name="modele"/></td>
</tr>
<tr>
<td><p>nombre de places :</p></td>
<td><input type="number" maxlength="1" name="nbplaces"/></td>
</tr>
<tr>
<td><p>année de fabrication :</p></td>
<td><input type="number" nmaxlength="4" name="anneefab"/></td>
</tr>
<tr>
<td><p><input type="submit" name="submitadd" value="ajouter une voiture"></td>
</tr>
</table> </table>
</form> </form>
</fieldset> </fieldset>
@ -184,12 +214,29 @@ function showVoiture($db){
<fieldset> <fieldset>
<form action="tableauBord.php" method="post"> <form action="tableauBord.php" method="post">
<table> <table>
<tr><td><p>matricule :</p></td><td><input type="text" name="matricule"/></td></tr> <tr>
<tr><td><p>marque :</p></td><td><input type="text" name="marque"/></td></tr> <td><p>matricule :</p></td>
<tr><td><p>modele :</p></td><td><input type="text" name="modele"/></td></tr> <td><input type="text" name="matricule"/></td>
<tr><td><p>nombre de places :</p></td><td><input type="number" maxlength="1" name="nbplaces"/></td></tr> </tr>
<tr><td><p>année de fabrication :</p></td><td><input type="number" nmaxlength="4" name="anneefab"/></td></tr> <tr>
<tr><td><p><input type="submit" name="submitchange" value="modifier une voiture"></td></tr> <td><p>marque :</p></td>
<td><input type="text" name="marque"/></td>
</tr>
<tr>
<td><p>modele :</p></td>
<td><input type="text" name="modele"/></td>
</tr>
<tr>
<td><p>nombre de places :</p></td>
<td><input type="number" maxlength="1" name="nbplaces"/></td>
</tr>
<tr>
<td><p>année de fabrication :</p></td>
<td><input type="number" nmaxlength="4" name="anneefab"/></td>
</tr>
<tr>
<td><p><input type="submit" name="submitchange" value="modifier une voiture"></td>
</tr>
</table> </table>
</form> </form>
</fieldset> </fieldset>
@ -199,7 +246,9 @@ function showVoiture($db){
<fieldset> <fieldset>
<form action="tableauBord.php" method="post"> <form action="tableauBord.php" method="post">
<table> <table>
<tr><td><p><input type="submit" name="submitshow" value="afficher ma voiture"></td></tr> <tr>
<td><p><input type="submit" name="submitshow" value="afficher ma voiture"></td>
</tr>
</table> </table>
</form> </form>
</fieldset> </fieldset>

Loading…
Cancel
Save