added navbar to tableaubord

admin
Flavien Haas 6 years ago
parent 1bbc5eaf76
commit a2e72de86c

@ -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%;
}

@ -0,0 +1,5 @@
<?php
function navbarHTML($title){
echo '<!DOCTYPE html><html lang="fr"><head><meta charset="UTF-8"><link rel="stylesheet" href="tableauBord.css"><link rel="icon" type="image/png" href=""/><title>'.$title.'</title><nav class="menu"><a class="menuItem" href="./../inscription.php">Tableau de bord</a><a class="menuItem" href="../inscription.php">Trajets publiés</a><a class="menuItem" href="../inscription.php">Trajets réservés</a><a class="menuItem" href="../inscription.php">Messagerie</a><a class="menuItem" href="../inscription.php">Avis reçus</a><a class="menuItem" href="../inscription.php">Avis laissés</a><a class="menuItem" href="../inscription.php">Profil</a><a class="menuItem" href="../deconnexion.php">Se déconnecter</a></nav></head><body>';
}
?>

@ -1,30 +1,29 @@
<?php
include '../ressources/navbarHTML.php';
navbarHTML("Tableau de bord");
require ('../connectionBD.php');
$mail = null;
$db = connexionBD();
init();
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;
$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']))
{
if(isset($_POST['submitadd'])){
addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitchange']))
{
}
if(isset($_POST['submitchange'])){
changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitshow']))
{
}
if(isset($_POST['submitshow'])){
showVoiture();
}
}
function init(){
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
@ -35,9 +34,9 @@
else{
$mail = $_SESSION['mail'];
}
}
}
function getPrenom($mail){
function getPrenom($mail){
global $db;
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
if($result){
@ -46,9 +45,9 @@
return $prenom;
}
return null;
}
}
function getLogin($mail){
function getLogin($mail){
global $db;
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
if($result){
@ -57,9 +56,9 @@
return $login;
}
return null;
}
}
function getTrajetsProposes($mail){
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){
@ -67,9 +66,9 @@
return $row[0];
}
return 0;
}
}
function getTrajetsReserves($mail){
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){
@ -77,9 +76,9 @@
return $row[0];
}
return 0;
}
}
function getMessagesNonLus($mail){
function getMessagesNonLus($mail){
global $db;
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
if($result){
@ -87,9 +86,9 @@
$login = $row[0];
return $login;
}
}
}
function getAvisNonLus($mail){
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){
@ -97,29 +96,29 @@
$login = $row[0];
return $login;
}
}
}
function getPathImgProfil($mail){
function getPathImgProfil($mail){
if (file_exists("../imageProfil/$mail.png")){
return "../imageProfil/$mail.png";
}
return "../imageProfil/default.svg";
}
}
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
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){
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(){
function showVoiture(){
global $db;
$requete = "SELECT * FROM public.voiture WHERE voiture.mail = '".$_SESSION['mail']."';";
if($donnees = pg_query($db, $requete)){
@ -131,17 +130,9 @@
echo "année de fabrication = ".$res['anneefab']."<br>";
}
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="tableauBord.css">
<link rel="icon" type="image/png" href="" />
<title>Tableau de bord</title>
<script type="text/javascript">
function ShowTab (E){
document.getElementById("addVoiture").style.display = (E == 1) ? 'block' : 'none';
@ -149,19 +140,7 @@
document.getElementById("showVoiture").style.display = (E == 3) ? 'block' : 'none';
}
</script>
<nav class="menu">
<a class="menuItem" href="./../inscription.php">Tableau de bord</a>
<a class="menuItem" href="../inscription.php">Trajets publiés</a>
<a class="menuItem" href="../inscription.php">Trajets réservés</a>
<a class="menuItem" href="../inscription.php">Messagerie</a>
<a class="menuItem" href="../inscription.php">Avis reçus</a>
<a class="menuItem" href="../inscription.php">Avis laissés</a>
<a class="menuItem" href="../inscription.php">Profil</a>
<a class="menuItem" href="../deconnexion.php">Se déconnecter</a>
</nav>
</head>
<body>
<div id="content">
<div id="content">
<div id="tableauBord">
<h1>Bienvenue <?php echo getLogin($mail); ?></h1>
<div id="divImgProfil">
@ -196,7 +175,6 @@
<input type="radio" name="TabCheck" onclick="ShowTab(3)"/>Afficher ma voiture
</div>
</form>
<div id="addVoiture" style="display: none;">
<h1>Ajouter une voiture</h1>
<fieldset>
@ -212,7 +190,6 @@
</form>
</fieldset>
</div>
<div id="changeVoiture" style="display: none;">
<h1>Modifier une voiture</h1>
<fieldset>
@ -228,7 +205,6 @@
</form>
</fieldset>
</div>
<div id="showVoiture" style="display: none;">
<h1>Afficher ma voiture</h1>
<fieldset>
@ -240,6 +216,6 @@
</fieldset>
</div>
</div>
</div>
</div>
</body>
</html>

Loading…
Cancel
Save