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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
| <?php
function dateusfr($dateus)
{
$date=explode("-",$dateus);
return $date[2]."/".$date[1]."/".$date[0];
}
function datefrus($datefr)
{
$date=explode("/",$datefr);
return $date[2]."-".$date[1]."-".$date[0];
}
session_start();
if (isset($_SESSION["pseudo"]) == false)
{
header("Location:connexion.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="fr" />
<link rel="stylesheet" href="css/stylesMiseEnPage.css" type="text/css" />
<link rel="stylesheet" href="css/styles.css" type="text/css" />
<script src="js/fonctions.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js" type="text/javascript"></script>
<script src="jquery.ui.datepicker-fr.js"></script>
<title>Gestion des stages</title>
<script>
$(function() {
$( "#dateDebut" ).datepicker( $.datepicker.regional[ "fr" ] );
$( "#dateFin" ).datepicker( $.datepicker.regional[ "fr" ] );
});
</script>
</head>
<?php
// include des fonctions de contrôle
include("includes/utilitaires.php");
// connexion à la base de données
include("includes/accesBDD.php");
?>
<body>
<?php
// début de page et bandeau
include("includes/debutPageEtBandeau.php");
// ajout menu
include("includes/menuApresConnexion.php");
// ajout actualités
include("includes/actualite.php");
?>
<div id="corps">
<h1 class="titrecentre">Consultation de la liste des stages</h1>
<?php
if (isset($_POST["themeStage"])) $themeStage = $_POST["themeStage"]; else $themeStage = "";
if (isset($_POST["nomPrenomVisiteur"])) $nomPrenomVisiteur = $_POST["nomPrenomVisiteur"]; else $nomPrenomVisiteur = "";
if (isset($_POST["dateDebut"])) $dateDebut = $_POST["dateDebut"]; else $dateDebut = "";
if (isset($_POST["dateFin"])) $dateFin = $_POST["dateFin"]; else $dateFin = "";
?>
Veuillez remplir un ou plusieurs champs ci-après pour affiner votre recherche :
<form id="consulterStageEmployeRH" action="formConsultationStageEmployeRH.php" method="post">
<table border="0">
<tr>
<td>
<label for="themeStage">Thème du stage :</label>
</td>
<td colspan="3">
<select name="themeStage" id="themeStage" onchange="this.form.submit();">
<option value="">Choisissez le thème du stage</option>
<?php
$requete = "select libelle from theme";
$result = $db->query($requete);
$ligne = $result->fetch_object();
while($ligne != false)
{
$cle = $ligne->libelle;
$valeur = $ligne->libelle;
if($cle == $themeStage)
echo"<option value=$cle selected='selected'>$valeur</option>";
else
echo"<option value=$cle>$valeur</option>";
$ligne = $result->fetch_object();
}
?>
</select>
</td>
</tr>
<tr>
<td>
<label for="nomPrenomVisiteur">Nom et Prénom du visiteur médical :</label>
</td>
<td colspan="3">
<select name="nomPrenomVisiteur" id="nomPrenomVisiteur" onchange="this.form.submit();">
<option value="">Choisissez le visiteur médical</option>
<?php
$requete = "select nom from personnel";
$result = $db->query($requete);
$ligne = $result->fetch_object();
while($ligne != false)
{
$cle = $ligne->nom;
$valeur1 = $ligne->nom;
if($cle == $nomPrenomVisiteur)
echo"<option value=$cle selected='selected'>$valeur1</option>";
else
echo"<option value=$cle>$valeur1</option>";
$ligne = $result->fetch_object();
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="dateDebut">Date début stage :</label></td>
<td><input type="text" id="dateDebut" name="dateDebut" value="<?php echo ($dateDebut) ;?>" onchange="this.form.submit();"/></td>
<td><label for="dateFin">Date fin stage :</label></td>
<td><input type="text" id="dateFin" name="dateFin" value="<?php echo ($dateFin) ;?>" onchange="this.form.submit();"/></td>
</tr>
<tr>
<td>Stage :</td>
<td>
<label for="passe">
<input type="checkbox" id="passe" name="passe"/> passé
</label>
</td>
<td>
<label for="enCours">
<input type="checkbox" id="enCours" name="enCours"/> en cours
</label>
</td>
<td>
<label for="aVenir">
<input type="checkbox" id="aVenir" name="aVenir"/> à venir
</label>
</td>
</tr>
</table>
</form>
<?php
$requete = "SELECT numStage, stage.libelle AS libelleStage, DATE_FORMAT(dateDebut,'%d/%m/%Y') AS dateDebut, DATE_FORMAT(dateFin,'%d/%m/%Y') AS dateFin, theme.libelle AS themeStage, dateLimite, nbMax, specialite.libelle AS libelleSpe
FROM stage, theme, specialite, inscrire, personnel
WHERE theme.id = stage.id_Theme
AND specialite.id = stage.id_Specialite
AND inscrire.numStage_Stage = stage.numStage
AND inscrire.id_Personnel = personnel.id ";
if (isset($_POST["themeStage"]) && $_POST["themeStage"] != "")
$requete .= " AND theme.libelle = '$themeStage'";
if (isset($_POST["nomPrenomVisiteur"]) && $_POST["nomPrenomVisiteur"] != "")
$requete .= " OR personnel.nom = '$nomPrenomVisiteur'";
if (isset($_POST["dateDebut"]) && $_POST["dateDebut"] != "")
$dateDebut = datefrus($_POST["dateDebut"]);
if (isset($_POST["dateFin"]) && $_POST["dateFin"] != "")
$dateFin = datefrus($_POST["dateFin"]);
$requete .= " OR stage.dateDebut = '$dateDebut' OR stage.dateFin = '$dateFin'";
echo $requete;
$result = $db->query($requete);
$nbLigne = $result->num_rows;
if($nbLigne == 0)
{
echo ("<script>alert('Il n\'y a pas de stage correspondant aux critères ! ')</script>");
}
else
{
?>
<div id = "listeStage">
<table>
<tr>
<th>Code</th>
<th>Libelle</th>
<th>Date début</th>
<th>Date fin</th>
<th>Thème</th>
<th>Date limite inscription</th>
<th>Nombre maximum participants</th>
<th>Spécialité</th>
</tr>
<?php
$ligne = $result->fetch_object();
while($ligne!= false)
{
$libelleStage = $ligne->libelleStage;
$dateDebut = $ligne->dateDebut;
$dateFin = $ligne->dateFin;
$dateLimite = $ligne->dateLimite;
$nbMax = $ligne->nbMax;
$libelleSpe = $ligne->libelleSpe;
$numStage = $ligne->numStage;
// on affiche le contenu de l'enregistrement obtenu
Echo "<tr><td>".$numStage."</td>";
Echo "<td>".$libelleStage."</td>";
Echo "<td>".$dateDebut."</td>";
Echo "<td>".$dateFin."</td>";
Echo "<td>".$themeStage."</td>";
Echo "<td>".$dateLimite."</td>";
Echo "<td>".$nbMax."</td>";
Echo "<td>".$libelleSpe."</td>";
$ligne= $result->fetch_object();
}
?>
</table>
<?php
}
// pied de page
include("includes/piedPage.php");
?>
</div>
</body>
</html> |
Partager