D:\LOCALHOST\www\Admin BLISS\includes
Transcription
D:\LOCALHOST\www\Admin BLISS\includes
1 <style type="text/css"> 2 <!-3 #Layer1 { 4 position:absolute; 5 background:#FFFFFF; 6 padding:10px; 7 width:900px; 8 border:3px solid #000; 9 height:450px; 10 z-index:1; 11 visibility:hidden; 12 top:50px; 13 left:50px; 14 } 15 --> 16 </style> 17 <script type="text/JavaScript"> 18 <!-19 function MM_findObj(n, d) { //v4.01 20 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 21 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 22 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 23 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 24 if(!x && d.getElementById) x=d.getElementById(n); return x; 25 } 26 27 function MM_showHideLayers() { //v6.0 28 var i,p,v,obj,args=MM_showHideLayers.arguments; 29 for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; 30 if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; } 31 obj.visibility=v; } 32 } 33 //--> 34 </script> 35 36 <h2>Liste des contacts </h2> 37 38 <?php 39 if(isset($_POST['ajouter_interlocuteur'])){ 40 //--------------------------------------------41 // INSERTION dans la table interlocuteurs 42 //--------------------------------------------43 $requete= "INSERT INTO interlocuteurs "; 44 $requete .= "( "; 45 $requete .= "id_interlocuteur, "; 46 $requete .= "client, "; 47 $requete .= "projet, "; 48 $requete .= "nom, "; 49 $requete .= "prenom, "; 50 $requete .= "fonction, "; 51 $requete .= "bureau, "; 52 $requete .= "mail_bureau, "; 53 $requete .= "mail_perso, "; 54 $requete .= "tel, "; 55 $requete .= "mobile, "; 56 $requete .= "commentaire, "; 57 $requete .= "date, "; 58 $requete .= "heure "; 59 $requete .= ") "; 60 $requete .= "VALUES "; 61 $requete .= "( "; 62 $requete .= "'', "; 63 $requete .= "'".$_POST['client']."', "; 64 $requete .= "'".$_POST['projet']."',"; 65 $requete .= "'".$_POST['nom']."', "; 66 $requete .= "'".$_POST['prenom']."',"; 67 $requete .= "'".$_POST['fonction']."',"; 68 $requete .= "'".$_POST['bureau']."',"; 69 $requete .= "'".$_POST['mail_bureau']."'," ; 70 $requete .= "'".$_POST['mail_perso']."',"; 71 $requete .= "'".$_POST['tel']."',"; 72 $requete .= "'".$_POST['mobile']."',"; 73 $requete .= "'".$_POST['commentaire']."',"; 74 $requete .= "'".date("d/m/Y")."',"; 75 $requete .= "'".date("H:i:s")."' "; 76 $requete .= " ) "; 77 $connexion -> query($requete); 78 unset($requete); 79 } 80 81 if(isset($_GET['suppr_contact'])){ 82 //--------------------------------------------83 // SUPPRESSION interlocuteur 84 //--------------------------------------------85 $requete = "DELETE FROM interlocuteurs "; 86 $requete .= " WHERE id_interlocuteur = '".$_GET['id_contact']."' "; 87 $connexion -> query($requete); D:\LOCALHOST\www\Admin BLISS\includes\ajout_interlocuteur.inc.php: 1/4 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 unset($requete); } ?> <div id="Layer1" onfocus="MM_showHideLayers('Layer1','','inherit')"> <div align="right"><a href="#" onclick="MM_showHideLayers('Layer1','','hide')"><img src="images/fermer_ popup.jpg" /></a> </div> <h2>Ajouter un contact</h2> <form action="" enctype="multipart/form-data" method="post" onsubmit="return(Close_Fenetre());"> <input type="hidden" name="ajouter_interlocuteur"/> <div align="center" style="background:#D1D8DF"> <table width="90%" cellpadding="5" cellspacing="5" > <tr> <td width="50%" valign="top"> <table width="100%"> <?php if(isset($_GET['denomination'])){ ?> <tr> <td width="20%"><label>Client</label></td> <td ><input type="text" name="client" value="<?php echo $_GET['denomination']; ?>" style="border:none "/></td> 114 </tr> 115 <?php 116 } 117 else{?> 118 <td width="20%"><label>Client</label></td> 119 <td> 120 <select name="client"> 121 <?php 122 $requete = "SELECT denomination "; 123 $requete .= " FROM clients "; 124 $requete .= " ORDER BY id_client ASC "; 125 $connexion -> query($requete); 126 while($line = $connexion -> fetch_assoc()) 127 { 128 $denomination = $line['denomination']; 129 echo'<option value="'.$line['denomination'].'">'.$line['denomination'].'</option> '; 130 } 131 $connexion -> free_result($line); 132 unset($requete, $line); 133 ?> 134 </select> 135 <a href="?nouveau_client=1">[+]</a> 136 </td> 137 </tr> 138 <?php 139 } 140 ?> 141 <td><label>Projet</label></td> 142 <td> 143 <select name="projet"> 144 <?php 145 $requete = "SELECT DISTINCT denomination_projet "; 146 $requete .= " FROM projets "; 147 $requete .= " ORDER BY id_projet ASC "; 148 $connexion -> query($requete); 149 while($line = $connexion -> fetch_assoc()) 150 { 151 echo'<option value="'.$line['denomination_projet'].'">'.$line['denomination_proje t'].'</option>'; 152 } 153 $connexion -> free_result($line); 154 unset($requete, $line); 155 ?> 156 </select> 157 <a href="?ajouter_denomination=1&denomination_projet=<?php echo $d_p; ?>">[+]</a> 158 </td> 159 </tr> 160 <td><label>nom</label></td> 161 <td><input type="text" name="nom" size="40"/></td> 162 </tr> 163 <td><label>Prénom</label></td> 164 <td><input type="text" name="prenom" size="40"/></td> 165 </tr> 166 <td><label>Fonction</label></td> 167 <td><input type="text" name="fonction" size="50"/></td> 168 </tr> 169 <td><label>Bureau</label></td> 170 <td><input type="text" name="bureau" size="10"/></td> D:\LOCALHOST\www\Admin BLISS\includes\ajout_interlocuteur.inc.php: 2/4 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 </tr> </table> </td> <td width="50%" valign="top"> <table width="100%"> <tr> <td><label>Mail bureau</label></td> <td><input type="text" name="mail_bureau" size="50"/></td> </tr> <td><label>Mail perso</label></td> <td><input type="text" name="mail_perso" size="50"/></td> </tr> <td><label>Tél.</label></td> <td><input type="text" name="tel" size="20"/></td> </tr> <td><label>Mobile</label></td> <td><input type="text" name="mobile" size="20"/></td> </tr> </table> </td> </tr> <td colspan="2"> <label>Commentaires</label><br /> <textarea name="commentaire" rows="5" cols="50"></textarea> </form> </td> </tr> <td colspan="2" align="right"><input type="image" src="images/valider.jpg"/></td> </tr> </table> </div> </div> <table width="100%" cellpadding="0" cellspacing="0" class="tableau-accueil"> <tr> <td colspan="16" align="right"> <a href="#" onclick="MM_showHideLayers('Layer1','','show')"><img src="images/ajouter_contact .jpg" /></a> 212 </td> 213 </tr> 214 <tr class="titre"> 215 <td class="none"> </td> 216 <td class="none" >Nom</td> 217 <td class="none">Prénom</td> 218 <td class="none">Fonction</td> 219 <td class="none">Email bureau</td> 220 <td class="none">Email perso</td> 221 <td class="none">Tél.</td> 222 <td class="none">Mobile</td> 223 <td class="none">Fiche</td> 224 <td class="none">Supprimer</td> 225 <td class="none"> </td> 226 </tr> 227 <?php 228 //----------------------------------------------229 // LISTE DES CLIENTS, AFFICHES UNE SEULE FOIS 230 //----------------------------------------------231 $requete = "SELECT DISTINCT client "; 232 $requete .= " FROM interlocuteurs "; 233 $requete .= " ORDER BY client ASC "; 234 $connexion -> query($requete); 235 while($line = $connexion -> fetch_assoc()) 236 { 237 $cle = $line['client']; 238 //----------------------------------------------239 // POUR CHAQUE CLIENT ON AFFICHE LES CONTACTS 240 //----------------------------------------------241 foreach($line as $cle) 242 { 243 //----------------------------------------------244 // REQUETE D'AFFICHAGE DES CONTACTS 245 //----------------------------------------------246 $requete2 = "SELECT * "; 247 $requete2 .= " FROM interlocuteurs "; 248 $requete2 .= " WHERE client='".$cle."' ORDER BY id_interlocuteur ASC "; 249 $connexion2 -> query($requete2); 250 $nb_resultat = $connexion2 -> num_rows(); 251 if ($nb_resultat > 0) 252 { 253 //----------------------------------------------254 // Pour chaque client, un titre... 255 //----------------------------------------------256 echo ' D:\LOCALHOST\www\Admin BLISS\includes\ajout_interlocuteur.inc.php: 3/4 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 <tr> <td colspan="14" style="background:#EFEFE0; padding: 10px 0px 3px 10px;color:#4F4F27;font -size:12px"> <strong>'.$cle.'</strong> </td> </tr>'; //----------------------------------------------// LISTE DES CONTACTS //----------------------------------------------while($line2 = $connexion2 -> fetch_assoc()) { ?> <tr <?php echo switchcolor(); ?>> <td width="10"> </td> <td ><strong><?php echo $line2['nom']; ?></strong></td> <td ><strong><?php echo $line2['prenom']; ?></strong></td> <td ><a href="#" title="<?php echo $line['fonction']; ?>">Fonction</a></td> <td><a href="mailto:<?php echo $line2['mail_bureau']; ?>">@ Bureau</a></td> <td ><a href="mailto:<?php echo $line2['mail_perso']; ?>">@ Perso</a></td> <td ><?php echo $line2['tel']; ?></td> <td ><?php echo $line2['mobile']; ?></td> <td width="40"><a href="fiche_contact.php?id_contact=<?php echo $line2['id_interlocu teur']; ?>&projet=<?php echo $line2['projet']; ?>">[Fiche]</a></td> <td width="40" align="center"><a href="accueil.php?ajouter_interlocuteur=1&suppr_con tact=1&id_contact=<?php echo $line2['id_interlocuteur']; ?>" onclick="return confirm('Che(è)r(e) <?php echo $_SESSION['login'];?>, êtes vous certain(e) de vouloir supprimer ce contact ?');">[S]</a></td> <td width="10"> </td> </tr> <?php } $connexion2 -> free_result($line2); unset($requete2, $line2); } } } $connexion -> free_result($line); unset($requete, $line); ?> </table> D:\LOCALHOST\www\Admin BLISS\includes\ajout_interlocuteur.inc.php: 4/4