Subversion Repositories Applications.projet

Rev

Rev 294 | Rev 377 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 294 Rev 336
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: participants.php,v 1.8 2008-08-25 15:02:49 alexandre_tb Exp $
22
// CVS : $Id: participants.php,v 1.9 2008-09-01 14:38:34 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* Action participants
26
* Action participants
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
33
*@copyright     Tela-Botanica 2000-2005
34
*@version       $Revision: 1.8 $
34
*@version       $Revision: 1.9 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
42
// RAPPEL IMPORTANT
42
// RAPPEL IMPORTANT
43
// On se situe dans la methode run() de la classe projetControleur
43
// On se situe dans la methode run() de la classe projetControleur
44
//
44
//
45
 
-
 
46
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
-
 
47
 
45
 
48
$res = '' ;
46
$res = '' ;
49
$pair = true;
47
$pair = true;
50
$loggue = $this->_auth->getAuth();
48
$loggue = $this->_auth->getAuth();
51
$url = $this->_url->getURL(); 
49
$url = $this->_url->getURL(); 
52
 
50
 
53
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
51
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
54
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
52
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
55
$projet = new projet ($this->_db, $this->_id_projet) ;
53
$projet = new projet ($this->_db, $this->_id_projet) ;
56
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
54
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
57
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
55
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
58
$participants = new participe($this->_db) ;
56
$participants = new participe($this->_db) ;
59
 
57
 
60
// On teste ici s'il y a une mise a jour de statut
58
// On teste ici s'il y a une mise a jour de statut
61
if (isset($_REQUEST['statut'])) {
59
if (isset($_REQUEST['statut'])) {
62
    $participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
60
    $participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
63
    $projet->getListesAssociees() ;
61
    $projet->getListesAssociees() ;
64
    if ($projet->avoirListe()) {
62
    if ($projet->avoirListe()) {
65
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
63
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
66
        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
64
        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
67
        $annuaire->setId($_GET['id_utilisateur']) ;
65
        $annuaire->setId($_GET['id_utilisateur']) ;
68
        include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
66
        include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
69
        $desinscription= new inscription_liste($this->_db) ;
67
        $desinscription= new inscription_liste($this->_db) ;
70
        $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
68
        $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
71
    }
69
    }
72
}
70
}
73
// On teste ici s'il y a une mise a jour de l inscription a la liste
71
// On teste ici s'il y a une mise a jour de l inscription a la liste
74
if (isset($_POST['inscription_liste'])) {
72
if (isset($_POST['inscription_liste'])) {
75
    $projet->getListesAssociees();
73
    $projet->getListesAssociees();
76
    include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
74
    include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
77
    $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
75
    $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
78
    $annuaire->setId($_GET['id_utilisateur']) ;
76
    $annuaire->setId($_GET['id_utilisateur']) ;
79
    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
77
    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
80
    $inscription= new inscription_liste($this->_db) ;
78
    $inscription= new inscription_liste($this->_db) ;
81
    if ($_POST['inscription_liste'] == 1) {
79
    if ($_POST['inscription_liste'] == 1) {
82
    	$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
80
    	$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
83
    } else {
81
    } else {
84
    	$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
82
    	$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
85
    }
83
    }
86
}
84
}
87
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
85
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
88
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
86
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
89
if (isset($_POST['mail_utilisateur'])) {
87
if (isset($_POST['mail_utilisateur'])) {
90
    $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
88
    $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
91
    $resultat = $this->_db->query ($requete) ;
89
    $resultat = $this->_db->query ($requete) ;
92
    if (DB::isError ($resultat)) {
90
    if (DB::isError ($resultat)) {
93
        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
91
        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
94
    }
92
    }
95
    if (!$resultat->numRows()) {
93
    if (!$resultat->numRows()) {
96
        $msg = PROJET_MAIL_ABSENT;
94
        $msg = PROJET_MAIL_ABSENT;
97
    } else {
95
    } else {
98
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
96
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
99
        // Le statut 2 est le statut participant
97
        // Le statut 2 est le statut participant
100
        
98
        
101
        $participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
99
        $participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
102
    }
100
    }
103
}
101
}
104
 
102
 
105
if ($this->_auth->getAuth()) {
103
if ($this->_auth->getAuth()) {
106
    $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
104
    $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
107
    if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
105
    if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
108
    if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
106
    if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
109
    if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
107
    if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
110
    if ($statut == 4) {
108
    if ($statut == 4) {
111
    	$droits = PROJET_DROIT_AUCUN ;
109
    	$droits = PROJET_DROIT_AUCUN ;
112
    	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
110
    	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
113
    	$lien_inscription = $this->_url->getURL();
111
    	$lien_inscription = $this->_url->getURL();
114
		$label_url_inscription = 'S\'inscrire &agrave; ce projet';	
112
		$label_url_inscription = 'S\'inscrire &agrave; ce projet';	
115
    }
113
    }
116
    if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
114
    if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
117
    
115
    
118
    if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
116
    if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
119
        
117
        
120
        $res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
118
        $res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
121
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
119
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
122
        if (isset ($msg) && $msg != '') {
120
        if (isset ($msg) && $msg != '') {
123
            $res .= '<div>'.$msg.'</div>' ;
121
            $res .= '<div>'.$msg.'</div>' ;
124
        }
122
        }
125
        $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
123
        $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
126
        $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
124
        $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
127
        $res .= '</form><br />'."\n" ;
125
        $res .= '</form><br />'."\n" ;
128
    }
126
    }
