1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| <?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Passeport Pétrolier</title>
<link href="styleTableau.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function modif(clique)
{
if (document.getElementById(clique).checked) {
// Ajout d'une inscription
window.location.href="validationInscription.php?monmatricule="+clique+"&afaire=inscription";
}else{
// Demande de confirmation de suppression
if (confirm("Voulez-vous vraiment supprimer cette personne : "+clique+" ?"))
{
// Suppression
window.location.href="validationInscription.php?monmatricule="+clique+"&afaire=desinscription";
}
}
// Rafraichissement de la page
window.location.href="inscription.php";
// se positionne sur l'ancre du tableau
self.location.hash="#ancre";
}
</script>
</head>
<body>
<h1>Inscription aux formations</h1>
<?php
// Récupère les critères d'accés dans les variables de session
$niveau=$_SESSION["niveau_pp"];
$filtre=$_SESSION["filtre_pp"];
$droit=$_SESSION["droit_pp"];
// Connexion à la base de donnée du Personnel
$dbconnectPersonnel = pg_connect("host=bpia-psql-1 port=5432 dbname=ListePersonnel user=postgres password=AdminPsql1");
if (!$dbconnectPersonnel)
{
echo "Pas de connexion à la base de données Personnel dans le fichier inscription.php.<br>";
echo "Prenez contact avec M. LEFEVRE au 29.319<br>";
exit;
}
// Connexion à la base de données du Passeport Pétrolier
$dbconnect = pg_connect("host=bpia-psql-1 port=5432 dbname=PasseportPetrolier user=postgres password=AdminPsql1");
if (!$dbconnect)
{
echo "Pas de connexion à la base de données Passeport Pétrolier dans le fichier inscription.php.<br>";
echo "Prenez contact avec M. LEFEVRE au 29.319<br>";
exit;
}
// Construction de la requete sur la base du personnel
$queryPersonnel = "select * from personnel where statut='EV' and $niveau LIKE '$filtre%'order by nom";
// Execute la requete
$resultPersonnel = pg_query($dbconnectPersonnel, $queryPersonnel);
if (!$resultPersonnel)
{
echo "La requete sur la base du personnel ne fonctionne pas dans le fichier inscription.php.<br>";
echo "Prenez contact avec M. LEFEVRE au 29.319<br>";
exit;
}
?>
<table align="center">
<?php
while ($personnel = pg_fetch_assoc($resultPersonnel))
{
// Constuction de la chaine d'identité
$identite=trim($personnel['matricule'])." - ".trim($personnel['nom'])." ".trim($personnel['prenom'])." (".trim($personnel['grade']).") - (".trim($personnel['fonction'])."/".trim($personnel['service']).")";
// Recupere le matricule
$matricule=trim($personnel['matricule']);
// Construction de la requete de vérification pour savoir si la personne est inscrite
$queryVerifInscrit = "select * from suivi_militaire where matricule='$matricule'";
// Execute la requete
$resultVerifInscrit = pg_query($dbconnect, $queryVerifInscrit);
if (!$resultVerifInscrit)
{
echo "La requete resultVerifInscrit ne fonctionne pas dans le fichier inscription.php.<br>";
echo "Prenez contact avec M. LEFEVRE au 29.319<br>";
exit;
}
// Compte le nombre de personne
$NbLigne=pg_num_rows($resultVerifInscrit);
// Remplissage du tableau
if ($NbLigne==0)
{
// Pas inscrit à la formation
?>
<tr>
<td align="left">
<input type="checkbox" onclick="modif(this.id)" id="<?php echo $matricule; ?>" value="<?php echo $matricule; ?>"><?php echo $identite; ?>
</td>
</tr>
<?php
}else{
// Inscrit à la formation
?>
<tr>
<td align="left">
<input type="checkbox" onclick="modif(this.id)" id="<?php echo $matricule; ?>" checked value="<?php echo $matricule; ?>"><?php echo $identite; ?>
</td>
</tr>
<?php
}
}
?>
</table>
<h2 id="ancre">ANCRE</h2>
</body>
</html> |