Subversion Repositories Applications.projet

Rev

Rev 249 | Rev 336 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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