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
| <?php
include ('param_cas.php');
include ('param_ldap.php');
?>
<html>
<!--Une fois la connexion effectuée, on arrive à la page d'insertion de nouvelles fiches d'adresse -->
<head>
<title>Liste des fiches disponibles</title>
<script language="javascript">
// fonction pour le cas d'appui sur la touche entrée
function testsubmit() {
if (document.modif_fiche.action=="") return false;
return true ;
}
//fonction pour choisir l'action
function gopage(page)
{
document.modif_fiche.action = page;
document.modif_fiche.submit();
}
</script>
</head>
<h4><a href ="index.php">Index</a></h3>
</html>
<?php
$connect = ldap_connect($ldap_host, $ldap_port)
or die( "Impossible de se connecter au serveur LDAP $ldap_host" );
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
if ($connect){
$bind = ldap_bind($connect, $ldap_user, $ldap_pass)
or die(">>Impossible de se connecter sur $ldap_host<<");
$filtre_unix = "uid=$utilisateur";
$restriction_unix = array("groupeunix");
$search_unix = ldap_search($connect,"ou=annuaire,dc=entreprise,dc=fr" ,$filtre_unix,$restriction_unix);
$resultat_unix = ldap_get_entries($connect, $search_unix);
for ($i=0; $i<$resultat_unix["count"]; $i++){
$group_unix = $resultat_unix[$i]["groupeunix"][0];
}
// Recherche de toutes les fiches appartenant à l'utilisateur : fiche partagée et fiche personelle
$filtre = "(|(uid=$utilisateur)(groupeunix=$group_unix))";
$base_de_recherche = "ou=carnets,dc=entreprise,dc=fr";
$search = ldap_search($connect, $base_de_recherche ,$filtre);
$resultat = ldap_get_entries($connect, $search);
echo "<form name='modif_fiche' method='post' action='' onsubmit='return testsubmit()'>";
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //
// On choisit le type de fiches à consulter
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //
echo "<input type='radio' id='bouton_1' onclick= > <label for='bouton_1'>Ne voir que les fiches personnelles</label>
<br/>";
echo "<input type='radio' id='bouton_2' onclick= > <label for='bouton_2'>Ne voir que les fiches partagées</label>
<br/>";
echo "<input type='radio' id='bouton_3' onclick= > <label for='bouton_3'>Voir toutes les fiches</label>
<br/><br/>";
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //
echo "<table border='0' valign='center' cellpadding='0' cellspacing='0' height='100%' width='100%' >";
echo " <tr><td align='center'>
<table width='1200' bgcolor='#FFFFFF' border='2' cellpadding='2' cellspacing='2' bordercolor='#FF9900' frame='void'>
<tr><td>
<table width='400%' border='0' cellpadding='6' cellspacing=6'>
<tr><td align='center' colspan='0' bgcolor='#FF9900'>
<font color='black' face='Arial,Helvetica' size='6'>
<b>Liste des fiches de l'utilisateur : <i>$utilisateur</i></b>
</font>
</td></tr>
</td></tr>
<tr></tr>
<table width='100%' border='1' cellpadding='1' cellspacing='1' bordercolor='#FF9900' frame='hsides'>
<font color='black' face='Courier New, Courier, mono' size='4'>
<tr bgcolor='#FFCC33'><th>Prénom Nom </th>
<th>E-mail</th>
<th></th>
<th>Modifier</th>
<th>Supprimer</th>
</tr>
</font>";
for ($i=0; $i<$resultat["count"]; $i++){
$groups_unix = $resultat[$i]["groupeunix"][0];
$nom = $resultat[$i]["sn"][0];
$prenom = $resultat[$i]["givenname"][0];
$mail = $resultat[$i]["mail"][0];
$tel = $resultat[$i]["telephonenumber"][0];
$adresse = $resultat[$i]["street"][0];
$entreprise = $resultat[$i]["company"][0];
$codepostal = $resultat[$i]["postalcode"][0];
$ville = $resultat[$i]["l"][0];
$dn = $resultat[$i]["dn"];
$cn = $resultat[$i]["cn"][0];
$uid_perso = $resultat[$i]["uid"][0];
if ($groups_unix !=""){
$droit_fiche = "Grp";}
else $droit_fiche = "Perso";
// Caractères à afficher si les données ne sont pas renseignées
if ($nom == ""){
$nom = "...";}
if ($prenom == ""){
$prenom = "...";}
if ($mail == ""){
$mail = "...";}
if ($tel == ""){
$tel = "...";}
if ($adresse == ""){
$adresse = "...";}
if ($entreprise == ""){
$entreprise = "...";}
if ($codepostal == ""){
$codepostal = "...";}
if ($ville == ""){
$ville = "...";}
// Remplissage du tableau avec les informations obtenues
if ($droit_fiche == "Perso"){
echo "<tr bgcolor='#FFFFCC'>";}
elseif ($droit_fiche == "Grp"){
echo "<tr bgcolor='#99CCCC'>";}
echo " <th>$prenom $nom </th>
<th><a href ='mailto:$mail'>$mail</a></th>
<input name='prenom' id='perso' value='$prenom' type='hidden'>
<input name='nom' id='perso' value='$nom' type='hidden'>
<input name='mail' id='perso' value='$mail' type='hidden'>
<input name='tel' id='perso' value='$tel' type='hidden'>
<input name='entreprise' id='perso' value='$entreprise' type='hidden'>
<input name='adresse' id='perso' value='$adresse' type='hidden'>
<input name='codepostal' id='perso' value='$codepostal' type='hidden'>
<input name='ville' id='perso' value='$ville' type='hidden'>
<input name='droit_fiche' id='perso' value='$droit_fiche' type='hidden'>
<input name='dn' id='perso' value='$dn' type='hidden'>
<input name='cn' id='perso' value='$cn' type='hidden'>
<input name='uid' id='perso' value='$uid_perso' type='hidden'>
<input name='utilisateur' id='perso' value='$utilisateur' type='hidden'>
<input name='groupeunix' id='perso' value='$groups_unix' type='hidden'>";
echo " <th></th>
<th><input type='button' id='perso' value='Modifier' onClick=gopage('modifi.php')></th>
<th><input type='button' id='perso' value='Supprimer' onClick=gopage('suppr.php')></th>
</tr>"; }
}
echo "</table>";
echo "</form>";
// Fermeture de la connexion
ldap_close($connect);
?> |
Partager