129
    
-
 
130
    $HTML_listeParticipants = new HTML_listeParticipants(true) ;
-
 
-
 
127
    
131
    if ($droits <= PROJET_DROIT_COORDINATEUR) $HTML_listeParticipants->setModeModification() ;
128
    
132
    // Mise en place de l'url
129
    // Mise en place de l'url
133
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
-
 
-
 
130
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
134
    $HTML_listeParticipants->setURL($this->_url) ;
131
    
135
    // Construction de l'entete
-
 
136
    $entete = array (PROJET_NOM, PROJET_PRENOM, PROJET_MAIL, PROJET_DATE_INSCRIPTION, PROJET_STATUT) ;
-
 
-
 
132
    // Construction de l'entete
-
 
133
    
137
	if ($projet->avoirListe() && $droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($entete, PROJET_LISTE_DE_DISCUSSION);
134
	
138
    $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
135
    $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
139
	$nombre_participants = count ($info_utilisateur);
-
 
-
 
136
	$nombre_participants = count ($info_utilisateur);
140
    $HTML_listeParticipants->construitEntete($entete) ;
137
    
141
    include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
138
    include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
142
    
139
    
143
    if ($projet->avoirListe()) {
140
    if ($projet->avoirListe()) {
144
    	/** recuperation des abonnees a la liste */
141
    	/** recuperation des abonnees a la liste */
145
    	include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
142
    	include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
146
    	
143
    	
147
    	$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
144
    	$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
148
    			 $projet->_listes_associes[0]->getNom());
145
    			 $projet->_listes_associes[0]->getNom());
149
    	$ezmlm->load();
146
    	$ezmlm->load();
150
    	ob_start();
-
 
-
 
147
    	
151
    	$tableau_mail = $ezmlm->parse();
148
    	$tableau_mail = $ezmlm->parse();
152
    	$xml = ob_get_contents();
-
 
153
    	ob_end_clean();
-
 
-
 
149
 
154
    	for ($i = 0; $i < count ($info_utilisateur); $i++) {
150
    	for ($i = 0; $i < count ($info_utilisateur); $i++) {
155
    		$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
151
    		$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
156
    		$info_utilisateur[$i][6] = 0;  // Initialisation du tableau avec la valeur 0
152
    		$info_utilisateur[$i][6] = 0;  // Initialisation du tableau avec la valeur 0
157
    	}
153
    	}
158
    	
154
    	
159
    	foreach ($tableau_mail->children() as $email) {
155
    	foreach ($tableau_mail->children() as $email) {
160
    		$email = (string) $email;
156
    		$email = (string) $email;
161
    		if (isset($tableau_mail_utilisateur[$email])) {
157
    		if (isset($tableau_mail_utilisateur[$email])) {
162
    			$id = (int) $tableau_mail_utilisateur[$email];
158
    			$id = (int) $tableau_mail_utilisateur[$email];
163
    			$info_utilisateur[$id][6] = 1;
159
    			$info_utilisateur[$id][6] = 1;
164
    		} 
160
    		} 
165
    	}
161
    	}
166
    	//trigger_error(print_r ($info_utilisateur, true));
-
 
167
    	
-
 
168
    }
162
    }
169
    $statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
163
    $statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
170
    $statuts_inscription_liste[0] = 'non inscrit';
164
    $statuts_inscription_liste[0] = 'non inscrit';
171
    $statuts_inscription_liste[1] = 'inscrit';
165
    $statuts_inscription_liste[1] = 'inscrit';
172
    $HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db), $projet) ;
-
 
173
    
-
 
174
    $res .= $HTML_listeParticipants->toHTML() ;
-
 
175
    
-
 
176
    
166
    
177
} else {
167
} else {
178
    $droits = PROJET_DROIT_AUCUN ;
168
    $droits = PROJET_DROIT_AUCUN ;
179
    GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
169
    GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
180
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
170
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
181
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
171
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
182
			'animatedcollapse.init();' ."\n");
172
			'animatedcollapse.init();' ."\n");
183
	$lien_login = '#';
173
	$lien_login = '#';
184
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
174
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
185
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
175
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
186
}
176
}
187
 
177
 
188
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
178
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
189
//$retour .= $titre.$res.$xml; ;
179
//$retour .= $titre.$res.$xml; ;
190
 
180
 
191
 
181
 
192
 
182
 
193
ob_start();
183
ob_start();
194
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
184
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
195
$retour .= ob_get_contents();
185
$retour .= ob_get_contents();
196
ob_end_clean();
186
ob_end_clean();
197
 
187
 
198
 
188
 
199
$this->_url->removeQueryString ('statut');
189
$this->_url->removeQueryString ('statut');
200
$this->_url->removeQueryString ('id_utilisateur');
190
$this->_url->removeQueryString ('id_utilisateur');
201
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
191
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
202
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
192
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
203
 
193
 
204
 
194
 
205
/* +--Fin du code ----------------------------------------------------------------------------------------+
195
/* +--Fin du code ----------------------------------------------------------------------------------------+
206
*
196
*
207
* $Log: not supported by cvs2svn $
197
* $Log: not supported by cvs2svn $
-
 
198
* Revision 1.8  2008-08-25 15:02:49  alexandre_tb
-
 
199
* mise en place des squelettes
-
 
200
*
208
*
201
*
209
* +-- Fin du code ----------------------------------------------------------------------------------------+
202
* +-- Fin du code ----------------------------------------------------------------------------------------+
210
*/
203
*/
211
?>
204
?>