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
|
<?
include("config.inc.php");
session_start();
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Gestion des plannings Médiathèque Grand Troyes </title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Mise en place du jquery pour datepicker -->
<link rel="stylesheet" href="jquery-ui/css/start/jquery-ui-1.8.21.custom.css" type="text/css" />
<script src="jquery-ui/js/jquery-1.7.2.min.js"></script>
<script src="jquery-ui/js/jquery-ui-1.8.21.custom.min.js"></script>
<script>
$(document).ready(function(){
$('.date').datepicker();
});
</script>
<!-- Fin de la mise en place du jquery pour datepicker -->
</head>
<body>
<header>Gestion des absences</header>
<table>
<tr>
<form method="POST" action="" target="">
<td>Pour afficher la fiche de l'agent, merci de le sélectionner dans la liste</td>
<td><select name="agent" class="bouton">
<?
mysql_connect("localhost",USER,PASS);
mysql_select_db(BASE);
$req="SELECT * FROM agents ORDER BY nom ASC";
$result = mysql_query($req);
while($data=mysql_fetch_object($result))
{
echo "<option value='$data->id_agent' id='agent' onChange='javascript:document.getElementById('hidden').value=document.getElementById('agent').value'>$data->nom - $data->prenom</option>";
}
?>
</select></td>
<td><input type="submit" value="Afficher" class="bouton"/></td>
</form>
</tr>
</table>
<?
if(isset($_POST['agent'])) {
$req='SELECT nom,prenom,adresse,cp,ville,telfixe,telporta,email,nomcategorie,service FROM agents INNER JOIN categorie ON agents.id_cat_=categorie.id_cat INNER JOIN service ON agents.id_service_=service.id_service WHERE id_agent="'.$_POST['agent'].'"';
$result=mysql_query($req) or die ('Erreur SQL ! <br />'.$req.'<br />'.mysql_error());
$data=mysql_fetch_object($result);
$_SESSION['agent']=$data['id_agent'];
echo "<table>";
echo "<tr><td><p>Nom</p></td><td><p>";
echo $data->nom;
echo "</p></td><td rowspan='8'><p><a href='agent.php'><input type='button' value='Ajouter' class='bouton'/></a></p></td></tr><tr><td><p>Prénom</p></td><td><p>";
echo $data->prenom;
echo "</p></td></tr><tr><td><p>Adresse</p></td><td><p>";
echo $data->adresse." ".$data->cp." ".$data->ville;
echo "</p></td></tr><tr><td><p>Téléphone fixe</p></td><td><p>";
echo $data->telfixe;
echo "</p></td></tr><tr><td><p>Téléphone portable</p></td><td><p>";
echo $data->telporta;
echo "</p></td></tr><tr><td><p>Email</p></td><td><p>";
echo $data->email;
echo "</p></td></tr><tr><td><p>Catégorie</p></td><td><p>";
echo $data->nomcategorie;
echo "</p></td></tr><tr><td><p>Service</p></td><td><p>";
echo $data->service;
echo "</p></td></tr>";
echo "</table>";
}
?>
<table>
<form method="POST" action="" target="">
<td>Congés</td>
<input type="hidden" name="hidden" id="hidden" value=""/>
<td><input type="text" name="congesdeb" class="date"></td>
<td><input type="text" name="congesfin" class="date"></td>
<td><input type="submit" value="Modifier" class="bouton"/>
<?
mysql_connect("localhost",USER,PASS);
$congesdeb=mysql_real_escape_string($_POST['congesdeb']);
$congesfin=mysql_real_escape_string($_POST['congesfin']);
$test=mysql_select_db(BASE);
$req='INSERT INTO conges (congesdeb,congesfin) VALUES ($congesdeb,$congesfin) WHERE id_agent="'$_SESSION['agent']=$data['id_agent']'"';
$result=mysql_query($req) or die ('Erreur SQL ! <br />'.$req.'<br />'.mysql_error());
?>
</td>
<td><?
$req='SELECT * FROM conges INNER JOIN agents ON agents.id_conges_=conges.id_conges WHERE id_agent="'$_SESSION['agent']=$data['id_agent']'"';
$result = mysql_query($req);
$nb=mysql_num_rows($result);
$i=0;
while($i<$nb){
$data=mysql_fetch_object($result);
echo "du $data->congesdeb au $data->congesfin";
$i++;
}
?>
</td>
</form>
</tr>
</table>
<a href="accueil.php"><input type="button" value="Revenir" class="bouton"/></a>
</body>
</html> |
Partager