Subversion Repositories Applications.projet

Rev

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

Rev 379 Rev 380
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.9 2008-09-01 14:38:34 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.9 $
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
 
45
 
46
$res = '' ;
46
$res = '' ;
47
$pair = true;
47
$pair = true;
48
$loggue = $this->_auth->getAuth();
48
$loggue = $this->_auth->getAuth();
49
$url = $this->_url->getURL(); 
49
$url = $this->_url->getURL(); 
50
 
50
 
51
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
51
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
52
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
52
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
53
$projet = new projet ($this->_db, $this->_id_projet) ;
53
$projet = new projet ($this->_db, $this->_id_projet) ;
54
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
54
//$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
55
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
55
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
56
$participants = new participe($this->_db) ;
56
$participants = new participe($this->_db) ;
57
 
57
 
58
// 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
59
if (isset($_REQUEST['statut'])) {
59
if (isset($_REQUEST['statut'])) {
60
    $participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
60
    $participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
61
    
61
    
62
    // Si désinscription de l'utilisateur (statut 4)
62
    // Si désinscription de l'utilisateur (statut 4)
63
    if ($_REQUEST['statut'] == 4) {
63
    if ($_REQUEST['statut'] == 4) {
64
	    $projet->getListesAssociees() ;
64
	    $projet->getListesAssociees() ;
65
	    if ($projet->avoirListe()) {
65
	    if ($projet->avoirListe()) {
66
	        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
66
	        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
67
	        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
67
	        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
68
	        $annuaire->setId($_GET['id_utilisateur']) ;
68
	        $annuaire->setId($_GET['id_utilisateur']) ;
69
	        
69
	        
70
	        // on désinscrit l'utilisateur des listes associées au projet
70
	        // on désinscrit l'utilisateur des listes associées au projet
71
			include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
71
			include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
72
       	 	$desinscription= new inscription_liste($this->_db) ;
72
       	 	$desinscription= new inscription_liste($this->_db) ;
73
       		$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
73
       		$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
-
 
74
       		
-
 
75
	    }
-
 
76
    }
74
}
77
}
75
// On teste ici s'il y a une mise a jour de l inscription a la liste
78
// On teste ici s'il y a une mise a jour de l inscription a la liste
76
if (isset($_POST['inscription_liste'])) {
79
if (isset($_POST['inscription_liste'])) {
77
    $projet->getListesAssociees();
80
    $projet->getListesAssociees();
78
    include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
81
    include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
79
    $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
82
    $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
80
    $annuaire->setId($_GET['id_utilisateur']) ;
83
    $annuaire->setId($_GET['id_utilisateur']) ;
81
    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
84
    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
82
    $inscription= new inscription_liste($this->_db) ;
85
    $inscription= new inscription_liste($this->_db) ;
83
    if ($_POST['inscription_liste'] == 1) {
86
    if ($_POST['inscription_liste'] == 1) {
84
    	$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
87
    	$inscription->inscrireUtilisateur($annuaire, $projet->_listes_associes[0], 2) ; // 2 est le statut d inscription normale
85
    } else {
88
    } else {
86
    	$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
89
    	$inscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
87
    }
90
    }
88
}
91
}
89
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
92
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
90
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
93
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
91
if (isset($_POST['mail_utilisateur'])) {
94
if (isset($_POST['mail_utilisateur'])) {
92
    $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
95
    $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
93
    $resultat = $this->_db->query ($requete) ;
96
    $resultat = $this->_db->query ($requete) ;
94
    if (DB::isError ($resultat)) {
97
    if (DB::isError ($resultat)) {
95
        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
98
        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
96
    }
99
    }
97
    if (!$resultat->numRows()) {
100
    if (!$resultat->numRows()) {
98
        $msg = PROJET_MAIL_ABSENT;
101
        $msg = PROJET_MAIL_ABSENT;
99
    } else {
102
    } else {
100
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
103
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
101
        // Le statut 2 est le statut participant
104
        // Le statut 2 est le statut participant
102
        
105
        
103
        $participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
106
        $participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
104
    }
107
    }
105
}
108
}
106
 
109
 
107
if ($this->_auth->getAuth()) {
110
if ($this->_auth->getAuth()) {
108
    $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
111
    $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
109
    if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
112
    if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
110
    if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
113
    if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
111
    if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
114
    if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
112
    if ($statut == 4) {
115
    if ($statut == 4) {
113
    	$droits = PROJET_DROIT_AUCUN ;
116
    	$droits = PROJET_DROIT_AUCUN ;
114
    	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
117
    	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
115
    	$lien_inscription = $this->_url->getURL();
118
    	$lien_inscription = $this->_url->getURL();
116
		$label_url_inscription = 'S\'inscrire &agrave; ce projet';	
119
		$label_url_inscription = 'S\'inscrire &agrave; ce projet';	
117
    }
120
    }
118
    if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
121
    if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
119
    
122
    
120
    if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
123
    if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
121
        
124
        
122
        $res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
125
        $res = PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
123
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
126
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
124
        if (isset ($msg) && $msg != '') {
127
        if (isset ($msg) && $msg != '') {
125
            $res .= '<div>'.$msg.'</div>' ;
128
            $res .= '<div>'.$msg.'</div>' ;
126
        }
129
        }
127
        $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
130
        $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
128
        $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
131
        $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
129
        $res .= '</form><br />'."\n" ;
132
        $res .= '</form><br />'."\n" ;
130
    }
133
    }
131
    
134
    
132
    
135
    
133
    // Mise en place de l'url
136
    // Mise en place de l'url
134
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
137
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
135
    
138
    
136
    // Construction de l'entete
139
    // Construction de l'entete
137
    
140
    
138
	
141
	
139
    $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
142
    $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
140
	$nombre_participants = count ($info_utilisateur);
143
	$nombre_participants = count ($info_utilisateur);
141
    
144
    
142
    include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
145
    include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
143
    
146
    
144
    if ($projet->avoirListe()) {
147
    if ($projet->avoirListe()) {
145
    	/** recuperation des abonnees a la liste */
148
    	/** recuperation des abonnees a la liste */
146
    	include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
149
    	include_once PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php';
147
    	
150
    	
148
    	$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
151
    	$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_listes_associes[0]->getDomaine(),
149
    			 $projet->_listes_associes[0]->getNom());
152
    			 $projet->_listes_associes[0]->getNom());
150
    	$ezmlm->load();
153
    	$ezmlm->load();
151
    	
154
    	
152
    	$tableau_mail = $ezmlm->parse();
155
    	$tableau_mail = $ezmlm->parse();
153
 
156
 
154
    	for ($i = 0; $i < count ($info_utilisateur); $i++) {
157
    	for ($i = 0; $i < count ($info_utilisateur); $i++) {
155
    		$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
158
    		$tableau_mail_utilisateur[$info_utilisateur[$i][3]] = $i;
156
    		$info_utilisateur[$i][6] = 0;  // Initialisation du tableau avec la valeur 0
159
    		$info_utilisateur[$i][6] = 0;  // Initialisation du tableau avec la valeur 0
157
    	}
160
    	}
158
    	
161
    	
159
    	foreach ($tableau_mail->children() as $email) {
162
    	foreach ($tableau_mail->children() as $email) {
160
    		$email = (string) $email;
163
    		$email = (string) $email;
161
    		if (isset($tableau_mail_utilisateur[$email])) {
164
    		if (isset($tableau_mail_utilisateur[$email])) {
162
    			$id = (int) $tableau_mail_utilisateur[$email];
165
    			$id = (int) $tableau_mail_utilisateur[$email];
163
    			$info_utilisateur[$id][6] = 1;
166
    			$info_utilisateur[$id][6] = 1;
164
    		} 
167
    		} 
165
    	}
168
    	}
166
    }
169
    }
