Subversion Repositories Applications.projet

Rev

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

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