summaryrefslogtreecommitdiff
path: root/appli_3_alpha_old/app/poppersonne.php
blob: 3335c6bc61f8b16b5f4a05c0658ab768a0f5bf8d (plain)
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
<?php require_once('include/connect.inc.php'); ?>
<h2><?php
//Pour le choix du Titre : 
if(isset($_GET['idR'])) echo "Participants de la r&eacute;union"; 
	else
	if (isset($_GET['idL'])) echo "Modification de la liste" ; else echo "Cr&eacute;ation d'une liste";
?></h2>
<div class="popup_contenu">

<?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 "&nbsp;est priv&eacute;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>
<td>&nbsp;</td>
<td>Participants </td>
</tr>
<tr>
<td>
<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
	$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++)
		{
			$row = mysql_fetch_array($result);
			echo '<option value="'.$row[0].'">';
			echo $row[1];
			echo '</option>';
		}
	}
?>
</select>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<div id="divListe">
</div>
</td>
<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);" <?php if (!$isOwner) echo ' disabled' ;?>/>
</td>
<td>
<select name="participants" size="10" id="participants">
<?php 
	if (isset($_GET['idL']))
	{
		$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)
		{
			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>';
			}
		}
	}
?>
</select>
</td>
</tr>
</table>
<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/>
<?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');" />
</form>
</div>