Subversion Repositories Applications.projet

Rev

Rev 444 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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