summaryrefslogtreecommitdiff
path: root/appli_3_alpha_old/include/je.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'appli_3_alpha_old/include/je.inc.php')
-rw-r--r--appli_3_alpha_old/include/je.inc.php60
1 files changed, 48 insertions, 12 deletions
diff --git a/appli_3_alpha_old/include/je.inc.php b/appli_3_alpha_old/include/je.inc.php
index 08861d5..e902a1a 100644
--- a/appli_3_alpha_old/include/je.inc.php
+++ b/appli_3_alpha_old/include/je.inc.php
@@ -3,15 +3,51 @@ require_once ('include/connect.inc.php');
function traiter_formulaire_valider_modif_personnes()
{
-
- $result = mysql_query("SELECT P.idP,P.courrielP FROM Appartenir A, Personne P WHERE P.idP = A.idP AND A.idL=".$_GET['idL']);
+ //Vérification a faire pour savoir si c'est bien le propriétaire ?!! $_SESSION['session_idP']
+ $tabParticipant = array();
+ if (isset($_GET['dataParticipants'])) $tabParticipant = $_GET['dataParticipants'];
+ $idL=-1;
+ if (!isset($_GET['idL']) && isset($_GET['listname']))
+ {
+ if (isset($_GET['isPrivate'])) $isPrivate = 'oui'; else $isPrivate = 'non';
+ $idL = list_new($_GET['listname'],$_GET['idP'],$isPrivate);
+ }
+ else {$idL = $_GET['idL'];}
+
+ if ($idL != -1) list_modif($idL,$tabParticipant);
+ }
+
+ function traiter_formulaire_delete_list()
+ {
+ //Vérification a faire pour savoir si c'est bien le propriétaire ?!! $_SESSION['session_idP']
+ if (isset($_GET['idL'])) list_delete($_GET['idL']);
+ }
+
+ function list_delete($idL)
+ {
+ $result = mysql_query("DELETE FROM Appartenir WHERE idL=$idL;");
+ $result = mysql_query("DELETE FROM Liste WHERE idL=$idL;");
+ }
+
+ function list_new($listname,$idP,$isPrivate)
+ {
+ $result = mysql_query("INSERT INTO Liste (libelleL,estPrivee,idP_Createur) VALUES ('$listname','$isPrivate',$idP)") or die (mysql_error());
+ if (mysql_affected_rows() > 0)
+ {
+ return (mysql_insert_id());
+ }
+ }
+
+ function list_modif($idL,$tabParticipant)
+ {
+ $result = mysql_query("SELECT P.idP,P.courrielP FROM Appartenir A, Personne P WHERE P.idP = A.idP AND A.idL=$idL") or die (mysql_error());
if (mysql_num_rows($result)>=0)
{
//Fabrication des trois tableaux
$tabOldPers = array();
$tabOldPersMail = array();
$tabNewPers = array();
- if (isset( $_GET['dataParticipants'] ) ) $tabNewPers = $_GET['dataParticipants'];
+ if (!empty($tabParticipant)) $tabNewPers = $tabParticipant;
for($i=0;$i<mysql_num_rows($result);$i++)
{
$row = mysql_fetch_array($result);
@@ -57,7 +93,7 @@ require_once ('include/connect.inc.php');
//Enleve les redondances d'idP
$tabAdd=array_unique($tabAdd);
//Envoie a la fonction d'ajout de personne
- list_add_pers($tabAdd,$_GET['idL']);
+ list_add_pers($tabAdd,$idL);
//Construction du tableau des participants a ajouter
$tabRemove = array();
@@ -66,7 +102,7 @@ require_once ('include/connect.inc.php');
if ($pers != NULL) $tabRemove[] = $pers;
}
//Envoie a la fonction de suppression de personne
- list_remove_pers($tabRemove,$_GET['idL']);
+ list_remove_pers($tabRemove,$idL);
}
@@ -103,7 +139,6 @@ require_once ('include/connect.inc.php');
else
{
$result = mysql_query("INSERT INTO Personne (courrielP,loginP) VALUES ('$persMail','$persMail')");
- //return (mysql_insert_id($result));
return (mysql_insert_id());
}
@@ -115,8 +150,8 @@ require_once ('include/connect.inc.php');
//Fonction qui affiche toutes les liste public ainsi que les liste privée possédées par idP
function generate_html_array_list ($idP)
{
- $result = mysql_query("SELECT idL,libelleL,estPrivee FROM Liste WHERE idP_Createur=$idP OR estPrivee='non' ORDER BY estPrivee");
- echo "<table>\n<tr>\n<th>Type</th>\n<th>Libell&eacute;</th>\n</tr>\n";
+ $result = mysql_query("SELECT idL,libelleL,estPrivee,idP_Createur FROM Liste WHERE idP_Createur=$idP OR estPrivee='non' ORDER BY estPrivee,libelleL");
+ echo "<table>\n<tr>\n<th>Supprimer</th>\n<th>Type</th>\n<th>Libell&eacute;</th>\n</tr>\n";
if (mysql_num_rows($result)>0)
{
@@ -124,12 +159,13 @@ require_once ('include/connect.inc.php');
{
$row = mysql_fetch_array($result);
echo "<tr>\n<td>";
- if ($row['estPrivee'] == 'oui') echo 'Priv&eacute;e' ; else echo 'Public';
+ if ($row['estPrivee'] == 'oui' || $row['idP_Createur']==$idP) echo "<a href=\"#\" onclick=\"loadid('popdeletelist.php?idL=".$row[0]."','popdeletelist',true);popon('popdeletelist')\"><img src=\"images/supprimer.png\" alt=\"Supprimer ".$row[1]."\" /></a></td>\n" ; else echo "</td>\n";
+ if ($row['estPrivee'] == 'oui') echo "<td>estPriv&eacute;e" ; else echo "<td>Public";
echo "</td>\n<td>";
- echo "<a href=\"#\" onclick=\"loadid('poppersonne.php?idR=2&amp;idL=".$row['idL']."&amp;idP_orga=$idP','poppersonne',true);popon('poppersonne')\">";
+ echo "<a href=\"#\" onclick=\"loadid('poppersonne.php?idL=".$row['idL']."&amp;idP_orga=".$idP."','poppersonne',true);popon('poppersonne')\">";
echo $row['libelleL'];
- echo "</a>\n";
- echo "</td>\n</tr>\n";
+ echo "</a></td>\n";
+ echo "</tr>\n";
}
}