First commit

This commit is contained in:
BRAMAS Arthur
2025-10-10 08:57:59 +02:00
commit 9106887146
17 changed files with 459 additions and 0 deletions

14
pages/accueil.php Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<script src="../js/bootstrap.bundle.min.js"></script>
</head>
<body class="container">
<?php include "../utils_inc/inc_navbar.php"; ?>
<h1>Hello et bienvenue, co OK.</h1>
</body>
</html>

61
pages/gestionMembres.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
session_start();
require_once "../utils_inc/inc_pdo.php";
if (!isset($_SESSION["droit"])){
// pas connecté : retour au formulaire de connexion
header("location:../index.php");
exit();
}
if ($_SESSION["droit"]!="admin"){
header("location:../pages/accueil.php");
exit();
}
// Si on arrive là, c'est qu'on a le droit d'y être !
$textReq = "select * from membre ";
$req = $pdo->prepare($textReq);
$req->execute();
$tabRes = $req->fetchAll(PDO::FETCH_ASSOC);
//var_dump($tabRes);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/styles.css" rel="stylesheet">
<script src="../js/bootstrap.bundle.min.js"></script>
</head>
<body class="container">
<?php include "../utils_inc/inc_navbar.php"; ?>
<table class="table table-striped">
<thead>
<tr>
<th>id </th>
<th>nom </th>
<th>droit </th>
<th>contribs</th>
<th>suppr</th>
</tr>
</thead>
<tbody>
<?php
foreach($tabRes as $uneLigne){
echo "<tr>";
echo " <th>".$uneLigne["id"]."</th>";
echo " <td>".$uneLigne["nom"]."</td>";
echo " <td>".$uneLigne["droit"]."</td>";
echo " <td><a href='../pages/listeContribsMembre.php?id=".$uneLigne["id"]."'><button class='btn btn-info'>voir</a></td>";
echo " <td><a href='#'><button class='btn btn-danger'>X</a></td>";
echo "</tr>";
}
?>
</tbody>
</table>
</body>
</html>

68
pages/listeContribs.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
session_start();
// Liste de TOUTES les contributions (tous les membres)
// Juste pour l'admin
require_once "../utils_inc/inc_pdo.php";
if (!isset($_SESSION["droit"])){
// pas connecté : retour au formulaire de connexion
header("location:formCo.php");
exit();
}
if ($_SESSION["droit"]!="admin"){
// droits insuffisants : connexion à refaire ou message
// "moins gentil"
header("location:formCo.php");
exit();
}
// Si on arrive là, c'est qu'on a le droit d'y être !
$textReq = "select contribution.id as numero, membre.nom as nom_membre, projet.nom as nom_projet, duree ";
$textReq.= "from membre inner join contribution on membre.id = contribution.membre_id ";
$textReq.= " inner join projet on contribution.projet_id = projet.id ";
$textReq.= "order by membre.nom, nom_projet ";
$req = $pdo->prepare($textReq);
$req->execute();
$tabRes = $req->fetchAll(PDO::FETCH_ASSOC);
//var_dump($tabRes);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<script src="../js/bootstrap.bundle.min.js"></script>
</head>
<body class="container">
<?php include "../utils_inc/inc_navbar.php"; ?>
<table class="table table-striped">
<thead>
<tr>
<th>Numéro </th>
<th>Membre </th>
<th>Projet </th>
<th>Durée </th>
</tr>
</thead>
<tbody>
<?php
foreach($tabRes as $uneLigne){
echo "<tr>";
echo " <th>".$uneLigne["numero"]."</th>";
echo " <td>".$uneLigne["nom_membre"]."</td>";
echo " <td>".$uneLigne["nom_projet"]."</td>";
echo " <td>".$uneLigne["duree"]."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,89 @@
<?php
session_start();
require_once "../utils_inc/inc_pdo.php";
$idM = $_GET["id"]; // id du membre pour lequel on veut afficher la liste
if (!isset($_SESSION["droit"])){
// pas connecté : retour au formulaire de connexion
header("location:formCo.php");
exit();
}
// accès possible si : admin ou (dev et "ce sont mes contribs")
if ( !(($_SESSION["droit"]=="admin") || ($_SESSION["droit"]=="dev" && $_SESSION["login"]==$idM)) ){
die("Droits insuffisants");
}
// Si on arrive ici, c'est que nos droits sont suffisants
$textReq = "select contribution.id as numero, membre.nom as nom_membre, projet.nom as nom_projet, duree ";
$textReq.= "from membre inner join contribution on membre.id = contribution.membre_id ";
$textReq.= " inner join projet on contribution.projet_id = projet.id ";
$textReq.= "where membre.id = :id_m ";
$textReq.= "order by membre.nom, nom_projet ";
$req = $pdo->prepare($textReq);
$req->bindParam(":id_m",$idM); // protection contre injections SQL
$req->execute();
$tabRes = $req->fetchAll(PDO::FETCH_ASSOC);
//---------------------------------------------------------
$reqProjet = $pdo->prepare("select * from projet");
$reqProjet->execute();
$tabProjets = $reqProjet->fetchAll(PDO::FETCH_ASSOC);
//var_dump($tabRes);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<script src="../js/bootstrap.bundle.min.js"></script>
</head>
<body class="container">
<?php include "../utils_inc/inc_navbar.php"; ?>
<table class="table table-striped">
<thead>
<tr>
<th>Numéro </th>
<th>Membre </th>
<th>Projet </th>
<th>Durée </th>
</tr>
</thead>
<tbody>
<?php
foreach($tabRes as $uneLigne){
echo "<tr>";
echo " <th>".$uneLigne["numero"]."</th>";
echo " <td>".$uneLigne["nom_membre"]."</td>";
echo " <td>".$uneLigne["nom_projet"]."</td>";
echo " <td>".$uneLigne["duree"]."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<form action="../traitements/insererContrib.php" method="get">
<input name="idMembre" hidden value='<?php echo $idM; ?>'>
<label>Projet</label>
<select name="idProjet">
<?php
foreach ($tabProjets as $projet){
echo "<option value='".$projet['id']."'>".$projet['nom']."</option>";
}
?>
</select>
<label>Durée</label>
<input name="duree" type="number">
<input type="submit">
</form>
</body>
</html>