167
    $statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
170
    $statuts = statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db);
168
    $statuts_inscription_liste[0] = 'non inscrit';
171
    $statuts_inscription_liste[0] = 'non inscrit';
169
    $statuts_inscription_liste[1] = 'inscrit';
172
    $statuts_inscription_liste[1] = 'inscrit';
170
    
173
    
171
} else {
174
} else {
172
    $droits = PROJET_DROIT_AUCUN ;
175
    $droits = PROJET_DROIT_AUCUN ;
173
    GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
176
    GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
174
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
177
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
175
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
178
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
176
			'animatedcollapse.init();' ."\n");
179
			'animatedcollapse.init();' ."\n");
177
	$lien_login = '#';
180
	$lien_login = '#';
178
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
181
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
179
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
182
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
180
}
183
}
181
 
184
 
182
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
185
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_LISTE_PARTICIPANT;
183
//$retour .= $titre.$res.$xml; ;
186
//$retour .= $titre.$res.$xml; ;
184
 
187
 
185
 
188
 
186
 
189
 
187
ob_start();
190
ob_start();
188
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
191
include_once PROJET_CHEMIN_APPLI.'/squelettes/participants.tpl.html';
189
$retour .= ob_get_contents();
192
$retour .= ob_get_contents();
190
ob_end_clean();
193
ob_end_clean();
191
 
194
 
192
 
195
 
193
$this->_url->removeQueryString ('statut');
196
$this->_url->removeQueryString ('statut');
194
$this->_url->removeQueryString ('id_utilisateur');
197
$this->_url->removeQueryString ('id_utilisateur');
195
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
198
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
196
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
199
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
197
 
200
 
198
 
201
 
199
/* +--Fin du code ----------------------------------------------------------------------------------------+
202
/* +--Fin du code ----------------------------------------------------------------------------------------+
200
*
203
*
201
* $Log: not supported by cvs2svn $
204
* $Log: not supported by cvs2svn $
202
* Revision 1.8  2008-08-25 15:02:49  alexandre_tb
205
* Revision 1.8  2008-08-25 15:02:49  alexandre_tb
203
* mise en place des squelettes
206
* mise en place des squelettes
204
*
207
*
205
*
208
*
206
* +-- Fin du code ----------------------------------------------------------------------------------------+
209
* +-- Fin du code ----------------------------------------------------------------------------------------+
207
*/
210
*/
208
?>
211
?>