diff options
Diffstat (limited to 'appli_3_alpha_old/poppersonne.php')
-rw-r--r-- | appli_3_alpha_old/poppersonne.php | 75 |
1 files changed, 59 insertions, 16 deletions
diff --git a/appli_3_alpha_old/poppersonne.php b/appli_3_alpha_old/poppersonne.php index bb1e74c..3335c6b 100644 --- a/appli_3_alpha_old/poppersonne.php +++ b/appli_3_alpha_old/poppersonne.php @@ -1,7 +1,39 @@ <?php require_once('include/connect.inc.php'); ?> -<h2>Participants de la réunion</h2> +<h2><?php +//Pour le choix du Titre : +if(isset($_GET['idR'])) echo "Participants de la réunion"; + else + if (isset($_GET['idL'])) echo "Modification de la liste" ; else echo "Création d'une liste"; +?></h2> <div class="popup_contenu"> -<form id="formpersonne" action="" method="get" onsubmit="return dataListe('participants','dataParticipants');"> + +<?php +//Pour la création de la liste et initialisation du propriétaire +echo "<form id=\"formpersonne\" action=\"\" method=\"get\" onsubmit=\"return ("; +$isOwner= false; + +if (!isset($_GET['idL'])) +{ + echo "(true==(isNotEmpty('listname') & "; + echo "dataListe('participants','dataParticipants'))));\">"; + echo "Nom de la liste : <input type=\"text\" name=\"listname\" id=\"listname\" />\n"; + echo " est privée : <input type=\"checkbox\" name=\"isPrivate\" checked/><br/><br/>\n"; + echo "<input type=\"hidden\" name=\"idP\" value=\"".$_GET['idP_orga']."\" />\n"; + $isOwner = true; +} +else +{ + echo "dataListe('participants','dataParticipants'));\">"; + if (isset($_GET['idR'])) $req = "SELECT * FROM Liste L,Reunion R WHERE (L.idP_Createur=".$_GET['idP_orga']." OR R.idP_Orga=".$_GET['idP_orga'].") AND R.idL=L.idL"; + else $req = "SELECT * FROM Liste L,Reunion R WHERE L.idL=".$_GET['idL']." AND L.idP_Createur=".$_GET['idP_orga']; + $result = mysql_query($req); + if (mysql_num_rows($result)>0) + { + $isOwner = true; + } +} + +?> <table> <tr> <td>Contacts disponibles </td> @@ -10,11 +42,14 @@ </tr> <tr> <td> -<select name="listeDispo" id="listeDispo" onChange="loadlist('poppersonneliste.php?idL=','listeDispo','divListe');"> +<select name="listeDispo" id="listeDispo" onChange="loadlist('poppersonneliste.php?idL=','listeDispo','divListe');" <?php if (!$isOwner) echo ' disabled' ;?>> <option value="None">Choisir ...</option> <option value="Tous">Tous</option> -<?php - $result = mysql_query("SELECT idL,libelleL,estPrivee FROM Liste WHERE (idP_Createur=".$_GET['idP_orga']." OR estPrivee='non') AND idL <>".$_GET['idL']." ORDER BY estPrivee"); +<?php + $req = "SELECT idL,libelleL,estPrivee FROM Liste WHERE (idP_Createur=".$_GET['idP_orga']." OR estPrivee='non')"; + if (isset($_GET['idL'])) $req .= " AND idL <>".$_GET['idL']; + $req .= " ORDER BY estPrivee"; + $result = mysql_query($req); if (mysql_num_rows($result)>0) { for($i=0;$i<mysql_num_rows($result);$i++) @@ -36,22 +71,29 @@ <div id="divListe"> </div> </td> -<td><input name="AjouterParticipant" type="button" id="AjouterParticipant" value="Ajouter" onclick="addPers(this.form);"/> +<td> +<input name="AjouterParticipant" type="button" id="AjouterParticipant" value="Ajouter" onclick="addPers(this.form);" <?php if (!$isOwner) echo ' disabled' ;?>/><br/> <br/> +<input name="AjouterTous" type="button" id="AjouterTous" value="Ajouter Tous" onclick="addAllPers(this.form);" <?php if (!$isOwner) echo ' disabled' ;?> /><br/> <br/> -<input name="supprimerParticipant" type="button" id="supprimerParticipant" value="Retirer" onclick="removePers(this.form);"/></td> +<input name="supprimerParticipant" type="button" id="supprimerParticipant" value="Retirer" onclick="removePers(this.form);" <?php if (!$isOwner) echo ' disabled' ;?>/> +</td> <td> <select name="participants" size="10" id="participants"> <?php - $result = mysql_query("SELECT P.idP,P.courrielP,P.nomP,P.prenomP FROM Personne P,Appartenir A WHERE P.idP=A.idP AND A.idL=".$_GET['idL']); - if (mysql_num_rows($result)>0) + if (isset($_GET['idL'])) { - for($i=0;$i<mysql_num_rows($result);$i++) + $req = "SELECT P.idP,P.courrielP,P.nomP,P.prenomP FROM Personne P,Appartenir A WHERE P.idP=A.idP AND A.idL=".$_GET['idL']; + $result = mysql_query($req); + if (mysql_num_rows($result)>0) { - $row = mysql_fetch_array($result); - echo '<option value="'.$row[0].'">'; - if ($row[2] !== "" & $row[3] !== "") echo $row[2] . " " . $row[3]; else echo $row[1]; - echo '</option>'; + for($i=0;$i<mysql_num_rows($result);$i++) + { + $row = mysql_fetch_array($result); + echo '<option value="'.$row[0].'">'; + if ($row[2] !== "" & $row[3] !== "") echo $row[2] . " " . $row[3]; else echo $row[1]; + echo '</option>'; + } } } ?> @@ -59,9 +101,10 @@ </td> </tr> </table> -<input type="text" name="courriel" id="courriel" value="" size="30" /><input type="button" value="inscrire" onclick="newPers(this.form);" /> +<br/> +<input type="text" name="courriel" id="courriel" value="" size="30" <?php if (!$isOwner) echo ' disabled' ;?>/><input type="button" value="inscrire" onclick="newPers(this.form);" <?php if (!$isOwner) echo ' disabled' ;?>/> <br/><br/> -<input type="hidden" name="idL" value="<?php echo $_GET['idL'];?>" /> +<?php if (isset($_GET['idL'])) echo '<input type="hidden" name="idL" value="'.$_GET['idL'].'" />'; ?> <?php if (isset($_GET['idR'])) echo '<input type="hidden" name="idR" value="'.$_GET['idR'].'" />'; ?> <input type="hidden" name="action" value="valider_modif_personnes" /> <input type="submit" name="Submit" value="Valider" /><input type="button" value="Fermer" onclick="popoff('poppersonne');" /> |