Subversion Repositories Applications.projet

Rev

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

Rev 288 Rev 297
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
 
22
 
23
// CVS : $Id: projetControleur.class.php,v 1.42 2008-05-21 14:36:12 alexandre_tb Exp $
23
// CVS : $Id: projetControleur.class.php,v 1.43 2008-08-25 15:06:59 alexandre_tb Exp $
24
 
24
 
25
/**
25
/**
26
* Application projet
26
* Application projet
27
*
27
*
28
* La classe controleur projet
28
* La classe controleur projet
29
*
29
*
30
*@package projet
30
*@package projet
31
//Auteur original :
31
//Auteur original :
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.42 $
36
*@version       $Revision: 1.43 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
 
43
 
44
if (isset ($GLOBALS['lang'])) {
44
if (isset ($GLOBALS['lang'])) {
45
    /** le fichier de langue, par defaut PROJET_LANGUE_DEFAUT */
45
    /** le fichier de langue, par defaut PROJET_LANGUE_DEFAUT */
46
    include_once 'client/projet/langues/pro_langue_'.$GLOBALS['lang'].'.inc.php' ;
46
    include_once 'client/projet/langues/pro_langue_'.$GLOBALS['lang'].'.inc.php' ;
47
} else {
47
} else {
48
    include_once 'client/projet/langues/pro_langue_'.PROJET_LANGUE_DEFAUT.'.inc.php' ;
48
    include_once 'client/projet/langues/pro_langue_'.PROJET_LANGUE_DEFAUT.'.inc.php' ;
49
}
49
}
50
 
50
 
51
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
51
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
52
require_once GEN_CHEMIN_API.'html/HTML_TableFragmenteur.php' ;
52
require_once GEN_CHEMIN_API.'html/HTML_TableFragmenteur.php' ;
53
// +------------------------------------------------------------------------------------------------------+
53
// +------------------------------------------------------------------------------------------------------+
54
// |                                           LISTE des constantes                                       |
54
// |                                           LISTE des constantes                                       |
55
// +------------------------------------------------------------------------------------------------------+
55
// +------------------------------------------------------------------------------------------------------+
56
 
56
 
57
define ("PROJET_ACTION_COUPER", 3) ;
57
define ("PROJET_ACTION_COUPER", 3) ;
58
define ("PROJET_ACTION_MODIFIER", 4) ;
58
define ("PROJET_ACTION_MODIFIER", 4) ;
59
define ("PROJET_SUPPRESSION_FICHIER", 5) ;
59
define ("PROJET_SUPPRESSION_FICHIER", 5) ;
60
define ("PROJET_NOUVEAU", 6) ;
60
define ("PROJET_NOUVEAU", 6) ;
61
define ("PROJET_NOUVEAU_V", 7) ;
61
define ("PROJET_NOUVEAU_V", 7) ;
62
define ('PROJET_MODIFIER_DESCRIPTION', 19) ;
62
define ('PROJET_MODIFIER_DESCRIPTION', 19) ;
63
define ('PROJET_MODIFIER_DESCRIPTION_V', 20) ;
63
define ('PROJET_MODIFIER_DESCRIPTION_V', 20) ;
64
define ("PROJET_NOUVEAU_FICHIER", 8) ;
64
define ("PROJET_NOUVEAU_FICHIER", 8) ;
65
define ("PROJET_NOUVEAU_FICHIER_V", 9) ;
65
define ("PROJET_NOUVEAU_FICHIER_V", 9) ;
66
define ("PROJET_NOUVEAU_REPERTOIRE", 11) ;
66
define ("PROJET_NOUVEAU_REPERTOIRE", 11) ;
67
define ("PROJET_NOUVEAU_REPERTOIRE_V", 12) ;
67
define ("PROJET_NOUVEAU_REPERTOIRE_V", 12) ;
68
define ("PROJET_SUPPRESSION_PROJET", 10) ;
68
define ("PROJET_SUPPRESSION_PROJET", 10) ;
69
define ("PROJET_ENVOYER_UN_MAIL", 13) ;
69
define ("PROJET_ENVOYER_UN_MAIL", 13) ;
70
define ("PROJET_ENVOYER_UN_MAIL_V", 14) ;
70
define ("PROJET_ENVOYER_UN_MAIL_V", 14) ;
71
define ("PROJET_ACTION_MODIFIER_V", 15) ;
71
define ("PROJET_ACTION_MODIFIER_V", 15) ;
72
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
72
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
73
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
73
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
74
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
74
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
75
define ('PROJET_ACTION_CREER_WIKI', 22) ;
75
define ('PROJET_ACTION_CREER_WIKI', 22) ;
76
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
76
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
77
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
77
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
78
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
78
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
79
define ('PROJET_ACTION_DESINSCRIPTION_PROJET', 26) ;
79
define ('PROJET_ACTION_DESINSCRIPTION_PROJET', 26) ;
80
define ('PROJET_ACTION_INSCRIPTION_LISTE', 27) ;
80
define ('PROJET_ACTION_INSCRIPTION_LISTE', 27) ;
81
define ('PROJET_ACTION_DESINSCRIPTION_LISTE', 28) ;
81
define ('PROJET_ACTION_DESINSCRIPTION_LISTE', 28) ;
82
define ('PROJET_ACTION_REFERENCER_LISTE', 29) ;
82
define ('PROJET_ACTION_REFERENCER_LISTE', 29) ;
83
define ('PROJET_ACTION_REFERENCER_LISTE_V', 30) ;
83
define ('PROJET_ACTION_REFERENCER_LISTE_V', 30) ;
84
define ('PROJET_ACTION_COLLER', 32) ;
84
define ('PROJET_ACTION_COLLER', 32) ;
85
define ('PROJET_ACTION_ASSOCIER_WIKI', 36) ;
85
define ('PROJET_ACTION_ASSOCIER_WIKI', 36) ;
86
define ('PROJET_ACTION_ASSOCIER_WIKI_V', 37) ;
86
define ('PROJET_ACTION_ASSOCIER_WIKI_V', 37) ;
87
 
87
 
88
define ('PROJET_ACTION_VOIR_RESUME', 'resume') ;
88
define ('PROJET_ACTION_VOIR_RESUME', 'resume') ;
89
define ('PROJET_ACTION_VOIR_DESCRIPTION', 'description') ;
89
define ('PROJET_ACTION_VOIR_DESCRIPTION', 'description') ;
90
define ('PROJET_ACTION_VOIR_DOCUMENT', 'documents') ;
90
define ('PROJET_ACTION_VOIR_DOCUMENT', 'documents') ;
91
define ('PROJET_ACTION_VOIR_FORUM', 'forums') ;
91
define ('PROJET_ACTION_VOIR_FORUM', 'forums') ;
92
define ('PROJET_ACTION_VOIR_PARTICIPANT', 'participants') ;
92
define ('PROJET_ACTION_VOIR_PARTICIPANT', 'participants') ;
93
define ('PROJET_ACTION_VOIR_WIKINI', 'wikini') ;
93
define ('PROJET_ACTION_VOIR_WIKINI', 'wikini') ;
94
/**
94
/**
95
 * Code erreur pour l'interface projetControleur qui trouveront leur message
95
 * Code erreur pour l'interface projetControleur qui trouveront leur message
96
 * correspondant via la fonction projetControleur::messageErreur()
96
 * correspondant via la fonction projetControleur::messageErreur()
97
 */
97
 */
98
define ("PROJETCONTROLEUR_ACTION_INVALIDE", -1) ;
98
define ("PROJETCONTROLEUR_ACTION_INVALIDE", -1) ;
99
define ("PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE", -2) ;
99
define ("PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE", -2) ;
100
define ("PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE", -3) ;
100
define ("PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE", -3) ;
101
define ("PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE", -4) ;
101
define ("PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE", -4) ;
102
 
102
 
103
/**
103
/**
104
 *  Constantes pour definir les droits
104
 *  Constantes pour definir les droits
105
 *
105
 *
106
 */
106
 */
107
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
107
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
108
define ('PROJET_DROIT_COORDINATEUR', 2) ;
108
define ('PROJET_DROIT_COORDINATEUR', 2) ;
109
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
109
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
110
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
110
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
111
define ('PROJET_DROIT_AUCUN', 16) ;
111
define ('PROJET_DROIT_AUCUN', 16) ;
112
define ('PROJET_DROIT_EN_ATTENTE', 32);
112
define ('PROJET_DROIT_EN_ATTENTE', 32);
-
 
113
 
-
 
114
/** Constante pour les notifications
-
 
115
 * Messages envoyes par la systeme pour prevenir
-
 
116
 * les utilisateurs de certaines action
-
 
117
 */
-
 
118
 
-
 
119
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
-
 
120
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
-
 
121
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet 
-
 
122
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
-
 
123
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
-
 
124
 
113
/**
125
/**
114
 * class projetControleur
126
 * class projetControleur
115
 * Cette classe sert a lancer les diverses applications du module projet, en
127
 * Cette classe sert a lancer les diverses applications du module projet, en
116
 * fonction des parametre de l'URL GET ou POST. La methode principale est run()
128
 * fonction des parametre de l'URL GET ou POST. La methode principale est run()
117
 */
129
 */
118
class projetControleur
130
class projetControleur
119
{
131
{
120
    /*** Attributes: ***/
132
    /*** Attributes: ***/
121
 
133
 
122
    /**
134
    /**
123
     * Contient l'action du controleur, qui correspond a une action du module projet.
135
     * Contient l'action du controleur, qui correspond a une action du module projet.
124
     * @access private
136
     * @access private
125
     */
137
     */
126
    var $_action;
138
    var $_action;
127
    /**
139
    /**
128
     * Une connexion a une base de donnee DB.
140
     * Une connexion a une base de donnee DB.
129
     * @access private
141
     * @access private
130
     */
142
     */
131
    var $_db;
143
    var $_db;
132
 
144
 
133
    /**
145
    /**
134
     * Un objet PEAR:Auth
146
     * Un objet PEAR:Auth
135
     * @access private
147
     * @access private
136
     */
148
     */
137
    var $_auth;
149
    var $_auth;
138
 
150
 
139
    /**
151
    /**
140
     *
152
     *
141
     * @access private
153
     * @access private
142
     */
154
     */
143
    var $_url;
155
    var $_url;
144
 
156
 
145
    /**
157
    /**
146
     * L'identifiant du projet sur lequel on travaille. Dans l'action par defaut, cet
158
     * L'identifiant du projet sur lequel on travaille. Dans l'action par defaut, cet
147
     * attribut n'a pas de valeur.
159
     * attribut n'a pas de valeur.
148
     * @access private
160
     * @access private
149
     */
161
     */
150
    var $_id_projet;
162
    var $_id_projet;
151
 
163
 
152
    /**
164
    /**
153
     * L'identifiant du repertoire que l'on est en train d'observer. Il sera passé en
165
     * L'identifiant du repertoire que l'on est en train d'observer. Il sera passé en
154
     * parametre a la classe HTML_listeDocuments.
166
     * parametre a la classe HTML_listeDocuments.
155
     * @access private
167
     * @access private
156
     */
168
     */
157
    var $_id_repertoire;
169
    var $_id_repertoire;
158
 
170
 
159
     /**
171
     /**
160
     * L'identifiant du fichier que l'on est en train de modifier / supprimer.
172
     * L'identifiant du fichier que l'on est en train de modifier / supprimer.
161
     * @access private
173
     * @access private
162
     */
174
     */
163
    var $_id_document;
175
    var $_id_document;
164
 
176
 
165
    /**
177
    /**
166
     * La presentation de la liste des projets, par defaut vide, signifie en liste.
178
     * La presentation de la liste des projets, par defaut vide, signifie en liste.
167
     * Valeurs possibles: arbre
179
     * Valeurs possibles: arbre
168
     * @access private
180
     * @access private
169
     */
181
     */
170
    var $_presentation;
182
    var $_presentation;
171
 
183
 
172
   /**
184
   /**
173
     * Le type du projets, par defaut 0, signifie en pas de type particumier.
185
     * Le type du projets, par defaut 0, signifie en pas de type particumier.
174
     * Valeurs possibles: 0, 1, 2, 3 ...
186
     * Valeurs possibles: 0, 1, 2, 3 ...
175
     * @access private
187
     * @access private
176
     */
188
     */
177
 
189
 
178
     var $_type ;
190
     var $_type ;
179
   /**
191
   /**
180
     * Le tableau des projets a ne pas afficher, ni dans l'arbre, ni dans les listes
192
     * Le tableau des projets a ne pas afficher, ni dans l'arbre, ni dans les listes
181
     * @access private
193
     * @access private
182
     */
194
     */
183
 	var $_projet_exclu = array();
195
 	var $_projet_exclu = array();
184
 
196
 
185
 	/**
197
 	/**
186
     * parametre indiquant le type d'inscription possible
198
     * parametre indiquant le type d'inscription possible
187
     * @access private
199
     * @access private
188
     */
200
     */
189
 	var $_prive = 0 ;
201
 	var $_prive = 0 ;
190
 
202
 
191
	/**
203
	/**
192
     * parametre pour gere l appel a un service en rapport avec ajax
204
     * parametre pour gere l appel a un service en rapport avec ajax
193
     * @access private
205
     * @access private
194
     */
206
     */
195
	var $_service ;
207
	var $_service ;
196
	
208
	
197
    /**
209
    /**
198
     * Methode principale de la classe. Elle permet d'appeler les methodes du modules
210
     * Methode principale de la classe. Elle permet d'appeler les methodes du modules
199
     * projet en fonction de l'action.
211
     * projet en fonction de l'action.
200
     *
212
     *
201
     * @return string
213
     * @return string
202
     * @access public
214
     * @access public
203
     */
215
     */
204
 
216
 
205
 
217
 
206
	
218
	
207
    function run( )
219
    function run( )
208
    {
220
    {
209
        // On teste en premier la presence d un appel vers un service
221
        // On teste en premier la presence d un appel vers un service
210
        if ($this->_service != '') {
222
        if ($this->_service != '') {
211
        	if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
223
        	if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
212
                return include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
224
                return include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
213
            }
225
            }
214
        }
226
        }
215
        
227
        
216
        if ($this->_action == '') {
228
        if ($this->_action == '') {
217
            return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
229
            return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
218
        }
230
        }
219
 
231
 
220
        // Si il n'y a pas d'action mais un projet, on transmet par defaut l'action PROJET_VOIR
232
        // Si il n'y a pas d'action mais un projet, on transmet par defaut l'action PROJET_VOIR
221
        if ($this->_id_projet != "" && $this->_action == PROJET_DEFAUT) {
233
        if ($this->_id_projet != "" && $this->_action == PROJET_DEFAUT) {
222
            $this->_action = PROJET_ACTION_VOIR_RESUME ;
234
            $this->_action = PROJET_ACTION_VOIR_RESUME ;
223
            $this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
235
            $this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
224
        }
236
        }
225
        if ($this->_id_document != "") {
237
        if ($this->_id_document != "") {
226
            $this->_url->addQueryString (PROJET_VARIABLE_ID_DOCUMENT, $this->_id_document) ;
238
            $this->_url->addQueryString (PROJET_VARIABLE_ID_DOCUMENT, $this->_id_document) ;
227
        }
239
        }
228
        if ($this->_id_repertoire != '') {
240
        if ($this->_id_repertoire != '') {
229
            $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
241
            $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
230
        }
242
        }
231
        $retour = '' ;
243
        $retour = '' ;
232
        if (!defined('PROJET_MENU_AFFICHER_CONTENU_CORPS')) $retour = $this->menuGeneral() ;
244
        if (!defined('PROJET_MENU_AFFICHER_CONTENU_CORPS')) $retour = $this->menuGeneral() ;
233
 
245
 
234
        switch ($this->_action) {
246
        switch ($this->_action) {
235
            case PROJET_DEFAUT :
247
            case PROJET_DEFAUT :
236
                $retour .= $this->mesProjets() ;
248
                $retour .= $this->mesProjets() ;
237
            break ;
249
            break ;
238
            case PROJET_VOIR :
250
            case PROJET_VOIR :
239
                $retour .= $this->accueilProjet();
251
                $retour .= $this->accueilProjet();
240
            break ;
252
            break ;
241
            case PROJET_NOUVEAU :
253
            case PROJET_NOUVEAU :
242
                $retour .= $this->formulaireProjet(PROJET_NOUVEAU_V) ;
254
                $retour .= $this->formulaireProjet(PROJET_NOUVEAU_V) ;
243
            break ;
255
            break ;
244
            case PROJET_NOUVEAU_V :
256
            case PROJET_NOUVEAU_V :
245
                $retour .= $this->nouveauProjetValidation().$this->mesProjets() ;
257
                $retour .= $this->nouveauProjetValidation().$this->mesProjets() ;
246
            break ;
258
            break ;
247
            case PROJET_NOUVEAU_FICHIER :
259
            case PROJET_NOUVEAU_FICHIER :
248
                $retour .= $this->formulaireFichier(PROJET_NOUVEAU_FICHIER) ;
260
                $retour .= $this->formulaireFichier(PROJET_NOUVEAU_FICHIER) ;
249
            break ;
261
            break ;
250
            case PROJET_ACTION_MODIFIER :
262
            case PROJET_ACTION_MODIFIER :
251
                $retour .= $this->formulaireFichier (PROJET_ACTION_MODIFIER) ;
263
                $retour .= $this->formulaireFichier (PROJET_ACTION_MODIFIER) ;
252
            break ;
264
            break ;
253
            case PROJET_ACTION_MODIFIER_V :
265
            case PROJET_ACTION_MODIFIER_V :
254
                $retour .= $this->modifierFichier () ;
266
                $retour .= $this->modifierFichier () ;
255
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
267
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
256
            break ;
268
            break ;
257
            case PROJET_NOUVEAU_FICHIER_V :
269
            case PROJET_NOUVEAU_FICHIER_V :
258
                $retour .= $this->nouveauFichierValidation() ;
270
                $retour .= $this->nouveauFichierValidation() ;
259
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
271
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
260
            break ;
272
            break ;
261
            case PROJET_ACTION_COUPER :
273
            case PROJET_ACTION_COUPER :
262
                $retour .= $this->fichierCouper() ;
274
                $retour .= $this->fichierCouper() ;
263
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
275
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
264
            break ;
276
            break ;
265
            case PROJET_SUPPRESSION_PROJET :
277
            case PROJET_SUPPRESSION_PROJET :
266
                $retour .= $this->suppressionProjet().$this->mesProjets() ;
278
                $retour .= $this->suppressionProjet().$this->mesProjets() ;
267
            break ;
279
            break ;
268
            case PROJET_NOUVEAU_REPERTOIRE :
280
            case PROJET_NOUVEAU_REPERTOIRE :
269
                $retour .= $this->nouveauRepertoire() ;
281
                $retour .= $this->nouveauRepertoire() ;
270
            break ;
282
            break ;
271
            case PROJET_NOUVEAU_REPERTOIRE_V :
283
            case PROJET_NOUVEAU_REPERTOIRE_V :
272
                $retour .= $this->nouveauRepertoireValidation() ;
284
                $retour .= $this->nouveauRepertoireValidation() ;
273
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
285
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
274
            break ;
286
            break ;
275
            case PROJET_SUPPRESSION_FICHIER :
287
            case PROJET_SUPPRESSION_FICHIER :
276
                $retour .=$this->suppressionFichier() ;
288
                $retour .=$this->suppressionFichier() ;
277
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
289
                $this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
278
            break ;
290
            break ;
279
            case PROJET_ENVOYER_UN_MAIL :
291
            case PROJET_ENVOYER_UN_MAIL :
280
                $retour .= $this->envoyerUnMailFormulaire() ;
292
                $retour .= $this->envoyerUnMailFormulaire() ;
281
            break ;
293
            break ;
282
            case PROJET_ENVOYER_UN_MAIL_V :
294
            case PROJET_ENVOYER_UN_MAIL_V :
283
                $retour .= $this->envoyerUnMailValidation() ;
295
                $retour .= $this->envoyerUnMailValidation() ;
284
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
296
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
285
            break ;
297
            break ;
286
            case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
298
            case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
287
            break ;
299
            break ;
288
            case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
300
            case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
289
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
301
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
290
            break ;
302
            break ;
291
            case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
303
            case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
292
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
304
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
293
            break ;
305
            break ;
294
            case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
306
            case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
295
            break ;
307
            break ;
296
            case PROJET_MODIFIER_DESCRIPTION_V : $retour .= $this->modifierProjet() ;
308
            case PROJET_MODIFIER_DESCRIPTION_V : $retour .= $this->modifierProjet() ;
297
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
309
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
298
            break ;
310
            break ;
299
            case  PROJET_ACTION_S_INSCRIRE : $retour .= $this->inscriptionProjet() ;
311
            case  PROJET_ACTION_S_INSCRIRE : $retour .= $this->inscriptionProjet() ;
300
 
312
 
301
            break ;
313
            break ;
302
            case PROJET_ACTION_DESINSCRIPTION_PROJET : $retour .= $this->desinscriptionProjet() ;
314
            case PROJET_ACTION_DESINSCRIPTION_PROJET : $retour .= $this->desinscriptionProjet() ;
303
            break ;
315
            break ;
304
            case PROJET_ACTION_CREER_WIKI : $retour .= $this->formulaireWiki() ;
316
            case PROJET_ACTION_CREER_WIKI : $retour .= $this->formulaireWiki() ;
305
            break ;
317
            break ;
306
            case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki() ;
318
            case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki() ;
307
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
319
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
308
            break ;
320
            break ;
309
            case PROJET_ACTION_ASSOCIER_WIKI : $retour .= $this->associerWiki() ;
321
            case PROJET_ACTION_ASSOCIER_WIKI : $retour .= $this->associerWiki() ;
310
            break ;
322
            break ;
311
            case PROJET_ACTION_ASSOCIER_WIKI_V : $retour .= $this->associationWiki() ;
323
            case PROJET_ACTION_ASSOCIER_WIKI_V : $retour .= $this->associationWiki() ;
312
            	$this->_action = PROJET_ACTION_VOIR_RESUME ;
324
            	$this->_action = PROJET_ACTION_VOIR_RESUME ;
313
            break ;
325
            break ;
314
            case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
326
            case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
315
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
327
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
316
            break ;
328
            break ;
317
            case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
329
            case PROJET_ACTION_INSCRIPTION_LISTE : $message_retour = $this->inscriptionListe() ;
318
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
330
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
319
            break ;
331
            break ;
320
            case PROJET_ACTION_DESINSCRIPTION_LISTE : $retour .= $this->desinscriptionListe() ;
332
            case PROJET_ACTION_DESINSCRIPTION_LISTE : $message_retour = $this->desinscriptionListe() ;
321
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
333
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
322
            break ;
334
            break ;
323
            case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
335
            case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
324
            break ;
336
            break ;
325
            case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
337
            case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
326
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
338
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
327
            break ;
339
            break ;
328
 
340
 
329
        }
341
        }
330
        if (!is_int($this->_action)) {
342
        if (!is_int($this->_action)) {
331
            if (file_exists(PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php')) {
343
            if (file_exists(PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php')) {
332
                include_once PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php' ;
344
                include_once PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php' ;
333
            }
345
            }
334
        }
346
        }
335
        return $retour ;
347
        return $retour ;
336
    } // end of member function run
348
    } // end of member function run
337
 
349
 
338
    /**
350
    /**
339
     * Permet de fixer la valeur de l'action pour l'objet projetControleur. Cette action
351
     * Permet de fixer la valeur de l'action pour l'objet projetControleur. Cette action
340
     * provient generalement de $_POST['action'] ou $_GET['action']
352
     * provient generalement de $_POST['action'] ou $_GET['action']
341
     *
353
     *
342
     * @param int action L'action à passer provient de l'URL.
354
     * @param int action L'action à passer provient de l'URL.
343
     * @return void
355
     * @return void
344
     * @access public
356
     * @access public
345
     */
357
     */
346
    function setAction( $action )
358
    function setAction( $action )
347
    {
359
    {
348
        $this->_action = $action ;
360
        $this->_action = $action ;
349
    } // end of member function setAction
361
    } // end of member function setAction
350
 
362
 
351
	/**
363
	/**
352
     * Permet de fixer la valeur de du service pour l'objet projetControleur. Ce service
364
     * Permet de fixer la valeur de du service pour l'objet projetControleur. Ce service
353
     * provient généralement de $_POST['service'] ou $_GET['service']
365
     * provient généralement de $_POST['service'] ou $_GET['service']
354
     *
366
     *
355
     * @param int service Le service à appeler provient de l'URL.
367
     * @param int service Le service à appeler provient de l'URL.
356
     * @return void
368
     * @return void
357
     * @access public
369
     * @access public
358
     */
370
     */
359
    function setService( $service )
371
    function setService( $service )
360
    {
372
    {
361
        $this->_service = $service ;
373
        $this->_service = $service ;
362
    } // end of member function setAction
374
    } // end of member function setAction
363
 
375
 
364
 
376
 
365
    /**
377
    /**
366
     * Constructeur.
378
     * Constructeur.
367
     *
379
     *
368
     * @return void
380
     * @return void
369
     * @access public
381
     * @access public
370
     */
382
     */
371
    function projetControleur(&$dbObjet, &$authObjet, $urlObjet = "")
383
    function projetControleur(&$dbObjet, &$authObjet, $urlObjet = "")
372
    {
384
    {
373
        $this->_db = $dbObjet ;
385
        $this->_db = $dbObjet ;
374
        $this->_auth = $authObjet ;
386
        $this->_auth = $authObjet ;
375
        $this->_id_repertoire = 0 ;
387
        $this->_id_repertoire = 0 ;
376
        $this->_type = '' ;
388
        $this->_type = '' ;
377
        if (is_object ($urlObjet)) {
389
        if (is_object ($urlObjet)) {
378
            $this->_url = $urlObjet ;
390
            $this->_url = $urlObjet ;
379
        }
391
        }
380
    } // end of member function projetControleur
392
    } // end of member function projetControleur
381
 
393
 
382
    /**
394
    /**
383
     * Renvoie la liste des projets auquel participe la personne loguée, avec son
395
     * Renvoie la liste des projets auquel participe la personne logguee, avec son
384
     * statut et un lien vers l'action pour gérer le projet.
396
     * statut et un lien vers l'action pour gerer le projet.
385
     *
397
     *
386
     * @return string
398
     * @return string
387
     * @access public
399
     * @access public
388
     */
400
     */
389
    function mesProjets( )
401
    function mesProjets( )
390
    {
402
    {
391
    	$res = '' ;
403
    	$res = '' ;
392
    	include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
404
    	include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
393
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
405
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
394
        $participant = new participe ($this->_db) ;
406
        $participant = new participe ($this->_db) ;
395
 
407
 
396
      // Les entetes des tableaux
408
      // Les entetes des tableaux
397
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
409
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
398
 
410
 
399
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
411
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
400
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
412
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
401
		
413
		
402
		return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
414
		return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
403
		
415
		
404
    }
416
    }
405
 
417
 
406
    /**
418
    /**
407
     * Renvoie le menu general de l'application projet. Avec differents liens selon le
419
     * Renvoie le menu general de l'application projet. Avec differents liens selon le
408
     * statut de l'utilisateur.
420
     * statut de l'utilisateur.
409
     *
421
     *
410
     * @return string
422
     * @return string
411
     * @access public
423
     * @access public
412
     */
424
     */
413
    function menuGeneral( )
425
    function menuGeneral( )
414
    {
426
    {
415
        $res = '' ;
427
        $res = '' ;
416
        $auth = $this->_auth->getAuth() ;
428
        $auth = $this->_auth->getAuth() ;
417
        if (!$auth) return ;
429
        if (!$auth) return ;
418
        $res .= '<div class="menu_projet">'."\n";
430
        $res .= '<div class="menu_projet">'."\n";
419
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
431
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
420
        $participant = new participe($this->_db) ;
432
        $participant = new participe($this->_db) ;
421
        if ($participant->isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID))) {
433
        if ($participant->isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID))) {
422
            $isAdm = 1; $isCoord = 1 ; $isContri = 1 ;
434
            $isAdm = 1; $isCoord = 1 ; $isContri = 1 ;
423
            $label_statut = PROJET_ADMINISTRATEUR;
435
            $label_statut = PROJET_ADMINISTRATEUR;
424
        } else {
436
        } else {
425
            $isAdm = 0 ; $isCoord = 0 ; $isContri = 0 ;
437
            $isAdm = 0 ; $isCoord = 0 ; $isContri = 0 ;
426
        }
438
        }
427
 
439
 
428
        // Les menus specifiques aux projets
440
        // Les menus specifiques aux projets
429
        if ($this->_id_projet != '') {
441
        if ($this->_id_projet != '') {
430
            if (!$isCoord) {
442
            if (!$isCoord) {
431
                $isCoord = $participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
443
                $isCoord = $participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
432
                if ($isCoord) {
444
                if ($isCoord) {
433
                    $label_statut = PROJET_CHEF ;
445
                    $label_statut = PROJET_CHEF ;
434
                    $isContri = true ;
446
                    $isContri = true ;
435
                }
447
                }
436
            }
448
            }
437
            if (!$isContri && !$isAdm) {
449
            if (!$isContri && !$isAdm) {
438
                $isContri = $participant->isContributeur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
450
                $isContri = $participant->isContributeur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
439
                if ($isContri) {
451
                if ($isContri) {
440
                    $label_statut = PROJET_VOUS_PARTICIPEZ ;
452
                    $label_statut = PROJET_VOUS_PARTICIPEZ ;
441
                } else {
453
                } else {
442
                    $label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
454
                    $label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
443
                }
455
                }
444
            }
456
            }
445
            if ($participant->isEnAttente($this->_auth->getAuthData(PROJET_CHAMPS_ID),$this->_id_projet,$this->_db)) {
457
            if ($participant->isEnAttente($this->_auth->getAuthData(PROJET_CHAMPS_ID),$this->_id_projet,$this->_db)) {
446
            	$isEnAttente = true ;
458
            	$isEnAttente = true ;
447
            	$label_statut = PROJET_EN_ATTENTE ;
459
            	$label_statut = PROJET_EN_ATTENTE ;
448
            } else {
460
            } else {
449
            	$isEnAttente = false ;
461
            	$isEnAttente = false ;
450
            }
462
            }
451
        }
463
        }
452
 
464
 
453
        if ($isContri || $isAdm) {
465
        if ($isContri || $isAdm) {
454
            $res .= '<h2>' ;
466
            $res .= '<h2>' ;
455
            if ($isAdm) $res .= PROJET_VOUS_ETES.' ' ;
467
            if ($isAdm) $res .= PROJET_VOUS_ETES.' ' ;
456
            $res .= $label_statut.'</h2>'."\n" ;
468
            $res .= $label_statut.'</h2>'."\n" ;
457
 
469
 
458
        } else {
470
        } else {
459
            if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
471
            if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
460
        }
472
        }
461
        
473
        
462
        if ($this->_id_projet != '') {
474
        if ($this->_id_projet != '') {
463
        	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
475
        	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
464
        	$projet = new projet ($this->_db, $this->_id_projet) ;
476
        	$projet = new projet ($this->_db, $this->_id_projet) ;
465
			// Participant
477
			// Participant
466
			if (!$isEnAttente) {
478
			if (!$isEnAttente) {
467
				$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
479
				$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
468
				$res .= '<ul id="projet_groupe_niv2_con">' ;
480
				$res .= '<ul id="projet_groupe_niv2_con">' ;
469
			}		
481
			}		
470
	        if ($isCoord || $isContri) {
482
	        if ($isCoord || $isContri) {
471
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
483
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
472
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
484
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
473
	        } else {
485
	        } else {
474
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
486
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
475
	        	if (!$isEnAttente) $res .= '<li class="projet_niv2"><a href="'.
487
	        	if (!$isEnAttente) $res .= '<li class="projet_niv2"><a href="'.
476
	        						$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
488
	        						$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
477
	        }
489
	        }
478
	        // L'action gerer les utilisateurs
490
	        // L'action gerer les utilisateurs
479
	        if ($isCoord || $isAdm) {
491
	        if ($isCoord || $isAdm) {
480
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
492
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
481
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
493
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
482
	        }
494
	        }
483
	        $res .= '</ul></li>' ;
495
	        $res .= '</ul></li>' ;
484
	        
496
	        
485
	        //document
497
	        //document
486
	        if ($isContri || $isCoord || $isAdm) {
498
	        if ($isContri || $isCoord || $isAdm) {
487
		        
499
		        
488
		        // On ajoute l id d un repertoire s il existe
500
		        // On ajoute l id d un repertoire s il existe
489
		        if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
501
		        if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
490
		        $res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
502
		        $res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
491
		        // L'action "Mettre un fichier en ligne"
503
		        // L'action "Mettre un fichier en ligne"
492
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
504
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
493
		        $res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
505
		        $res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
494
		
506
		
495
		        // L'action creer un repertoire
507
		        // L'action creer un repertoire
496
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
508
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
497
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
509
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
498
				$res .= '</ul></li>' ;
510
				$res .= '</ul></li>' ;
499
	        
511
	        
500
	        	$this->_url->removeQueryString('id_repertoire');
512
	        	$this->_url->removeQueryString('id_repertoire');
501
				// Forum 
513
				// Forum 
502
				$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
514
				$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
503
				$res .= '<ul id="projet_groupe_niv2_for">' ;
515
				$res .= '<ul id="projet_groupe_niv2_for">' ;
504
				if ($projet->avoirListe()) {
516
				if ($projet->avoirListe()) {
505
					
517
					
506
					// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
518
					// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
507
		            //$projet->getListesAssociees();
519
		            //$projet->getListesAssociees();
508
		
520
		
509
		            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
521
		            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
-
 
522
		            include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
510
		            foreach ($projet->_listes_associes as $info_liste) {
523
		            foreach ($projet->_listes_associes as $info_liste) {
511
		
524
						
-
 
525
						$listes_ext = new liste_externe ($this->_db) ;
-
 
526
						$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
-
 
527
						if (count ($tableau_liste) == 0) {
512
		                $inscription_liste = new inscription_liste($this->_db) ;
528
			                $inscription_liste = new inscription_liste($this->_db) ;
513
		                if ($inscription_liste->getStatutInscrit($info_liste->getId(),  $this->_auth) == 0) {
529
			                if ($inscription_liste->getStatutInscrit($info_liste->getId(),  $this->_auth) == 0) {
514
		                    $action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
530
			                    $action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
515
		                    $label_inscription = PROJET_RECEVOIR_MESSAGES ;
531
			                    $label_inscription = PROJET_RECEVOIR_MESSAGES ;
516
		                } else {
532
			                } else {
517
		                    // L'action envoyer un mail
533
			                    // L'action envoyer un mail
518
		                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL) ;
534
			                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL) ;
519
		                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a></li>'."\n" ;
535
			                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a></li>'."\n" ;
520
		                    $action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
536
			                    $action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
521
		                    $label_inscription = PROJET_NE_PAS_RECEVOIR_MESSAGES ;
537
			                    $label_inscription = PROJET_NE_PAS_RECEVOIR_MESSAGES ;
522
		                }
538
			                }
523
		                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
539
			                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
524
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">';
540
			                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">';
525
		                $res .= $label_inscription.'</a></li> ';
541
			                $res .= $label_inscription.'</a></li> ';
-
 
542
						}
526
		            }
543
		            }
527
		            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
544
		            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
528
		                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
545
		                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
529
		                $texte_liste = PROJET_SUPPRIMER_LISTE ;
546
		                $texte_liste = PROJET_SUPPRIMER_LISTE ;
530
		                $onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
547
		                $onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
531
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
548
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
532
		            }
549
		            }
533
		            
550
		            
534
				} else {
551
				} else {
535
					if ($isAdm || $isCoord) {
552
					if ($isAdm || $isCoord) {
536
			        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
553
			        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
537
		                $texte_liste = PROJET_CREER_LISTE ;
554
		                $texte_liste = PROJET_CREER_LISTE ;
538
		                $onclic = '' ;
555
		                $onclic = '' ;
539
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
556
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
540
					}
557
					}
541
				}
558
				}
542
				if ($isAdm) {
559
				if ($isAdm) {
543
					$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
560
					$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
544
			        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
561
			        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
545
					
562
					
546
				}
563
				}
547
				$res .= '</ul></li>' ;
564
				$res .= '</ul></li>' ;
548
	        }
565
	        }
549
			// Gestion projet
566
			// Gestion projet
550
			if ($isCoord || $isAdm) {
567
			if ($isCoord || $isAdm) {
551
				$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
568
				$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
552
				$res .= '<ul id="projet_group_niv2_ges">' ;
569
				$res .= '<ul id="projet_group_niv2_ges">' ;
553
				// L'action modifier les propriétés du projet
570
				// L'action modifier les propriétés du projet
554
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
571
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
555
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
572
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
556
	            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
573
	            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
557
		            $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
574
		            $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
558
		            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
575
		            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
559
		            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
576
		            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
560
		            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
577
		            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
561
		            
578
		            
562
		                // L'action supprimer le projet
579
		                // L'action supprimer le projet
563
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
580
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
564
                    $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
581
                    $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
565
                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
582
                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
566
                                .PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
583
                                .PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
567
		        }
584
		        }
568
	            $res .= '</ul></li>' ;
585
	            $res .= '</ul></li>' ;
569
			}
586
			}
570
			
587
			
571
			// Wikini
588
			// Wikini
572
			if ($isAdm) {
589
			if ($isAdm) {
573
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
590
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
574
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
591
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
575
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
592
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
576
				// L'action choisir un wikini
593
				// L'action choisir un wikini
577
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_ASSOCIER_WIKI) ;
594
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_ASSOCIER_WIKI) ;
578
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_ASSOCIER_WIKI."</a></li>\n" ;
595
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_ASSOCIER_WIKI."</a></li>\n" ;
579
	            $res .= '</ul></li>' ;
596
	            $res .= '</ul></li>' ;
580
			}
597
			}
581
        } else {
598
        } else {
582
        	if ($isAdm) {
599
        	if ($isAdm) {
583
        		$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
600
        		$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
584
		 		$res .= '<ul>' ;
601
		 		$res .= '<ul>' ;
585
      			$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
602
      			$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
586
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
603
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
587
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
604
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
588
		        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
605
		        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
589
		        $res .= '</ul></li>' ;
606
		        $res .= '</ul></li>' ;
590
        	}	
607
        	}	
591
        }
608
        }
592
        $res .= '</ul>' ;
609
        $res .= '</ul>' ;
593
        $res .= "</div>\n" ;
610
        $res .= "</div>\n" ;
594
        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
611
        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
-
 
612
        $vues = array (PROJET_ACTION_VOIR_RESUME, PROJET_ACTION_VOIR_DESCRIPTION, PROJET_ACTION_VOIR_WIKINI, PROJET_ACTION_VOIR_FORUM, PROJET_ACTION_VOIR_PARTICIPANT);
-
 
613
        if (isset($_REQUEST[PROJET_VARIABLE_ACTION]) && in_array ($_REQUEST[PROJET_VARIABLE_ACTION], $vues)) $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $_REQUEST[PROJET_VARIABLE_ACTION]);
595
        return $res ;
614
        return $res ;
596
    } // end of member function menuGeneral
615
    } // end of member function menuGeneral
597
 
616
 
598
    /**
617
    /**
599
     * Renvoie le formulaire de cretion d'un projet.
618
     * Renvoie le formulaire de cretion d'un projet.
600
     *
619
     *
601
     * @return string
620
     * @return string
602
     * @access public
621
     * @access public
603
     */
622
     */
604
    function formulaireProjet($action)
623
    function formulaireProjet($action)
605
    {
624
    {
606
	    	if (!$this->_auth->getAuth()) {
625
	    	if (!$this->_auth->getAuth()) {
607
	    		return PROJET_TEXTE_NON_IDENTIFIE;
626
	    		return PROJET_TEXTE_NON_IDENTIFIE;
608
	    	}
627
	    	}
609
	    	
628
	    	
610
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
629
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
611
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
630
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
612
		        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
631
		        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
613
		        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
632
		        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
614
		        $tableau_type = '' ;
633
		        $tableau_type = '' ;
615
		        if (PROJET_UTILISE_TYPE) {
634
		        if (PROJET_UTILISE_TYPE) {
616
		            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
635
		            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
617
		            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
636
		            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
618
		        }
637
		        }
619
		        
638
		        
620
		        /** recuperation des themes */
639
		        /** recuperation des themes */
621
		        include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
640
		        include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
622
		        $tableau_theme = projet_theme::getTousLesThemes($this->_db);
641
		        $tableau_theme = projet_theme::getTousLesThemes($this->_db);
623
		        
642
		        
624
		        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
643
		        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
625
		        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
644
		        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
626
		        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
645
		        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
627
		            $projet = new projet($this->_db, $this->_id_projet) ;
646
		            $projet = new projet($this->_db, $this->_id_projet) ;
628
		            
647
		            
629
		            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
648
		            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
630
		                                            'projet_description' => $projet->getDescription(),
649
		                                            'projet_description' => $projet->getDescription(),
631
		                                            'projet_asso' => $projet->getIdPere(),
650
		                                            'projet_asso' => $projet->getIdPere(),
632
		                                            'projet_wikini' => $projet->getWikini(),
651
		                                            'projet_wikini' => $projet->getWikini(),
633
		                                            'projet_resume' => $projet->getResume(),
652
		                                            'projet_resume' => $projet->getResume(),
634
		                                            'projet_espace_internet' => $projet->getEspaceInternet(),
653
		                                            'projet_espace_internet' => $projet->getEspaceInternet(),
635
		                                            'projet_type'=> $projet->getType(),
654
		                                            'projet_type'=> $projet->getType(),
636
		                                            'projet_moderation' => $projet->isModere(),
655
		                                            'projet_moderation' => $projet->isModere(),
637
		                                        ) ;
656
		                                        ) ;
638
					
657
					
639
		            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
658
		            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
640
		            $themes = $projet->getThemes();
659
		            $themes = $projet->getThemes();
641
		            foreach ($themes as $cle => $valeur) {
660
		            foreach ($themes as $cle => $valeur) {
642
		            	$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
661
		            	$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
643
		            	if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
662
		            	if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
644
		            	$element->setChecked(true);
663
		            	$element->setChecked(true);
645
		            }
664
		            }
646
		        } else {
665
		        } else {
647
		        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
666
		        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
648
		        }
667
		        }
649
		        $res = PROJET_PROPOSER_PROJET ;
668
		        $res = PROJET_PROPOSER_PROJET ;
650
		        return $res . $formulaire_projet->toHTML() ;
669
		        return $res . $formulaire_projet->toHTML() ;
651
	    	} else {
670
	    	} else {
652
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
671
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
653
	    	}
672
	    	}
654
    } // end of member function nouveauProjet
673
    } // end of member function nouveauProjet
655
 
674
 
656
    /**
675
    /**
657
     * Valide le formulaire et appelle la fonction d'insertion.
676
     * Valide le formulaire et appelle la fonction d'insertion.
658
     *
677
     *
659
     * @return string
678
     * @return string
660
     * @access public
679
     * @access public
661
     */
680
     */
662
    function nouveauProjetValidation( )
681
    function nouveauProjetValidation( )
663
    {
682
    {
664
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_V) ;
683
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_V) ;
665
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
684
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
666
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
685
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
667
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
686
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
668
        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
687
        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
669
        if ($formulaire_projet->validate()) {
688
        if ($formulaire_projet->validate()) {
670
 
689
 
671
            $projet = new projet ($this->_db) ;
690
            $projet = new projet ($this->_db) ;
672
            $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
691
            $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
673
            if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
692
            if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
674
                return 'erreur' ;
693
                return 'erreur' ;
675
            }
694
            }
676
            // On inscrit le deposant du projet en tant que coordinateur
695
            // On inscrit le deposant du projet en tant que coordinateur
677
            if (PROJET_UTILISATEURS_COORD) {
696
            if (PROJET_UTILISATEURS_COORD) {
678
		        // Si le projet n'a pas de liste, on inscrit directement
697
		        // Si le projet n'a pas de liste, on inscrit directement
679
		        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
698
		        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
680
		        $participant = new participe($this->_db) ;
699
		        $participant = new participe($this->_db) ;
681
	            $participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
700
	            $participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
682
            }
701
            }
683
        } else {
702
        } else {
684
            return $formulaire_projet->toHTML() ;
703
            return $formulaire_projet->toHTML() ;
685
        }
704
        }
686
    }
705
    }
687
 
706
 
688
    /**
707
    /**
689
     * Valide le formulaire et appelle la fonction de mise à jour.
708
     * Valide le formulaire et appelle la fonction de mise à jour.
690
     *
709
     *
691
     * @return void
710
     * @return void
692
     * @access public
711
     * @access public
693
     */
712
     */
694
    function modifierProjet( )
713
    function modifierProjet( )
695
    {
714
    {
696
        // creation de l'objet projet courant
715
        // creation de l'objet projet courant
697
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
716
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
698
        $projet = new projet ($this->_db, $this->_id_projet) ;
717
        $projet = new projet ($this->_db, $this->_id_projet) ;
699
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
718
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
700
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
719
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
701
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
720
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
702
        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
721
        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
703
        if ($formulaire_projet->validate()) {
722
        if ($formulaire_projet->validate()) {
704
            $projet->majSQL($formulaire_projet->getSubmitValues()) ;
723
            $projet->majSQL($formulaire_projet->getSubmitValues()) ;
705
        } else {
724
        } else {
706
            return $formulaire_projet->toHTML() ;
725
            return $formulaire_projet->toHTML() ;
707
        }
726
        }
708
        unset ($projet) ;
727
        unset ($projet) ;
709
    }
728
    }
710
 
729
 
711
    /**
730
    /**
712
     * Renvoie le formulaire d'upload d'un fichier.
731
     * Renvoie le formulaire d'upload d'un fichier.
713
     *
732
     *
714
     * @return void
733
     * @return void
715
     * @access public
734
     * @access public
716
     */
735
     */
717
    function formulaireFichier($action)
736
    function formulaireFichier($action)
718
    {
737
    {
719
        $res = '<h1>'.PROJET_FICHIER_MISE_EN_LIGNE.'</h1>'."\n" ;
738
        $res = '<h1>'.PROJET_FICHIER_MISE_EN_LIGNE.'</h1>'."\n" ;
720
        if (isset($_SESSION['formulaire_document'])) {
739
        if (isset($_SESSION['formulaire_document'])) {
721
            unset ($_SESSION['formulaire_document']) ;
740
            unset ($_SESSION['formulaire_document']) ;
722
        }
741
        }
723
        $action_future = $action == PROJET_NOUVEAU_FICHIER ? PROJET_NOUVEAU_FICHIER_V : PROJET_ACTION_MODIFIER_V ;
742
        $action_future = $action == PROJET_NOUVEAU_FICHIER ? PROJET_NOUVEAU_FICHIER_V : PROJET_ACTION_MODIFIER_V ;
724
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $action_future) ;
743
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $action_future) ;
725
        if ($this->_id_repertoire != '') $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
744
        if ($this->_id_repertoire != '') $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
726
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
745
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
727
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
746
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
728
        $formulaire_document->construitFormulaire($action) ;
747
        $formulaire_document->construitFormulaire($action) ;
729
        if ($action == PROJET_ACTION_MODIFIER) {
748
        if ($action == PROJET_ACTION_MODIFIER) {
730
			include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
749
			include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
731
            $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
750
            $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
732
            // On affecte dans un tableau les valeurs de chaque champs du formulaire avec le nom de chaque element de formulaire
751
            // On affecte dans un tableau les valeurs de chaque champs du formulaire avec le nom de chaque element de formulaire
733
            // voir HTML_formulaireDocument
752
            // voir HTML_formulaireDocument
734
            $valeurs_par_defaut = array ('document_nom' => $document->getNomLong(),
753
            $valeurs_par_defaut = array ('document_nom' => $document->getNomLong(),
735
                                         'document_description' => $document->getDescription(),
754
                                         'document_description' => $document->getDescription(),
736
                                         'document_visibilite' => $document->getVisibilite()) ;
755
                                         'document_visibilite' => $document->getVisibilite()) ;
737
 
756
 
738
            // On rajoute un champs cache avec l'identifiant du document
757
            // On rajoute un champs cache avec l'identifiant du document
739
            $formulaire_document->addElement ('hidden', 'id_document', $this->_id_document) ;
758
            $formulaire_document->addElement ('hidden', 'id_document', $this->_id_document) ;
740
            $formulaire_document->setDefaults($valeurs_par_defaut) ;
759
            $formulaire_document->setDefaults($valeurs_par_defaut) ;
741
        } else {
760
        } else {
742
            $formulaire_document->setDefaults (array ('document_visibilite'=> 'public')) ;
761
            $formulaire_document->setDefaults (array ('document_visibilite'=> 'public')) ;
743
        }
762
        }
744
        return $res.$formulaire_document->toHTML() ;
763
        return $res.$formulaire_document->toHTML() ;
745
 
764
 
746
    } // end of member function nouveauFichier
765
    } // end of member function nouveauFichier
747
 
766
 
748
    /**
767
    /**
749
    *   Presente un formulaire pour deplacer un fichier
768
    *   Presente un formulaire pour deplacer un fichier
750
    *
769
    *
751
    *
770
    *
752
    */
771
    */
753
    function fichierCouper() {
772
    function fichierCouper() {
754
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
773
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
755
        $projet = new projet ($this->_db, $this->_id_projet) ;
774
        $projet = new projet ($this->_db, $this->_id_projet) ;
756
 
775
 
757
        $res = '<h1>'.PROJET_PROJET.' : '.$projet->getTitre().'</h1>' ;
776
        $res = '<h1>'.PROJET_PROJET.' : '.$projet->getTitre().'</h1>' ;
758
        include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
777
        include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
759
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
778
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
760
        // On traite le cas ou l'on vient de deplacer un fichier
779
        // On traite le cas ou l'on vient de deplacer un fichier
761
 
780
 
762
        if (isset ($_POST['projet_repertoire'])) {
781
        if (isset ($_POST['projet_repertoire'])) {
763
            if (!$document -> deplace ($_POST['projet_repertoire'], $projet->getNomRepertoire())) {
782
            if (!$document -> deplace ($_POST['projet_repertoire'], $projet->getNomRepertoire())) {
764
                return 'echec du d&eacute;placement' ;
783
                return 'echec du d&eacute;placement' ;
765
            }
784
            }
766
            return ;
785
            return ;
767
        }
786
        }
768
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireCouperColler.class.php' ;
787
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireCouperColler.class.php' ;
769
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_COUPER) ;
788
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_COUPER) ;
770
        $HTML_formulaireCouperColler = new HTML_formulaireCouperColler('formulaire_couper_coller', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
789
        $HTML_formulaireCouperColler = new HTML_formulaireCouperColler('formulaire_couper_coller', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
771
        $HTML_formulaireCouperColler -> construitFormulaire($projet->getListeRepertoireHierarchisee()) ;
790
        $HTML_formulaireCouperColler -> construitFormulaire($projet->getListeRepertoireHierarchisee()) ;
772
        $tab = $projet->getListeRepertoireHierarchisee();
791
        $tab = $projet->getListeRepertoireHierarchisee();
773
        //$res .=  '<pre>'.print_r ($tab, true).'</pre>';
792
        //$res .=  '<pre>'.print_r ($tab, true).'</pre>';
774
        return $res .$HTML_formulaireCouperColler->toHTML('<img src="'.PROJET_CHEMIN_ICONES.$document->getCheminIcone().'" /> '.$document->getNomLong());
793
        return $res .$HTML_formulaireCouperColler->toHTML('<img src="'.PROJET_CHEMIN_ICONES.$document->getCheminIcone().'" /> '.$document->getNomLong());
775
    }
794
    }
776
    /**
795
    /**
777
     * Supprime un fichier.
796
     * Supprime un fichier.
778
     *
797
     *
779
     * @return void
798
     * @return void
780
     * @access public
799
     * @access public
781
     */
800
     */
782
    function suppressionFichier( )
801
    function suppressionFichier( )
783
    {
802
    {
784
        if ($this->_id_document == "") {
803
        if ($this->_id_document == "") {
785
            return $this->messageErreur(PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE) ;
804
            return $this->messageErreur(PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE) ;
786
        }
805
        }
787
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
806
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
788
        $projet = new projet ($this->_db, $this->_id_projet) ;
807
        $projet = new projet ($this->_db, $this->_id_projet) ;
789
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
808
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
790
        $document->suppression() ;
809
        $document->suppression() ;
791
        $document->suppressionSQL() ;
810
        $document->suppressionSQL() ;
792
        
811
        
793
        // On verifie s il reste des documents associes au projet et si non on met 
812
        // On verifie s il reste des documents associes au projet et si non on met 
794
        // a jour projet.p_avoir_document
813
        // a jour projet.p_avoir_document
795
        if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false); 
814
        if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false); 
796
        return ;
815
        return ;
797
 
816
 
798
    } // end of member function nouveauFichier
817
    } // end of member function nouveauFichier
799
 
818
 
800
    /**
819
    /**
801
     * Renvoie le formulaire de creation d'un repertoire.
820
     * Renvoie le formulaire de creation d'un repertoire.
802
     *
821
     *
803
     * @return void
822
     * @return void
804
     * @access public
823
     * @access public
805
     */
824
     */
806
    function nouveauRepertoire( )
825
    function nouveauRepertoire( )
807
    {
826
    {
808
        $res = '<h1>'.PROJET_REP_CREER.'</h1>'."\n" ;
827
        $res = '<h1>'.PROJET_REP_CREER.'</h1>'."\n" ;
809
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE_V) ;
828
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE_V) ;
810
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
829
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
811
        $formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
830
        $formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
812
        $formulaire_repertoire->setType ('repertoire') ;
831
        $formulaire_repertoire->setType ('repertoire') ;
813
        $formulaire_repertoire->construitFormulaire() ;
832
        $formulaire_repertoire->construitFormulaire() ;
814
        $formulaire_repertoire->setDefaults (array ('document_visibilite'=> 'public')) ;
833
        $formulaire_repertoire->setDefaults (array ('document_visibilite'=> 'public')) ;
815
        return $res.$formulaire_repertoire->toHTML() ;
834
        return $res.$formulaire_repertoire->toHTML() ;
816
 
835
 
817
    }
836
    }
818
 
837
 
819
    /**
838
    /**
820
     * Valide le formulaire et appelle la fonction d'insertion.
839
     * Valide le formulaire et appelle la fonction d'insertion.
821
     *
840
     *
822
     * @return void
841
     * @return void
823
     * @access public
842
     * @access public
824
     */
843
     */
825
    function nouveauFichierValidation( )
844
    function nouveauFichierValidation( )
826
    {
845
    {
827
        // creation de l'objet projet courant
846
        // creation de l'objet projet courant
828
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
847
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
829
        $projet = new projet ($this->_db, $this->_id_projet) ;
848
        $projet = new projet ($this->_db, $this->_id_projet) ;
830
        if (isset($_SESSION['formulaire_document']) && $_SESSION['formulaire_document'] == 'valide') {
849
        if (isset($_SESSION['formulaire_document']) && $_SESSION['formulaire_document'] == 'valide') {
831
            return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
850
            return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
832
        }
851
        }
833
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
852
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
834
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
853
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
835
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
854
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
836
        $formulaire_document->construitFormulaire() ;
855
        $formulaire_document->construitFormulaire() ;
837
        if ($formulaire_document->validate()) {
856
        if ($formulaire_document->validate()) {
838
            // Creation d'un objet document vide
857
            // Creation d'un objet document vide
839
            $document = new document ("", $this->_db) ;
858
            $document = new document ("", $this->_db) ;
840
            // avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
859
            // avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
841
            $document->setIdProjet ($this->_id_projet) ;
860
            $document->setIdProjet ($this->_id_projet) ;
842
            $document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
861
            $document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
843
 
862
 
844
            // On passe aussi le numero de repertoire s'il existe
863
            // On passe aussi le numero de repertoire s'il existe
845
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
864
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
846
            if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
865
            if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
847
			//$GLOBALS['log'] .= '<br>this->_id_repertoire: '.$this->_id_repertoire.'<br>';
866
			//$GLOBALS['log'] .= '<br>this->_id_repertoire: '.$this->_id_repertoire.'<br>';
848
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
867
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
849
			//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
868
			//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
850
			//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
869
			//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
851
			$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
870
			$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
852
			$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
871
			$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
853
			
872
			
854
            if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
873
            if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
855
                return 'Echec de l\'upload<br />'.
874
                return 'Echec de l\'upload<br />'.
856
                		'Fichier source : '. $_FILES['fichier']['name'];
875
                		'Fichier source : '. $_FILES['fichier']['name'];
857
                		'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
876
                		'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
858
            }
877
            }
859
 
-
 
860
 
-
 
861
            //$document->enregistrerSQL($formulaire_document->getSubmitValues(), $projet->getNomRepertoire().'/'.$chemin_upload) ;
878
 
862
            $retour = $document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
879
            $document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
863
            // On place a 1 la colonne p_avoir_document
880
            // On place a 1 la colonne p_avoir_document
864
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
881
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
865
            
882
            
866
            // On ajoute une information de session
883
            // On ajoute une information de session
867
            $_SESSION['formulaire_document'] = 'valide';
884
            $_SESSION['formulaire_document'] = 'valide';
-
 
885
            
-
 
886
            // Pour notification coordinateur
-
 
887
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
-
 
888
        	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
-
 
889
							'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
-
 
890
							'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
-
 
891
            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
-
 
892
            $this->notifierCoordinateurs(PROJET_NOTIFICATION_NOUVEAU_DOC, $utilisateur);
868
        } else {
893
        } else {
869
            return $formulaire_document->toHTML() ;
894
            return $formulaire_document->toHTML() ;
870
        }
895
        }
871
        return $retour;
896
        return $retour;
872
        unset ($projet) ;
897
    }
873
    } // end of member function nouveauFichierValidation
-
 
874
 
898
 
875
    /**
899
    /**
876
     * Valide le formulaire et appelle la fonction d'insertion.
900
     * Valide le formulaire et appelle la fonction d'insertion.
877
     *
901
     *
878
     * @return void
902
     * @return void
879
     * @access public
903
     * @access public
880
     */
904
     */
881
    function modifierFichier( )
905
    function modifierFichier( )
882
    {
906
    {
883
        // creation de l'objet projet courant
907
        // creation de l'objet projet courant
884
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
908
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
885
        $projet = new projet ($this->_db, $this->_id_projet) ;
909
        $projet = new projet ($this->_db, $this->_id_projet) ;
886
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
910
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
887
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
911
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
888
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
912
        $formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
889
        $formulaire_document->construitFormulaire(PROJET_ACTION_MODIFIER_V) ;
913
        $formulaire_document->construitFormulaire(PROJET_ACTION_MODIFIER_V) ;
890
        if ($formulaire_document->validate()) {
914
        if ($formulaire_document->validate()) {
891
            // Creation d'un objet document vide
915
            // Creation d'un objet document vide
892
            $document = new document ($this->_id_document, $this->_db) ;
916
            $document = new document ($this->_id_document, $this->_db) ;
893
            // On passe aussi le numero de répertoire s'il existe
917
            // On passe aussi le numero de répertoire s'il existe
894
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
918
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
895
            $document->majSQL($formulaire_document->getSubmitValues()) ;
919
            $document->majSQL($formulaire_document->getSubmitValues()) ;
896
        } else {
920
        } else {
897
            return $formulaire_document->toHTML() ;
921
            return $formulaire_document->toHTML() ;
898
        }
922
        }
899
        unset ($projet) ;
923
        unset ($projet) ;
900
    } // end of member function nouveauFichierValidation
924
    } // end of member function nouveauFichierValidation
901
 
925
 
902
    /**
926
    /**
903
     * Valide le formulaire et appelle la fonction d'insertion.
927
     * Valide le formulaire et appelle la fonction d'insertion.
904
     *
928
     *
905
     * @return void
929
     * @return void
906
     * @access public
930
     * @access public
907
     */
931
     */
908
    function nouveauRepertoireValidation( )
932
    function nouveauRepertoireValidation( )
909
    {
933
    {
910
        // creation de l'objet projet courant
934
        // creation de l'objet projet courant
911
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
935
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
912
        $projet = new projet ($this->_db, $this->_id_projet) ;
936
        $projet = new projet ($this->_db, $this->_id_projet) ;
913
 
937
 
914
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
938
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
915
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
939
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
916
        $formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
940
        $formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
917
        $formulaire_repertoire->setType ('repertoire') ;
941
        $formulaire_repertoire->setType ('repertoire') ;
918
        $formulaire_repertoire->construitFormulaire() ;
942
        $formulaire_repertoire->construitFormulaire() ;
919
        if ($formulaire_repertoire->validate()) {
943
        if ($formulaire_repertoire->validate()) {
920
            // Creation d'un objet
944
            // Creation d'un objet
921
            $document = new document ("", $this->_db) ;
945
            $document = new document ("", $this->_db) ;
922
            // avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
946
            // avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
923
            $document->setIdProjet ($this->_id_projet) ;
947
            $document->setIdProjet ($this->_id_projet) ;
924
            $document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
948
            $document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
925
 
949
 
926
            // On passe aussi le numero de repertoire s'il existe
950
            // On passe aussi le numero de repertoire s'il existe
927
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
951
            if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
928
			if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
952
			if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
929
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
953
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
930
            $nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
954
            $nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
931
 
955
 
932
            // La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
956
            // La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
933
            $GLOBALS['log'] = '<br />chemin_upload:'.$chemin_upload.'<br />';
957
            $GLOBALS['log'] = '<br />chemin_upload:'.$chemin_upload.'<br />';
934
            $GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
958
            $GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
935
            if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.rtrim ($nom_repertoire, '/'))) {
959
            if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.rtrim ($nom_repertoire, '/'))) {
936
 
960
 
937
                $document->suppressionSQL() ;
961
                $document->suppressionSQL() ;
938
                return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
962
                return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
939
                						PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire;
963
                						PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire;
940
            }
964
            }
941
            // On place a 1 la colonne p_avoir_document
965
            // On place a 1 la colonne p_avoir_document
942
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
966
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
943
        } else {
967
        } else {
944
            return $formulaire_repertoire->toHTML() ;
968
            return $formulaire_repertoire->toHTML() ;
945
        }
969
        }
946
    }
970
    }
947
 
971
 
948
 
972
 
949
    /**
973
    /**
950
     * Permet de specifier au controleur sur quel projet l'on travaille.
974
     * Permet de specifier au controleur sur quel projet l'on travaille.
951
     *
975
     *
952
     * @param int id_projet L'identifiant du projet.
976
     * @param int id_projet L'identifiant du projet.
953
     * @return void
977
     * @return void
954
     * @access public
978
     * @access public
955
     */
979
     */
956
    function setIdProjet( $id_projet )
980
    function setIdProjet( $id_projet )
957
    {
981
    {
958
        $this->_id_projet = $id_projet ;
982
        $this->_id_projet = $id_projet ;
959
 
983
 
960
    } // end of member function setIdProjet
984
    } // end of member function setIdProjet
961
 
985
 
962
    /**
986
    /**
963
     * Renvoie la page d'accueil d'un projet.
987
     * Renvoie la page d'accueil d'un projet.
964
     *
988
     *
965
     * @return string
989
     * @return string
966
     * @access public
990
     * @access public
967
     */
991
     */
968
    function accueilProjet( )
992
    function accueilProjet( )
969
    {
993
    {
970
        $res = '' ;
994
        $res = '' ;
971
        // creation de l'objet projet courant
995
        // creation de l'objet projet courant
972
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
996
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
973
        $projet = new projet ($this->_db, $this->_id_projet) ;
997
        $projet = new projet ($this->_db, $this->_id_projet) ;
974
 
998
 
975
        // recuperation de la liste des documents associés
999
        // recuperation de la liste des documents associés
976
        $liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
1000
        $liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
977
 
1001
 
978
        // création de la vue liste de document, on nettoie l'url
1002
        // création de la vue liste de document, on nettoie l'url
979
        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1003
        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
980
        include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
1004
        include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
981
        $vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire) ;
1005
        $vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire) ;
982
 
1006
 
983
        // reglage de parametres de la vue
1007
        // reglage de parametres de la vue
984
        $vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
1008
        $vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
985
        $vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
1009
        $vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
986
 
1010
 
987
 
1011
 
988
        $tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
1012
        $tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
989
 
1013
 
990
        $vue_liste_document->setCheminNavigation ($tableau_navigation) ;
1014
        $vue_liste_document->setCheminNavigation ($tableau_navigation) ;
991
        // verification des droits de l'utilisateur
1015
        // verification des droits de l'utilisateur
992
        $entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_CREE_LE) ;
1016
        $entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_CREE_LE) ;
993
 
1017
 
994
        if ($this->_auth->getAuth()) {
1018
        if ($this->_auth->getAuth()) {
995
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1019
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
996
            $participant = new participe($this->_db) ;
1020
            $participant = new participe($this->_db) ;
997
            $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
1021
            $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
998
            $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
1022
            $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
999
            if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
1023
            if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
1000
            $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
1024
            $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
1001
            if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
1025
            if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
1002
            if ($isAdm) $isCoord = true ;
1026
            if ($isAdm) $isCoord = true ;
1003
 
1027
 
1004
            $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
1028
            $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
1005
            // si participant, on ajoute le champs visibilite
1029
            // si participant, on ajoute le champs visibilite
1006
 
1030
 
1007
            if ($statut !='' || $isAdm) {
1031
            if ($statut !='' || $isAdm) {
1008
                array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
1032
                array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
1009
            }
1033
            }
1010
            // si chef de projet ou si propriétaire d'au moins 1 document
1034
            // si chef de projet ou si propriétaire d'au moins 1 document
1011
            $proprietaire_un_document = false ;
1035
            $proprietaire_un_document = false ;
1012
 
1036
 
1013
            foreach ($liste_documents as $document) {
1037
            foreach ($liste_documents as $document) {
1014
                if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
1038
                if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
1015
                    $proprietaire_un_document = true ;
1039
                    $proprietaire_un_document = true ;
1016
                    $droits = PROJET_DROIT_PROPRIETAIRE ;
1040
                    $droits = PROJET_DROIT_PROPRIETAIRE ;
1017
                }
1041
                }
1018
            }
1042
            }
1019
            if ($statut > 0 || $proprietaire_un_document) {
1043
            if ($statut > 0 || $proprietaire_un_document) {
1020
                array_push ($entete_liste, PROJET_ACTION) ;
1044
                array_push ($entete_liste, PROJET_ACTION) ;
1021
            }
1045
            }
1022
        } else {
1046
        } else {
1023
            $droits = PROJET_DROIT_AUCUN ;
1047
            $droits = PROJET_DROIT_AUCUN ;
1024
        }
1048
        }
1025
        if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
1049
        if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
1026
 
1050
 
1027
        $vue_liste_document->construitEntete($entete_liste) ;
1051
        $vue_liste_document->construitEntete($entete_liste) ;
1028
        $vue_liste_document->construitListe ($liste_documents, $droits) ;
1052
        $vue_liste_document->construitListe ($liste_documents, $droits) ;
1029
 
1053
 
1030
        $wiki_res = '' ;
1054
        $wiki_res = '' ;
1031
        // Les wikinis associés au projet
1055
        // Les wikinis associes au projet
1032
        if ($projet->getWikini()) {
1056
        if ($projet->getWikini()) {
1033
            $wiki_res .= '<div><a href="'.PROJET_URL_WIKINI.'wakka.php?wiki=PagePrincipale&wikini='.$projet->getWikini().'">'.PROJET_URL_WIKINI.'</a>' ;
1057
            $wiki_res .= '<div><a href="'.PROJET_URL_WIKINI.'wakka.php?wiki=PagePrincipale&wikini='.$projet->getWikini().'">'.PROJET_URL_WIKINI.'</a>' ;
1034
            if ($this->_auth->getAuth() && $isCoord) {
1058
            if ($this->_auth->getAuth() && $isCoord) {
1035
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_WIKI) ;
1059
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_WIKI) ;
1036
                $wiki_res .= ' <a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_WIKINI_SUPPRIMER.' ?\')">'.PROJET_WIKINI_SUPPRIMER.'</a>' ;
1060
                $wiki_res .= ' <a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_WIKINI_SUPPRIMER.' ?\')">'.PROJET_WIKINI_SUPPRIMER.'</a>' ;
1037
            }
1061
            }
1038
            $wiki_res .= '</div>' ;
1062
            $wiki_res .= '</div>' ;
1039
        } else {
1063
        } else {
1040
            $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
1064
            $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
1041
        }
1065
        }
1042
        // On charge les listes de discussion du projet
1066
        // On charge les listes de discussion du projet
1043
        // Pour le moment seul ezmlm est supportée
1067
        // Pour le moment seul ezmlm est supportee
1044
 
1068
 
1045
        $projet->getListesAssociees();
1069
        $projet->getListesAssociees();
1046
        $sortie_liste = '' ;
1070
        $sortie_liste = '' ;
1047
 
1071
 
1048
        if ($projet->avoirListe()) {
1072
        if ($projet->avoirListe()) {
1049
            include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
1073
            include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
1050
            foreach ($projet->_listes_associes as $info_liste) {
1074
            foreach ($projet->_listes_associes as $info_liste) {
1051
 
1075
 
1052
                $liste = new ezmlm_php() ;
1076
                $liste = new ezmlm_php() ;
1053
                // Paramétrage de la liste
1077
                // Paramétrage de la liste
1054
 
1078
 
1055
                $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
1079
                $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
1056
                $liste->listname = $info_liste->getNom() ;
1080
                $liste->listname = $info_liste->getNom() ;
1057
                $liste->listdomain = $info_liste->getDomaine();
1081
                $liste->listdomain = $info_liste->getDomaine();
1058
 
1082
 
1059
                if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
1083
                if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
1060
                    $liste->set_action($GLOBALS['action']) ;
1084
                    $liste->set_action($GLOBALS['action']) ;
1061
                    $liste->set_actionargs($GLOBALS['actionargs']) ;
1085
                    $liste->set_actionargs($GLOBALS['actionargs']) ;
1062
                } else {
1086
                } else {
1063
                    $liste->set_action('list_info') ;
1087
                    $liste->set_action('list_info') ;
1064
                }
1088
                }
1065
                $liste->sendheaders	= false;
1089
                $liste->sendheaders	= false;
1066
                $liste->sendbody        = false;
1090
                $liste->sendbody        = false;
1067
                $liste->sendfooters    = false;
1091
                $liste->sendfooters    = false;
1068
                $liste->forcehref = $this->_url->getURL() ;
1092
                $liste->forcehref = $this->_url->getURL() ;
1069
 
1093
 
1070
                ob_start() ;
1094
                ob_start() ;
1071
                print '<span class="heading">Liste <strong>' . $info_liste->getAdresseEnvoi() ;
1095
                print '<span class="heading">Liste <strong>' . $info_liste->getAdresseEnvoi() ;
1072
                print "</strong></span><br />\n";
1096
                print "</strong></span><br />\n";
1073
                if ($this->_auth->getAuth()) {
1097
                if ($this->_auth->getAuth()) {
1074
                    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
1098
                    include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
1075
                    $inscription_liste = new inscription_liste($this->_db) ;
1099
                    $inscription_liste = new inscription_liste($this->_db) ;
1076
                    if ($inscription_liste->getStatutInscrit( $info_liste->getId(),  $this->_auth) == '') {
1100
                    if ($inscription_liste->getStatutInscrit( $info_liste->getId(),  $this->_auth) == '') {
1077
                        $action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
1101
                        $action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
1078
                        $label_inscription = PROJET_S_INSCRIRE ;
1102
                        $label_inscription = PROJET_S_INSCRIRE ;
1079
                    } else {
1103
                    } else {
1080
                        $action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
1104
                        $action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
1081
                        $label_inscription = PROJET_SE_DESINSCRIRE ;
1105
                        $label_inscription = PROJET_SE_DESINSCRIRE ;
1082
                    }
1106
                    }
1083
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
1107
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
1084
                    print '<a href="'.$this->_url->getURL().'">';
1108
                    print '<a href="'.$this->_url->getURL().'">';
1085
                    print $label_inscription.'</a><br /> ';
1109
                    print $label_inscription.'</a><br /> ';
1086
                }
1110
                }
1087
                print "\n<hr noshade><br />\n";
1111
                print "\n<hr noshade><br />\n";
1088
                $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1112
                $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1089
                switch ($liste->action) {
1113
                switch ($liste->action) {
1090
                    case "show_msg":
1114
                    case "show_msg":
1091
                        if (count($liste->actionargs) < 2) {
1115
                        if (count($liste->actionargs) < 2) {
1092
                            $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
1116
                            $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
1093
                        }
1117
                        }
1094
                        $show_msg = new ezmlm_msgdisplay();
1118
                        $show_msg = new ezmlm_msgdisplay();
1095
                        $show_msg->listdir = $liste->listdir ;
1119
                        $show_msg->listdir = $liste->listdir ;
1096
                        $show_msg->forcehref = $this->_url->getURL();
1120
                        $show_msg->forcehref = $this->_url->getURL();
1097
                        // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
1121
                        // actionargs[0] contient le nom du repertoire et actionargs[1] le nom du fichier
1098
                        // On appelle la fonction qui affiche un fichier
1122
                        // On appelle la fonction qui affiche un fichier
1099
                        $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
1123
                        $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
1100
                        break;
1124
                        break;
1101
 
1125
 
1102
                    case "list_info":
1126
                    case "list_info":
1103
                        $info = new ezmlm_listinfo();
1127
                        $info = new ezmlm_listinfo();
1104
                        if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
1128
                        if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
1105
                        $info->forcehref = $this->_url->getURL();
1129
                        $info->forcehref = $this->_url->getURL();
1106
                        $info->listdir = $liste->listdir ;
1130
                        $info->listdir = $liste->listdir ;
1107
                        $info->listname = $info_liste->getNom();
1131
                        $info->listname = $info_liste->getNom();
1108
                        $info->listdomain = $info_liste->getDomaine() ;
1132
                        $info->listdomain = $info_liste->getDomaine() ;
1109
 
1133
 
1110
                        if (!$info->display()) {
1134
                        if (!$info->display()) {
1111
                            echo 'Pas de message dans cette liste' ;
1135
                            echo 'Pas de message dans cette liste' ;
1112
                        }
1136
                        }
1113
                        break;
1137
                        break;
1114
                    case "show_threads":
1138
                    case "show_threads":
1115
                        $threads = new ezmlm_threads();
1139
                        $threads = new ezmlm_threads();
1116
                        $threads->forcehref = $this->_url->getURL() ;
1140
                        $threads->forcehref = $this->_url->getURL() ;
1117
                        $threads->listdir = $liste->listdir ;
1141
                        $threads->listdir = $liste->listdir ;
1118
                        $threads->listname = $info_liste->getNom() ;
1142
                        $threads->listname = $info_liste->getNom() ;
1119
                        $threads->listdomain = $info_liste->getDomaine() ;
1143
                        $threads->listdomain = $info_liste->getDomaine() ;
1120
                        $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
1144
                        $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
1121
                        $threads->load($liste->actionargs[0]);
1145
                        $threads->load($liste->actionargs[0]);
1122
                        break;
1146
                        break;
1123
                    case "show_author_msgs" :
1147
                    case "show_author_msgs" :
1124
                        $author = new ezmlm_author();
1148
                        $author = new ezmlm_author();
1125
                        $author->listdir = $liste->listdir ;
1149
                        $author->listdir = $liste->listdir ;
1126
                        $author->listname = $info_liste->getNom() ;
1150
                        $author->listname = $info_liste->getNom() ;
1127
                        $author->listdomain = $info_liste->getDomaine() ;
1151
                        $author->listdomain = $info_liste->getDomaine() ;
1128
                        $author->forcehref = $this->_url->getURL() ;
1152
                        $author->forcehref = $this->_url->getURL() ;
1129
                        $author->display($liste->actionargs[0]);
1153
                        $author->display($liste->actionargs[0]);
1130
                    break ;
1154
                    break ;
1131
                }
1155
                }
1132
                $sortie_liste = ob_get_contents() ;
1156
                $sortie_liste = ob_get_contents() ;
1133
                ob_end_clean() ;
1157
                ob_end_clean() ;
1134
            }
1158
            }
1135
        } else {
1159
        } else {
1136
            $sortie_liste = '<div>'.PROJET_PAS_DE_LISTE.'</div>'."\n" ;
1160
            $sortie_liste = '<div>'.PROJET_PAS_DE_LISTE.'</div>'."\n" ;
1137
        }
1161
        }
1138
 
1162
 
1139
        $res .= "<h1>".$projet->getTitre()."</h1>" ;
1163
        $res .= "<h1>".$projet->getTitre()."</h1>" ;
1140
        $res .= '<div>'.$projet->getDescription().'</div>'."\n" ;
1164
        $res .= '<div>'.$projet->getDescription().'</div>'."\n" ;
1141
        $res .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
1165
        $res .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
1142
        $res .= $wiki_res ;
1166
        $res .= $wiki_res ;
1143
        $res .= '<h2>'.PROJET_FICHIERS_ASSOCIES.'</h2>'."\n" ;
1167
        $res .= '<h2>'.PROJET_FICHIERS_ASSOCIES.'</h2>'."\n" ;
1144
        $res .= $vue_liste_document->toHTML() ;
1168
        $res .= $vue_liste_document->toHTML() ;
1145
        $res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
1169
        $res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
1146
        $res .= $sortie_liste ;
1170
        $res .= $sortie_liste ;
1147
 
1171
 
1148
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1172
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1149
        $listes_ext = new liste_externe ($this->_db) ;
1173
        $listes_ext = new liste_externe ($this->_db) ;
1150
        $tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
1174
        $tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
1151
 
1175
 
1152
        if (count ($tableau_liste) != 0) {
1176
        if (count ($tableau_liste) != 0) {
1153
            $res .= '<h2>'.PROJET_LISTES_EXTERNES_ASSOCIEES.'</h2>'."\n" ;
1177
            $res .= '<h2>'.PROJET_LISTES_EXTERNES_ASSOCIEES.'</h2>'."\n" ;
1154
            for ($i = 0; $i < count ($tableau_liste); $i++) {
1178
            for ($i = 0; $i < count ($tableau_liste); $i++) {
1155
                $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
1179
                $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
1156
                $res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
1180
                $res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
1157
                $res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
1181
                $res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
1158
                $res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
1182
                $res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
1159
                $res .= '<br />'."\n" ;
1183
                $res .= '<br />'."\n" ;
1160
            }
1184
            }
1161
        }
1185
        }
1162
        return $res ;
1186
        return $res ;
1163
    } // end of member function accueilProjet
1187
    } // end of member function accueilProjet
1164
 
1188
 
1165
    /**
1189
    /**
1166
     * Permet de specifier quel repertoire, dans la vue de document afficher. Il sera
1190
     * Permet de specifier quel repertoire, dans la vue de document afficher. Il sera
1167
     * passe en parametre a la classe HTML_listeDocuments.
1191
     * passe en parametre a la classe HTML_listeDocuments.
1168
     *
1192
     *
1169
     * @param int id_repertoire L'identifiant du repertoire a afficher.
1193
     * @param int id_repertoire L'identifiant du repertoire a afficher.
1170
     * @return void
1194
     * @return void
1171
     * @access public
1195
     * @access public
1172
     */
1196
     */
1173
    function setIdRepertoire( $id_repertoire )
1197
    function setIdRepertoire( $id_repertoire )
1174
    {
1198
    {
1175
        $this->_id_repertoire = $id_repertoire ;
1199
        $this->_id_repertoire = $id_repertoire ;
1176
    }
1200
    }
1177
 
1201
 
1178
    /**
1202
    /**
1179
     * Supprime un projet et tout ce qui va avec.
1203
     * Supprime un projet et tout ce qui va avec.
1180
     *
1204
     *
1181
     * @return void
1205
     * @return void
1182
     * @access public
1206
     * @access public
1183
     */
1207
     */
1184
    function suppressionProjet( )
1208
    function suppressionProjet( )
1185
    {
1209
    {
1186
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1210
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1187
        $projet = new projet ($this->_db, $this->_id_projet) ;
1211
        $projet = new projet ($this->_db, $this->_id_projet) ;
1188
        $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
1212
        $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
1189
        $projet->getListesAssociees() ;
1213
        $projet->getListesAssociees() ;
1190
        if ($projet->avoirListe()) $projet->supprimerListe($projet->_listes_associes[0]) ;
1214
        if ($projet->avoirListe()) $projet->supprimerListe($projet->_listes_associes[0]) ;
1191
        $msg = $projet->suppressionSQL() ;
1215
        $msg = $projet->suppressionSQL() ;
1192
        unset ($this->_id_projet) ; unset($_GET['id_projet']);
1216
        unset ($this->_id_projet) ; unset($_GET['id_projet']);
1193
        return $msg ;
1217
        return $msg ;
1194
    }
1218
    }
1195
 
1219
 
1196
    /**
1220
    /**
1197
     * Permet d'indiquer au controleur sur quel document on travaille.
1221
     * Permet d'indiquer au controleur sur quel document on travaille.
1198
     *
1222
     *
1199
     * @param int id_document
1223
     * @param int id_document
1200
     * @return void
1224
     * @return void
1201
     * @access public
1225
     * @access public
1202
     */
1226
     */
1203
    function setIdDocument( $id_document )
1227
    function setIdDocument( $id_document )
1204
    {
1228
    {
1205
        $this->_id_document = $id_document ;
1229
        $this->_id_document = $id_document ;
1206
    }
1230
    }
1207
 
1231
 
1208
 
1232
 
1209
    /**
1233
    /**
1210
     * Renvoie le formulaire d'envoie de mail
1234
     * Renvoie le formulaire d'envoie de mail
1211
     *
1235
     *
1212
     * @return void
1236
     * @return void
1213
     * @access public
1237
     * @access public
1214
     */
1238
     */
1215
    function envoyerUnMailFormulaire( )
1239
    function envoyerUnMailFormulaire( )
1216
    {
1240
    {
1217
    	if (!$this->_auth->getAuth()) {
1241
    	if (!$this->_auth->getAuth()) {
1218
    		return PROJET_LISTE_PROJET;	
1242
    		return PROJET_LISTE_PROJET;	
1219
    	}
1243
    	}
1220
    	if (isset($_SESSION['formulaire_mail'])) {
1244
    	if (isset($_SESSION['formulaire_mail'])) {
1221
            unset ($_SESSION['formulaire_mail']) ;
1245
            unset ($_SESSION['formulaire_mail']) ;
1222
        }
1246
        }
1223
        $res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
1247
        $res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
1224
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V) ;
1248
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V) ;
1225
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1249
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1226
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1250
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1227
        $formulaire_mail->construitFormulaire() ;
1251
        $formulaire_mail->construitFormulaire() ;
1228
        return $res.$formulaire_mail->toHTML() ;
1252
        return $res.$formulaire_mail->toHTML() ;
1229
    }
1253
    }
1230
 
1254
 
1231
    /**
1255
    /**
1232
     * Envoie le mail
1256
     * Envoie le mail
1233
     *
1257
     *
1234
     * @return void
1258
     * @return void
1235
     * @access public
1259
     * @access public
1236
     */
1260
     */
1237
    function envoyerUnMailValidation( )
1261
    function envoyerUnMailValidation( )
1238
    {
1262
    {
1239
        // Verifications
1263
        // Verifications
1240
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1264
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1241
            return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1265
            return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1242
        }
1266
        }
1243
        
1267
        
1244
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1268
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1245
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1269
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1246
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1270
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1247
        $formulaire_mail->construitFormulaire() ;
1271
        $formulaire_mail->construitFormulaire() ;
1248
        if ($formulaire_mail->validate()) {
1272
        if ($formulaire_mail->validate()) {
1249
            // creation de l'objet projet courant
1273
            // creation de l'objet projet courant
1250
            include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1274
            include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1251
            $projet = new projet ($this->_db, $this->_id_projet) ;
1275
            $projet = new projet ($this->_db, $this->_id_projet) ;
1252
            $info_liste = $projet->getListesAssociees() ;
1276
            $info_liste = $projet->getListesAssociees() ;
1253
            $valeurs_mail = $formulaire_mail->getSubmitValues() ;
1277
            $valeurs_mail = $formulaire_mail->getSubmitValues() ;
1254
            // Pour envoyer le mail on utilise la classe Mail de PEAR
1278
            // Pour envoyer le mail on utilise la classe Mail de PEAR
1255
            // on a besoin du mail de l'inscrit
1279
            // on a besoin du mail de l'inscrit
1256
 
1280
 
1257
            $entetes['From'] = $this->_auth->getUserName();
1281
            $entetes['From'] = $this->_auth->getUserName();
1258
            $entetes['To'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
1282
            $entetes['To'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
1259
            $entetes['Subject'] = $valeurs_mail['mail_titre'] ;
1283
            $entetes['Subject'] = $valeurs_mail['mail_titre'] ;
1260
            $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1284
            $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1261
            $entetes['Message-ID'] = md5(time()).'@'.$projet->_listes_associes[0]->getNom().'.'.$projet->_listes_associes[0]->getDomaine() ;
1285
            $entetes['Message-ID'] = md5(time()).'@'.$projet->_listes_associes[0]->getNom().'.'.$projet->_listes_associes[0]->getDomaine() ;
1262
            $entetes['reply-to'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
1286
            $entetes['reply-to'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
1263
            $entetes['Content-Type'] = 'text/plain' ;
1287
            $entetes['Content-Type'] = 'text/plain' ;
1264
            // Traitement de la reference s'il s'agit d'une reponse
1288
            // Traitement de la reference s'il s'agit d'une reponse
1265
            if (isset ($_POST['messageid'])) {
1289
            if (isset ($_POST['messageid'])) {
1266
                $entetes['In-Reply-To'] = $_POST['messageid'] ;
1290
                $entetes['In-Reply-To'] = $_POST['messageid'] ;
1267
            }
1291
            }
1268
            $objet_mail =& Mail::factory('smtp');
1292
            $objet_mail =& Mail::factory('smtp');
1269
            $objet_mail->send($entetes['To'], $entetes, $valeurs_mail['mail_corps']);
1293
            $objet_mail->send($entetes['To'], $entetes, $valeurs_mail['mail_corps']);
1270
            $_SESSION['formulaire_mail'] = 'valide';
1294
            $_SESSION['formulaire_mail'] = 'valide';
1271
            return  ;
1295
            return  ;
1272
        } else {
1296
        } else {
1273
            return $formulaire_mail->toHTML() ;
1297
            return $formulaire_mail->toHTML() ;
1274
        }
1298
        }
1275
    } // end of member function envoyerUnMailValidation
1299
    } // end of member function envoyerUnMailValidation
1276
 
1300
 
1277
   /**
1301
   /**
1278
     * Renvoie le formulaire de création d'une liste.
1302
     * Renvoie le formulaire de création d'une liste.
1279
     *
1303
     *
1280
     * @param int action Indique le type d'action,  PROJET_ACTION_NOUVELLE_LISTE
1304
     * @param int action Indique le type d'action,  PROJET_ACTION_NOUVELLE_LISTE
1281
     * @return string
1305
     * @return string
1282
     * @access public
1306
     * @access public
1283
     */
1307
     */
1284
    function formulaireListe( $action )
1308
    function formulaireListe( $action )
1285
    {
1309
    {
1286
        $res = '<h1>'.PROJET_CREATION_LISTE.'</h1>'."\n" ;
1310
        $res = '<h1>'.PROJET_CREATION_LISTE.'</h1>'."\n" ;
1287
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V) ;
1311
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V) ;
1288
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
1312
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
1289
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1313
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1290
        $formulaire_liste->construitFormulaire() ;
1314
        $formulaire_liste->construitFormulaire() ;
1291
        $formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
1315
        $formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
1292
        $formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
1316
        $formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
1293
        return $res.$formulaire_liste->toHTML() ;
1317
        return $res.$formulaire_liste->toHTML() ;
1294
    } 
1318
    } 
1295
 
1319
 
1296
    /**
1320
    /**
1297
     * Transmet au serveur la demande de création d'une nouvelle liste.
1321
     * Transmet au serveur la demande de création d'une nouvelle liste.
1298
     *
1322
     *
1299
     * @return void
1323
     * @return void
1300
     * @access public
1324
     * @access public
1301
     */
1325
     */
1302
    function nouvelleListeValidation( )
1326
    function nouvelleListeValidation( )
1303
    {
1327
    {
1304
        // Verifications
1328
        // Verifications
1305
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V );
1329
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V );
1306
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
1330
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
1307
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1331
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1308
        $formulaire_liste->construitFormulaire() ;
1332
        $formulaire_liste->construitFormulaire() ;
1309
        if ($formulaire_liste->validate()) {
1333
        if ($formulaire_liste->validate()) {
1310
            // creation de l'objet liste_discussion
1334
            // creation de l'objet liste_discussion
1311
            include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php';
1335
            include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php';
1312
            $liste = new liste_discussion('', $this->_db) ;
1336
            $liste = new liste_discussion('', $this->_db) ;
1313
 
1337
 
1314
            // On vérifie que le nom de la liste soit unique
1338
            // On vérifie que le nom de la liste soit unique
1315
            if (liste_discussion::verifieDoubleListe($formulaire_liste->getSubmitValue('nom_liste').'@'.
1339
            if (liste_discussion::verifieDoubleListe($formulaire_liste->getSubmitValue('nom_liste').'@'.
1316
                                                            $formulaire_liste->getSubmitValue('domaine_liste'), $this->_db)) {
1340
                                                            $formulaire_liste->getSubmitValue('domaine_liste'), $this->_db)) {
1317
                // On rajoute la liste dans la base
1341
                // On rajoute la liste dans la base
1318
                $liste->enregistrerSQL($formulaire_liste->getSubmitValues()) ;
1342
                $liste->enregistrerSQL($formulaire_liste->getSubmitValues()) ;
1319
 
1343
 
1320
                // On la relie au projet
1344
                // On la relie au projet
1321
                include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1345
                include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1322
                $projet = new projet ($this->_db, $this->_id_projet) ;
1346
                $projet = new projet ($this->_db, $this->_id_projet) ;
1323
                $projet->ajouterListe($liste) ;
1347
                $projet->ajouterListe($liste) ;
1324
 
1348
 
1325
                // Creation de la liste
1349
                // Creation de la liste
1326
                $resultat_creation = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/creation_liste.php?domaine='.
1350
                $resultat_creation = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/creation_liste.php?domaine='.
1327
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&parametres=aBiud') ;
1351
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&parametres=aBiud') ;
1328
 
1352
 
1329
                // Ajout du moderateur
1353
                // Ajout du moderateur
1330
                $resultat_ajout_moderateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_moderateur.php?domaine='.
1354
                $resultat_ajout_moderateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_moderateur.php?domaine='.
1331
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
1355
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
1332
                // Ajout du moderateur en tant qu'utilisateur
1356
                // Ajout du moderateur en tant qu'utilisateur
1333
                $resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
1357
                $resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
1334
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
1358
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
1335
 
1359
 
1336
            } else {
1360
            } else {
1337
                return PROJET_MESSAGE_LISTE_DOUBLE.$formulaire_liste->toHTML() ;
1361
                return PROJET_MESSAGE_LISTE_DOUBLE.$formulaire_liste->toHTML() ;
1338
            }
1362
            }
1339
            return $resultat_creation.$resultat_ajout_moderateur.$resultat_ajout_utilisateur;
1363
            return $resultat_creation.$resultat_ajout_moderateur.$resultat_ajout_utilisateur;
1340
 
1364
 
1341
        } else {
1365
        } else {
1342
            return $formulaire_liste->toHTML() ;
1366
            return $formulaire_liste->toHTML() ;
1343
        }
1367
        }
1344
    } // end of member function nouvelleListeValidation
1368
    } // end of member function nouvelleListeValidation
1345
 
1369
 
1346
    /**
1370
    /**
1347
     * Supprime la liste de discussion associée au projet
1371
     * Supprime la liste de discussion associée au projet
1348
     *
1372
     *
1349
     * @return void
1373
     * @return void
1350
     * @access public
1374
     * @access public
1351
     */
1375
     */
1352
    function supprimerListe( )
1376
    function supprimerListe( )
1353
    {
1377
    {
1354
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1378
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1355
        $projet = new projet($this->_db, $this->_id_projet) ;
1379
        $projet = new projet($this->_db, $this->_id_projet) ;
1356
        $projet->getListesAssociees() ;
1380
        $projet->getListesAssociees() ;
1357
 
1381
 
1358
        $resultat_suppression = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/suppression_liste.php?domaine='.
1382
        $resultat_suppression = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/suppression_liste.php?domaine='.
1359
                                    $projet->_listes_associes[0]->getDomaine().'&liste='.$projet->_listes_associes[0]->getNom()) ;
1383
                                    $projet->_listes_associes[0]->getDomaine().'&liste='.$projet->_listes_associes[0]->getNom()) ;
1360
        $projet->supprimerListe($projet->_listes_associes[0]) ;
1384
        $projet->supprimerListe($projet->_listes_associes[0]) ;
1361
        return $resultat_suppression;
1385
        return $resultat_suppression;
1362
    } // end of member function supprimerListe
1386
    } // end of member function supprimerListe
1363
 
1387
 
1364
 
1388
 
1365
    /**
1389
    /**
1366
     *
1390
     *
1367
     *
1391
     *
1368
     * @param string presentation Pour affecter une présentation au projet
1392
     * @param string presentation Pour affecter une présentation au projet
1369
     * @return void
1393
     * @return void
1370
     * @access public
1394
     * @access public
1371
     */
1395
     */
1372
    function setPresentation( $presentation )
1396
    function setPresentation( $presentation )
1373
    {
1397
    {
1374
        $this->_presentation = $presentation ;
1398
        $this->_presentation = $presentation ;
1375
    } // end of member function setPresentation
1399
    } // end of member function setPresentation
1376
 
1400
 
1377
    /**
1401
    /**
1378
     *
1402
     *
1379
     *
1403
     *
1380
     * @param string type Pour affecter un type au projet
1404
     * @param string type Pour affecter un type au projet
1381
     * @return void
1405
     * @return void
1382
     * @access public
1406
     * @access public
1383
     */
1407
     */
1384
    function setType( $type)
1408
    function setType( $type)
1385
    {
1409
    {
1386
        $this->_type = $type ;
1410
        $this->_type = $type ;
1387
    } // end of member function setPresentation
1411
    } // end of member function setPresentation
1388
 
1412
 
1389
 
1413
 
1390
    /**
1414
    /**
1391
     * Fonction affichant les participants à un projet
1415
     * Fonction affichant les participants à un projet
1392
     *
1416
     *
1393
     * @return string
1417
     * @return string
1394
     * @access public
1418
     * @access public
1395
     */
1419
     */
1396
    function voirParticipants( )
1420
    function voirParticipants( )
1397
    {
1421
    {
1398
        include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
1422
        include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
1399
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1423
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1400
        $projet = new projet ($this->_db, $this->_id_projet) ;
1424
        $projet = new projet ($this->_db, $this->_id_projet) ;
1401
        $titre = '<h1>'.$projet->getTitre().'</h1>'."\n" ;
1425
        $titre = '<h1>'.$projet->getTitre().'</h1>'."\n" ;
1402
        $titre .= '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
1426
        $titre .= '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
1403
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1427
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1404
        $participants = new participe($this->_db) ;
1428
        $participants = new participe($this->_db) ;
1405
 
1429
 
1406
        // On teste ici s'il y a une mise à jour de statut
1430
        // On teste ici s'il y a une mise à jour de statut
1407
        if (isset($_POST['statut'])) {
1431
        if (isset($_POST['statut'])) {
1408
            // $_GET['id_utilisateur'] et $_GET['statut'] proviennent du formulaire voir HTML_listeParticipants
1432
            // $_GET['id_utilisateur'] et $_GET['statut'] proviennent du formulaire voir HTML_listeParticipants
1409
            $participants->setStatut($_POST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
1433
            $participants->setStatut($_POST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
1410
        }
1434
        }
1411
 
1435
 
1412
        // Ce qui suit doit être amàliorà pour sortir la requête sur l'annuaire
1436
        // Ce qui suit doit être amàliorà pour sortir la requête sur l'annuaire
1413
        // On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
1437
        // On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
1414
        if (isset($_POST['mail_utilisateur'])) {
1438
        if (isset($_POST['mail_utilisateur'])) {
1415
            $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
1439
            $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
1416
            $resultat = $this->_db->query ($requete) ;
1440
            $resultat = $this->_db->query ($requete) ;
1417
            if (DB::isError ($resultat)) {
1441
            if (DB::isError ($resultat)) {
1418
                die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
1442
                die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
1419
            }
1443
            }
1420
            if (!$resultat->numRows()) {
1444
            if (!$resultat->numRows()) {
1421
                $msg = PROJET_MAIL_ABSENT;
1445
                $msg = PROJET_MAIL_ABSENT;
1422
            } else {
1446
            } else {
1423
                $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
1447
                $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
1424
                $participants->setStatut(3, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
1448
                $participants->setStatut(3, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
1425
            }
1449
            }
1426
        }
1450
        }
1427
 
1451
 
1428
        if ($this->_auth->getAuth()) {
1452
        if ($this->_auth->getAuth()) {
1429
            $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
1453
            $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
1430
            if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
1454
            if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
1431
            if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
1455
            if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
1432
            if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
1456
            if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
1433
            $HTML_listeParticipants = new HTML_listeParticipants(true) ;
1457
            $HTML_listeParticipants = new HTML_listeParticipants(true) ;
1434
            if ($statut < 2) $HTML_listeParticipants->setModeModification() ;
1458
            if ($statut < 2) $HTML_listeParticipants->setModeModification() ;
1435
            // Mise en place de l'url
1459
            // Mise en place de l'url
1436
            $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
1460
            $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
1437
            $HTML_listeParticipants->setURL($this->_url) ;
1461
            $HTML_listeParticipants->setURL($this->_url) ;
1438
            // Construction de l'entete
1462
            // Construction de l'entete
1439
            $entete = array (PROJET_NOM, PROJET_PRENOM) ;
1463
            $entete = array (PROJET_NOM, PROJET_PRENOM) ;
1440
 
1464
 
1441
            if ($this->_auth->getAuth()) {
1465
            if ($this->_auth->getAuth()) {
1442
                array_push ($entete, PROJET_MAIL) ;
1466
                array_push ($entete, PROJET_MAIL) ;
1443
            } else {
1467
            } else {
1444
               $droits = PROJET_DROIT_AUCUN ;
1468
               $droits = PROJET_DROIT_AUCUN ;
1445
            }
1469
            }
1446
            $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
1470
            $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
1447
            array_push ($entete, PROJET_DATE_INSCRIPTION) ;
1471
            array_push ($entete, PROJET_DATE_INSCRIPTION) ;
1448
            $HTML_listeParticipants->construitEntete($entete) ;
1472
            $HTML_listeParticipants->construitEntete($entete) ;
1449
 
1473
 
1450
            $HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM_COORD, $this->_db)) ;
1474
            $HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM_COORD, $this->_db)) ;
1451
 
1475
 
1452
            $res = $HTML_listeParticipants->toHTML() ;
1476
            $res = $HTML_listeParticipants->toHTML() ;
1453
 
1477
 
1454
            if ($statut < 2) {
1478
            if ($statut < 2) {
1455
                $res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
1479
                $res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
1456
                $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
1480
                $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
1457
                if (isset ($msg) && $msg != '') {
1481
                if (isset ($msg) && $msg != '') {
1458
                    $res .= '<div>'.$msg.'</div>' ;
1482
                    $res .= '<div>'.$msg.'</div>' ;
1459
                }
1483
                }
1460
                $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
1484
                $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
1461
                $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
1485
                $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
1462
                $res .= '</form>'."\n" ;
1486
                $res .= '</form>'."\n" ;
1463
            }
1487
            }
1464
        } else {
1488
        } else {
1465
            $res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
1489
            $res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
1466
        }
1490
        }
1467
        return $titre.$res ;
1491
        return $titre.$res ;
1468
 
1492
 
1469
    } // end of member function voirParticipants
1493
    } // end of member function voirParticipants
1470
 
1494
 
1471
    /**
1495
    /**
1472
     * Inscrit un utilisateur a un projet avec le statut observateur
1496
     * Inscrit un utilisateur a un projet avec le statut observateur
1473
     *
1497
     *
1474
     * @return void
1498
     * @return void
1475
     * @access public
1499
     * @access public
1476
     */
1500
     */
1477
    function inscriptionProjet( )
1501
    function inscriptionProjet( )
1478
    {
1502
    {
1479
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireInscriptionProjet.class.php' ;
1503
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireInscriptionProjet.class.php' ;
1480
		include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1504
		include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1481
        $projet = new projet ($this->_db, $this->_id_projet) ;
1505
        $projet = new projet ($this->_db, $this->_id_projet) ;
1482
 
1506
 
1483
        // Si le projet n'a pas de liste, on inscrit directement
1507
        // Si le projet n'a pas de liste, on inscrit directement
1484
        if (isset ($this->_id_projet)) {
1508
        if (isset ($this->_id_projet)) {
1485
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1509
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1486
            $participant = new participe($this->_db) ;
1510
            $participant = new participe($this->_db) ;
1487
 
1511
			
-
 
1512
			// On controle si la liste est externe (yahoo) auquel cas on ne presente pas l inscription
-
 
1513
			include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
-
 
1514
			$liste_ext = new liste_externe($this->_db);
-
 
1515
			$listes = $liste_ext->getListesAssociees($this->_id_projet);
-
 
1516
			$info_liste = $liste_ext->getInfoListe($listes[0]);
-
 
1517
			if (count ($listes) != 0) {
-
 
1518
				$avoir_liste_externe = true;
-
 
1519
				$msg = '';
-
 
1520
				$msg = 'Pour vous inscrire &agrave; la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes, <a href="mailto:';
-
 
1521
				$msg .= $info_liste->AGO_A_MAILABO.'">cliquez ici</a>';
-
 
1522
			} else {
-
 
1523
				$avoir_liste_externe = false;
-
 
1524
			}
1488
            if (!$projet->avoirListe()) {
1525
            if (!$projet->avoirListe() || $avoir_liste_externe) {
1489
            	if ($projet->isModere()) {
1526
            	if ($projet->isModere()) {
1490
                	$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1527
                	$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1491
            	} else {
1528
            	} else {
1492
            		$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1529
            		$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;     		 
-
 
1530
            		$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
1493
            	}
1531
            	}
-
 
1532
            	$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
-
 
1533
    			include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1494
                return $this->mesProjets() ;
1534
    			return $retour;
1495
            }
1535
            }
1496
        }
1536
        }
1497
        if (isset($_POST['valider_inscription_projet'])) {
1537
        if (isset($_POST['valider_inscription_projet'])) {
1498
            if (isset($_POST['radio_inscription_liste'])) {
1538
            if (isset($_POST['radio_inscription_liste'])) {
1499
            	include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1539
            	include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1500
            	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
1540
            	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
1501
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1541
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1502
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1542
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1503
	            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1543
	            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1504
            
1544
            
1505
            	if (!$projet->isModere()) {
1545
            	if (!$projet->isModere()) {
1506
	                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1546
	                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
-
 
1547
	                
1507
	                
1548
	                if ($_POST['radio_inscription_liste'] == 2) {
1508
	                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1549
		                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1509
	                $projet->getListesAssociees() ;
1550
		                $projet->getListesAssociees() ;
1510
	                $inscription_liste = new inscription_liste($this->_db) ;
1551
		                $inscription_liste = new inscription_liste($this->_db) ;
1511
	                $inscription_liste->inscrireUtilisateur( $utilisateur,
1552
		                $inscription_liste->inscrireUtilisateur( $utilisateur,
1512
                                                        $projet->_listes_associes[0],
1553
	                                                        $projet->_listes_associes[0],
-
 
1554
	                                                        $_POST['radio_inscription_liste']) ;
-
 
1555
	                }
1513
                                                        $_POST['radio_inscription_liste']) ;
1556
                    $this->notifierCoordinateurs(PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE, $utilisateur);
1514
            	} else {
1557
            	} else {
1515
            		$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
-
 
1516
            		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
-
 
1517
            		
-
 
1518
            		$entetes['From'] = $this->_auth->getUserName();
-
 
1519
		            $entetes['To'] = '';
-
 
1520
		            $entetes['Subject'] = PROJET_DEMANDE_INSCRIPTION ;
-
 
1521
		            $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
-
 
1522
		            $entetes['Message-ID'] = md5(time()) ;
-
 
1523
		            $entetes['reply-to'] = '' ;
-
 
1524
		            $entetes['Content-Type'] = 'text/plain' ;
-
 
1525
		            
-
 
1526
		            $objet_mail =& Mail::factory('smtp');
-
 
1527
		            require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/HTML/Template/IT.php';
-
 
1528
				    $tpl = new HTML_Template_IT() ;
-
 
1529
				    // Le gabarit du mail est dans un template
-
 
1530
				    // template 1
-
 
1531
				    $requete = 'select pt_template from projet_template where pt_id_template=1'.
-
 
1532
				    			' and pt_i18n like "%'.PROJET_LANGUE_DEFAUT.'"' ;
-
 
1533
				    
-
 
1534
				    if (!$tpl -> setTemplate($this->_db->getOne ($requete))) {
-
 
1535
				    	echo 'erreur' ;	
-
 
1536
				    }
-
 
1537
					$tpl->setVariable('nom', $utilisateur->getInfo( 'nom')) ;
-
 
1538
					$tpl->setVariable('prenom', $utilisateur->getInfo( 'prenom')) ;
-
 
1539
					$tpl->setVariable('nom_projet', $projet->getTitre()) ;
-
 
1540
					$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
-
 
1541
				
-
 
1542
            		foreach ($tableau_coordinateur as $coordinateur) {
-
 
1543
            			$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
-
 
1544
            			
-
 
1545
            		}
-
 
1546
            		// On enleve la virgule finale
-
 
1547
            		
-
 
1548
            		$entetes['To'] = substr ($entetes['To'], 0, -1);
-
 
1549
 
1558
            		$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1550
            		// on envoie le mail
1559
            		
1551
            		$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($tpl->get()));
1560
            		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DEMANDE_INSCRIPTION, $utilisateur);
1552
            	}
1561
            	}
1553
            }
1562
            }
1554
 
1563
 
1555
            if ($this->_presentation != 'arbre') {
1564
            if ($this->_presentation != 'arbre') {
1556
                if ($projet->isModere()) return '<h1>'.$projet->getTitre().'</h1>'.
1565
                if ($projet->isModere()) return '<h1>'.$projet->getTitre().'</h1>'.
1557
                		str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
1566
                		str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
-
 
1567
                		else {
-
 
1568
                			$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
1558
                		else $this->_action = PROJET_ACTION_VOIR_RESUME;
1569
                			include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
-
 
1570
                			return $retour;
-
 
1571
                		}
1559
            } else {
1572
            } else {
1560
                $this->_action = PROJET_ACTION_VOIR_RESUME;
1573
                $this->_action = PROJET_ACTION_VOIR_RESUME;
1561
            }
1574
            }
1562
            return PROJET_LAIUS_INSCRIPTION_MODERE;
1575
            return PROJET_LAIUS_INSCRIPTION_MODERE;
1563
        }
1576
        }
1564
        $res = '<h1>'.PROJET_INSCRIPTION_PROJET.' : '.$projet->getTitre().'</h1>'."\n" ;
1577
        $res = '<h1>'.PROJET_INSCRIPTION_PROJET.' : '.$projet->getTitre().'</h1>'."\n" ;
1565
        if ($projet->avoirListe()) $res .= '<h2>'.PROJET_MESSAGE_LISTE.'</h2>'."\n" ;
1578
        if ($projet->avoirListe()) $res .= '<h2>'.PROJET_MESSAGE_LISTE.'</h2>'."\n" ;
1566
        //$participant = new participe($this->_db) ;
1579
        //$participant = new participe($this->_db) ;
1567
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
1580
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
1568
        $HTML_formulaireInscriptionProjet = new HTML_formulaireInscriptionProjet('inscription_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
1581
        $HTML_formulaireInscriptionProjet = new HTML_formulaireInscriptionProjet('inscription_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
1569
        $HTML_formulaireInscriptionProjet->construitFormulaire($projet) ;
1582
        $HTML_formulaireInscriptionProjet->construitFormulaire($projet) ;
1570
        $HTML_formulaireInscriptionProjet->setDefaults(array('radio_inscription_liste' => 2)) ;
1583
        $HTML_formulaireInscriptionProjet->setDefaults(array('radio_inscription_liste' => 2)) ;
1571
        return $res.$HTML_formulaireInscriptionProjet->toHTML() ;
1584
        return $res.$HTML_formulaireInscriptionProjet->toHTML() ;
1572
    } // end of member function inscriptionProjet
1585
    } // end of member function inscriptionProjet
1573
 
1586
 
1574
    /**
1587
    /**
1575
     * Inscrit l'utilisateur loggue a la liste dont le parametre est en post.
1588
     * Inscrit l'utilisateur loggue a la liste dont le parametre est en post.
1576
     *
1589
     *
1577
     * @return void
1590
     * @return void
1578
     * @access public
1591
     * @access public
1579
     */
1592
     */
1580
    function inscriptionListe( )
1593
    function inscriptionListe( )
1581
    {
1594
    {
1582
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1595
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1583
        $projet = new projet ($this->_db, $this->_id_projet) ;
1596
        $projet = new projet ($this->_db, $this->_id_projet) ;
1584
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1597
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1585
        include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1598
        include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1586
        $projet->getListesAssociees() ;
1599
        $projet->getListesAssociees() ;
1587
        $utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
1600
        $utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
1588
        $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1601
        $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1589
        $inscription_liste = new inscription_liste($this->_db) ;
1602
        $inscription_liste = new inscription_liste($this->_db) ;
1590
        $inscription_liste->inscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], 2) ;  // 2 est la statut inscription normale
1603
        $inscription_liste->inscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], 2) ;  // 2 est la statut inscription normale
-
 
1604
        return '<p class="information">Vous &ecirc;tes inscrit &agrave; la liste</p>';
1591
    } // end of member function inscriptionListe
1605
    } // end of member function inscriptionListe
1592
 
1606
 
1593
    /**
1607
    /**
1594
     * Inscrit l'utilisateur logué à la liste dont le paraître est en post.
1608
     * Inscrit l'utilisateur loggue a la liste dont le parametre est en post.
1595
     *
1609
     *
1596
     * @return void
1610
     * @return void
1597
     * @access public
1611
     * @access public
1598
     */
1612
     */
1599
    function desinscriptionListe( )
1613
    function desinscriptionListe( )
1600
    {
1614
    {
1601
        if (isset($_GET['inscription_liste']) || $this->_action = PROJET_ACTION_DESINSCRIPTION_LISTE) {
1615
        if (isset($_GET['inscription_liste']) || $this->_action = PROJET_ACTION_DESINSCRIPTION_LISTE) {
1602
            include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1616
            include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1603
            $projet = new projet ($this->_db, $this->_id_projet) ;
1617
            $projet = new projet ($this->_db, $this->_id_projet) ;
1604
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1618
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1605
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1619
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1606
            $projet->getListesAssociees() ;
1620
            $projet->getListesAssociees() ;
1607
            $utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
1621
            $utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
1608
            								 'mail' => PROJET_CHAMPS_MAIL,
1622
            								 'mail' => PROJET_CHAMPS_MAIL,
1609
            								 'table' => PROJET_ANNUAIRE)) ;
1623
            								 'table' => PROJET_ANNUAIRE)) ;
1610
            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1624
            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1611
            $inscription_liste = new inscription_liste($this->_db) ;
1625
            $inscription_liste = new inscription_liste($this->_db) ;
1612
            $inscription_liste->desinscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], $_GET['inscription_liste']) ;
1626
            $inscription_liste->desinscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], $_GET['inscription_liste']) ;
-
 
1627
            return '<p class="information">Vous avez &eacute;t&eacute; d&eacute;sinscrit de la liste</p>';
1613
        }
1628
        }
1614
    } // end of member function inscriptionListe
1629
    } // end of member function inscriptionListe
1615
    /**
1630
    /**
1616
     * desinscrit un utilisateur à un projet
1631
     * desinscrit un utilisateur d un projet
1617
     *
1632
     *
1618
     * @return void
1633
     * @return void
1619
     * @access public
1634
     * @access public
1620
     */
1635
     */
1621
    function desinscriptionProjet( )
1636
    function desinscriptionProjet( )
1622
    {
1637
    {
1623
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1638
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
-
 
1639
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1624
        $participant = new participe($this->_db) ;
1640
        $participant = new participe($this->_db) ;
-
 
1641
		$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
-
 
1642
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
-
 
1643
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
-
 
1644
	    $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1625
 
1645
	    
1626
        // Le statut 4 désinscrit l'utilisateur, dans la méthode setStatut
1646
        // Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
1627
        $participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1647
        $participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1628
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1648
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1629
        $projet = new projet ($this->_db, $this->_id_projet) ;
1649
        $projet = new projet ($this->_db, $this->_id_projet) ;
1630
        $projet->getListesAssociees() ;
1650
        $projet->getListesAssociees() ;
1631
        if ($projet->avoirListe()) {
1651
        if ($projet->avoirListe()) {
1632
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1652
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1633
            $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
1653
            $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
1634
            $annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1654
            $annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1635
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1655
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1636
            $desinscription= new inscription_liste($this->_db) ;
1656
            $desinscription= new inscription_liste($this->_db) ;
1637
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1657
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1638
        }
1658
        }
-
 
1659
        $this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
-
 
1660
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
-
 
1661
        $liste_ext = new liste_externe($this->_db);
-
 
1662
		$listes = $liste_ext->getListesAssociees($this->_id_projet);
-
 
1663
		$info_liste = $liste_ext->getInfoListe($listes[0]);
-
 
1664
		$msg = '';
-
 
1665
		if (count ($listes) != 0) {
-
 
1666
			$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
-
 
1667
			$msg .= ' Vous pouvez le faire en <a href="mailto:';
-
 
1668
			$msg .= $info_liste->AGO_A_MAILDESA.'">cliquez ici</a>';
-
 
1669
		}
1639
        if ($this->_presentation != 'arbre') {
1670
        if ($this->_presentation != 'arbre') {
-
 
1671
            $message_retour = '<p class="information">Votre d&eacute;sinscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
1640
            include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1672
            include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1641
            return $retour ;
1673
            return $retour ;
1642
        } else {
1674
        } else {
1643
            $this->_action = PROJET_ACTION_VOIR_RESUME;
1675
            $this->_action = PROJET_ACTION_VOIR_RESUME;
1644
        }
1676
        }
1645
    } // end of member function inscriptionProjet
1677
    }
1646
 
1678
 
1647
    /**
1679
    /**
1648
     * Renvoie le formulaire de création d'un wiki
1680
     * Renvoie le formulaire de creation d'un wiki
1649
     *
1681
     *
1650
     * @return void
1682
     * @return void
1651
     * @access public
1683
     * @access public
1652
     */
1684
     */
1653
    function formulaireWiki( )
1685
    function formulaireWiki( )
1654
    {
1686
    {
1655
 
1687
 
1656
		require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
1688
		require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
1657
 
1689
 
1658
 
1690
 
1659
  		$url = &$GLOBALS['_GEN_commun']['url'] ;
1691
  		$url = &$GLOBALS['_GEN_commun']['url'] ;
1660
		$url->addQueryString ('act', PROJET_ACTION_CREER_WIKI) ;
1692
		$url->addQueryString ('act', PROJET_ACTION_CREER_WIKI) ;
1661
		$url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
1693
		$url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
1662
		$res =admin_afficherContenuCorps();
1694
		$res =admin_afficherContenuCorps();
1663
		$res .= '<br /><a href="'.$this->_url->getURL().'">'.PROJET_RETOUR_RESUME.'</a>';
1695
		$res .= '<br /><a href="'.$this->_url->getURL().'">'.PROJET_RETOUR_RESUME.'</a>';
1664
    	return $res;
1696
    	return $res;
1665
 
1697
 
1666
    } // end of member function formulaireWiki
1698
    } // end of member function formulaireWiki
1667
 
1699
 
1668
 
1700
 
1669
	function associerWiki( )
1701
	function associerWiki( )
1670
    {
1702
    {
1671
        $res = '<h1>'.PROJET_ASSOCIER_WIKI.'</h1>'."\n" ;
1703
        $res = '<h1>'.PROJET_ASSOCIER_WIKI.'</h1>'."\n" ;
1672
 
1704
 
1673
	 	$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
1705
	 	$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
1674
    	$res='';
1706
    	$res='';
1675
 
1707
 
1676
         // Comportement par défaut
1708
         // Comportement par défaut
1677
	    // requete sur la table gen_wikini pour affichage de la liste des Wikini
1709
	    // requete sur la table gen_wikini pour affichage de la liste des Wikini
1678
	    $requete = "select  gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
1710
	    $requete = "select  gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
1679
 
1711
 
1680
	    $resultat = $db->query ($requete) ;
1712
	    $resultat = $db->query ($requete) ;
1681
	    if (DB::isError ($resultat)) {
1713
	    if (DB::isError ($resultat)) {
1682
	        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
1714
	        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
1683
	                                                                        __FILE__, __LINE__, 'admin_wikini')   ;
1715
	                                                                        __FILE__, __LINE__, 'admin_wikini')   ;
1684
	        return ;
1716
	        return ;
1685
	    }
1717
	    }
1686
 
1718
 
1687
 
1719
 
1688
	    $liste = new HTML_TableFragmenteur () ;
1720
	    $liste = new HTML_TableFragmenteur () ;
1689
	    $liste->construireEntete(array (PROJET_NOM_WIKINI,PROJET_PAGE_WIKINI, PROJET_SELECTIONNER_WIKINI)) ;
1721
	    $liste->construireEntete(array (PROJET_NOM_WIKINI,PROJET_PAGE_WIKINI, PROJET_SELECTIONNER_WIKINI)) ;
1690
 
1722
 
1691
	    $tableau_wikini = array() ;
1723
	    $tableau_wikini = array() ;
1692
 
1724
 
1693
	    while ($ligne = $resultat->fetchRow()) {
1725
	    while ($ligne = $resultat->fetchRow()) {
1694
	        $this->_url->addQueryString ('id_wikini', $ligne[0]) ;
1726
	        $this->_url->addQueryString ('id_wikini', $ligne[0]) ;
1695
	        array_push ($tableau_wikini, array ($ligne[1]."\n",    // première colonne, le nom de l'application
1727
	        array_push ($tableau_wikini, array ($ligne[1]."\n",    // première colonne, le nom de l'application
1696
										        $ligne[2]."\n",    // Deuxieme colonne, la page par defaut
1728
										        $ligne[2]."\n",    // Deuxieme colonne, la page par defaut
1697
	        								  '<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
1729
	        								  '<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
1698
	                                            ));
1730
	                                            ));
1699
	    }
1731
	    }
1700
	    $liste->construireListe($tableau_wikini) ;
1732
	    $liste->construireListe($tableau_wikini) ;
1701
	    $res .= $liste->toHTML();
1733
	    $res .= $liste->toHTML();
1702
	    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1734
	    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1703
	    return $res ;
1735
	    return $res ;
1704
 
1736
 
1705
 
1737
 
1706
 
1738
 
1707
    } // end of member function formulaireWiki
1739
    } // end of member function formulaireWiki
1708
 
1740
 
1709
 
1741
 
1710
    /**
1742
    /**
1711
     * Associe un wiki au projet courant
1743
     * Associe un wiki au projet courant
1712
     *
1744
     *
1713
     * @return void
1745
     * @return void
1714
     * @access public
1746
     * @access public
1715
     */
1747
     */
1716
 
1748
 
1717
	function associationWiki( )  {
1749
	function associationWiki( )  {
1718
 
1750
 
1719
 
1751
 
1720
    	if (isset($_GET['id_wikini'])) {
1752
    	if (isset($_GET['id_wikini'])) {
1721
    		$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
1753
    		$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
1722
		    $requete = "select gewi_code_alpha_wikini from gen_wikini where gewi_id_wikini = ".$_GET['id_wikini'] ;
1754
		    $requete = "select gewi_code_alpha_wikini from gen_wikini where gewi_id_wikini = ".$_GET['id_wikini'] ;
1723
	    	$resultat = $db->query ($requete) ;
1755
	    	$resultat = $db->query ($requete) ;
1724
	    	if (DB::isError ($resultat)) {
1756
	    	if (DB::isError ($resultat)) {
1725
	        	$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
1757
	        	$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
1726
	            	                                                            __FILE__, __LINE__, 'admin_wikini')   ;
1758
	            	                                                            __FILE__, __LINE__, 'admin_wikini')   ;
1727
	        	return ;
1759
	        	return ;
1728
	    	}
1760
	    	}
1729
 
1761
 
1730
	    	$ligne = $resultat->fetchRow();
1762
	    	$ligne = $resultat->fetchRow();
1731
	    	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1763
	    	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1732
			$projet = new projet($this->_db, $this->_id_projet) ;
1764
			$projet = new projet($this->_db, $this->_id_projet) ;
1733
        	$projet->majNomWikini($ligne[0]);
1765
        	$projet->majNomWikini($ligne[0]);
1734
    	}
1766
    	}
1735
 
1767
 
1736
	}
1768
	}
1737
 
1769
 
1738
    /**
1770
    /**
1739
     * Supprime le wiki du projet courant
1771
     * Supprime le wiki du projet courant
1740
     *
1772
     *
1741
     * @return void
1773
     * @return void
1742
     * @access public
1774
     * @access public
1743
     */
1775
     */
1744
    function supprimerWiki( )
1776
    function supprimerWiki( )
1745
    {
1777
    {
1746
        include_once PROJET_CHEMIN_CLASSES.'gestion_wikini.class.php' ;
1778
        include_once PROJET_CHEMIN_CLASSES.'gestion_wikini.class.php' ;
1747
        // On crée une nouvelle connexion avec les paramètres spécifiques aux wikinis
1779
        // On crée une nouvelle connexion avec les paramètres spécifiques aux wikinis
1748
        $connexion_bd = DB::connect('mysql://'.PROJET_UTILISATEUR_WIKINI.':'.PROJET_MDP_WIKINI.'@'.PROJET_HOTE_WIKINI.'/'.PROJET_DB_WIKINI) ;
1780
        $connexion_bd = DB::connect('mysql://'.PROJET_UTILISATEUR_WIKINI.':'.PROJET_MDP_WIKINI.'@'.PROJET_HOTE_WIKINI.'/'.PROJET_DB_WIKINI) ;
1749
        $gerantWiki = new gestion_wikini($connexion_bd) ;
1781
        $gerantWiki = new gestion_wikini($connexion_bd) ;
1750
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1782
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1751
        $projet = new projet ($this->_db, $this->_id_projet) ;
1783
        $projet = new projet ($this->_db, $this->_id_projet) ;
1752
        $gerantWiki->suppression_tables(strtolower($projet->getWikini())) ;
1784
        $gerantWiki->suppression_tables(strtolower($projet->getWikini())) ;
1753
        $projet->majNomWikini('') ;
1785
        $projet->majNomWikini('') ;
1754
    } // end of member function supprimerWiki
1786
    } // end of member function supprimerWiki
1755
 
1787
 
1756
    /**
1788
    /**
1757
     * Permet de lier une ou plusieurs listes de la table agora à un projet.
1789
     * Permet de lier une ou plusieurs listes de la table agora à un projet.
1758
     *
1790
     *
1759
     * @return string
1791
     * @return string
1760
     * @access public
1792
     * @access public
1761
     */
1793
     */
1762
    function referencerListeExterne( )
1794
    function referencerListeExterne( )
1763
    {
1795
    {
1764
        $requete = 'show tables like \'agora\'' ;
1796
        $requete = 'show tables like \'agora\'' ;
1765
        $resultat = $this->_db->query ($requete);
1797
        $resultat = $this->_db->query ($requete);
1766
        if ($resultat->numRows() == 0) {
1798
        if ($resultat->numRows() == 0) {
1767
        	return 'Cette fonctionnalité n\'est pas active' ;
1799
        	return 'Cette fonctionnalité n\'est pas active' ;
1768
        }
1800
        }
1769
        $res = '<h1>'.PROJET_REFERENCER_LISTE.'</h1>' ;
1801
        $res = '<h1>'.PROJET_REFERENCER_LISTE.'</h1>' ;
1770
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1802
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1771
        $liste_externe = new liste_externe($this->_db) ;
1803
        $liste_externe = new liste_externe($this->_db) ;
1772
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
1804
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
1773
        $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
1805
        $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
1774
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE_V) ;
1806
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE_V) ;
1775
        $HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
1807
        $HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
1776
        $HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
1808
        $HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
1777
        $liste_assoc = $liste_externe->getListesAssociees($this->_id_projet) ;
1809
        $liste_assoc = $liste_externe->getListesAssociees($this->_id_projet) ;
1778
        $default = array() ;
1810
        $default = array() ;
1779
        foreach ($liste_assoc as $val) $default['liste_'.$val] = 1 ;
1811
        foreach ($liste_assoc as $val) $default['liste_'.$val] = 1 ;
1780
 
1812
 
1781
        $HTML_formulaireListeExterne->setDefaults($default) ;
1813
        $HTML_formulaireListeExterne->setDefaults($default) ;
1782
        return $res.$HTML_formulaireListeExterne->toHTML() ;
1814
        return $res.$HTML_formulaireListeExterne->toHTML() ;
1783
    } // end of member function referencerListeExterne
1815
    } // end of member function referencerListeExterne
1784
 
1816
 
1785
    /**
1817
    /**
1786
     * Réalise les mises à jours dans la table projet_lien_liste_externe
1818
     * Réalise les mises à jours dans la table projet_lien_liste_externe
1787
     *
1819
     *
1788
     * @return void
1820
     * @return void
1789
     * @access public
1821
     * @access public
1790
     */
1822
     */
1791
    function referencerListeExterneValidation( )
1823
    function referencerListeExterneValidation( )
1792
    {
1824
    {
1793
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1825
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1794
        $liste_externe = new liste_externe($this->_db) ;
1826
        $liste_externe = new liste_externe($this->_db) ;
1795
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
1827
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
1796
        $HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
1828
        $HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
1797
        $HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
1829
        $HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
1798
 
1830
 
1799
        $liste_externe->enregistrerSQL($HTML_formulaireListeExterne->getSubmitValues(), $this->_id_projet) ;
1831
        $liste_externe->enregistrerSQL($HTML_formulaireListeExterne->getSubmitValues(), $this->_id_projet) ;
1800
    } // end of member function referencerListeExterneValidation
1832
    } // end of member function referencerListeExterneValidation
1801
 
1833
 
1802
    /**
1834
    /**
1803
     * permet d'exclure un projet de l'affichage
1835
     * permet d'exclure un projet de l'affichage
1804
     *
1836
     *
1805
     * @return void
1837
     * @return void
1806
     * @access public
1838
     * @access public
1807
     */
1839
     */
1808
    function exclure($id_projet)
1840
    function exclure($id_projet)
1809
    {
1841
    {
1810
       array_push ($this->_projet_exclu, $id_projet) ;
1842
       array_push ($this->_projet_exclu, $id_projet) ;
1811
    } // end of member function exclure
1843
    } // end of member function exclure
1812
 
1844
 
1813
    /**
1845
    /**
1814
     * permet d'exclure un projet de l'affichage
1846
     * permet d'exclure un projet de l'affichage
1815
     *
1847
     *
1816
     * @return void
1848
     * @return void
1817
     * @access public
1849
     * @access public
1818
     */
1850
     */
1819
    function setPrive()
1851
    function setPrive()
1820
    {
1852
    {
1821
       $this->_prive = 1 ;
1853
       $this->_prive = 1 ;
1822
    } // end of member function exclure
1854
    } // end of member function exclure
1823
 
1855
 
1824
	/**
1856
	/**
1825
	 * 	retourne une variable locale si la variable $_GET existe
1857
	 * 	retourne une variable locale si la variable $_GET existe
1826
	 *  
1858
	 *  
1827
	 */
1859
	 */
1828
	function traiterVariableGet($var, $valeur_par_defaut ='') {
1860
	function traiterVariableGet($var, $valeur_par_defaut ='') {
1829
		if (isset($_GET[$var]) && $_GET[$var] != '') {
1861
		if (isset($_GET[$var]) && $_GET[$var] != '') {
1830
			return $_GET[$var];
1862
			return $_GET[$var];
1831
		} else {
1863
		} else {
1832
			return $valeur_par_defaut;
1864
			return $valeur_par_defaut;
1833
		}
1865
		}
1834
	}
1866
	}
1835
 
1867
 
1836
    /**
1868
    /**
1837
     * Renvoie un message d'erreur, en fonction du code de l'erreur.
1869
     * Renvoie un message d'erreur, en fonction du code de l'erreur.
1838
     *
1870
     *
1839
     * @param int valeur Le code du message d'erreur.
1871
     * @param int valeur Le code du message d'erreur.
1840
     * @return string
1872
     * @return string
1841
     * @access public
1873
     * @access public
1842
     */
1874
     */
1843
    function messageErreur( $valeur )
1875
    function messageErreur( $valeur )
1844
    {
1876
    {
1845
        $messageErreur = array (
1877
        $messageErreur = array (
1846
                    PROJETCONTROLEUR_ACTION_INVALIDE => "Action non valide",
1878
                    PROJETCONTROLEUR_ACTION_INVALIDE => "Action non valide",
1847
                    PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE => "Impossible de supprimer le r&eacute;pertoire",
1879
                    PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE => "Impossible de supprimer le r&eacute;pertoire",
1848
                    PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
1880
                    PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
1849
                    PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
1881
                    PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
1850
        ) ;
1882
        ) ;
1851
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1883
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1852
    } // end of member function messageErreur
1884
    } // end of member function messageErreur
-
 
1885
	
-
 
1886
	/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
-
 
1887
	 * 
-
 
1888
	 * 
-
 
1889
	 */
-
 
1890
 
-
 
1891
	function notifierCoordinateurs ($notification, $utilisateur) {
-
 
1892
		
-
 
1893
		include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php';
-
 
1894
		
-
 
1895
		switch ($notification) {
-
 
1896
			case PROJET_NOTIFICATION_DEMANDE_INSCRIPTION : 
-
 
1897
				$sujet = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET;
-
 
1898
				$corps = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS;
-
 
1899
			break;
-
 
1900
			case PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE :
-
 
1901
				$sujet = PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_SUJET;
-
 
1902
				$corps = PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_CORPS;
-
 
1903
			break;
-
 
1904
			case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET :
-
 
1905
				$sujet = PROJET_TEMPLATE_DESINSCRIPTION_SUJET;
-
 
1906
				$corps = PROJET_TEMPLATE_DESINSCRIPTION_CORPS;
-
 
1907
			break;
-
 
1908
			case PROJET_NOTIFICATION_NOUVEAU_DOC:
-
 
1909
				$sujet = PROJET_TEMPLATE_NOUVEAU_DOC_SUJET;
-
 
1910
				$corps = PROJET_TEMPLATE_NOUVEAU_DOC_CORPS;
-
 
1911
			break;
-
 
1912
	
-
 
1913
		}
-
 
1914
		
-
 
1915
		include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
-
 
1916
        $projet = new projet ($this->_db, $this->_id_projet) ;
-
 
1917
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
-
 
1918
		$participant = new participe($this->_db) ;
-
 
1919
		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
-
 
1920
		
-
 
1921
		$objet_mail =& Mail::factory('smtp');
-
 
1922
		
-
 
1923
		
-
 
1924
		
-
 
1925
		$modele = new projetTemplate($GLOBALS['projet_db']);
-
 
1926
 
-
 
1927
		$sujet_mail = $modele->getTemplate($sujet, PROJET_LANGUE_DEFAUT);
-
 
1928
		$corps_mail = $modele->getTemplate($corps, PROJET_LANGUE_DEFAUT);
-
 
1929
		
-
 
1930
	    if (PEAR::isError($sujet_mail)) $sujet_mail->raiseError ($sujet_mail->getMessage().'<br />'.$sujet_mail->getDebugInfo());
-
 
1931
	    
-
 
1932
	    $corps_mail = str_replace ('{nom}', $utilisateur->getInfo( 'nom'), $corps_mail);
-
 
1933
	    $corps_mail = str_replace ('{prenom}', $utilisateur->getInfo( 'prenom'), $corps_mail);
-
 
1934
	    $corps_mail = str_replace ('{nom_projet}', $projet->getTitre(), $corps_mail);
-
 
1935
	    $corps_mail = str_replace ('{lien}', str_replace ('&amp;', '&', $this->_url->getURL()), $corps_mail);
-
 
1936
		
-
 
1937
		$entetes['From'] = PROJET_MAIL_ADMINISTRATEUR;
-
 
1938
        $entetes['To'] = '';
-
 
1939
        $entetes['Subject'] = trim ($sujet_mail) ;  // le trim est necessaire pour enlever d eventuels retour-chariot qui foutent el l air le message 
-
 
1940
        $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
-
 
1941
        $entetes['Message-ID'] = md5(time()) ;
-
 
1942
        $entetes['reply-to'] = $this->_auth->getUserName();
-
 
1943
        $entetes['Content-Type'] = 'text/plain' ;
-
 
1944
        
-
 
1945
		foreach ($tableau_coordinateur as $coordinateur) {
-
 
1946
			$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
-
 
1947
			
-
 
1948
		}
-
 
1949
		// On enleve la virgule finale
-
 
1950
		
-
 
1951
		$entetes['To'] = substr ($entetes['To'], 0, -1);
-
 
1952
 
-
 
1953
		// on envoie le mail
1853
 
1954
		$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1854
 
1955
	}
1855
 
1956
 
1856
 
1957
 
1857
} // end of projetControleur
1958
} // end of projetControleur
1858
 
1959
 
1859
class bouton {
1960
class bouton {
1860
	static function toHTML($lien, $label, $id) {
1961
	static function toHTML($lien, $label, $id, $class='projet_bouton_action') {
-
 
1962
		
-
 
1963
		if ($lien != '#') {
-
 
1964
			$balise_a_debut = '<a href="'.$lien.'"'.($id == 'cross'? ' onclick="javascript:return confirm(\''.$label.' ?\');"':'').'>';
-
 
1965
			$balise_a_fin = '</a>';	
-
 
1966
		} else {
-
 
1967
			$balise_a_debut = '';
-
 
1968
			$balise_a_fin = '';
-
 
1969
		}
1861
		return '<div id="bouton_'.$id.'" class="projet_bouton_action">' .
1970
		return '<div id="bouton_'.$id.'" class="'.$class.'">' .
1862
				'<a href="'.$lien.'"><img src="'.PROJET_CHEMIN_ICONES.$id.'.png" alt="'.$label.'" />'.$label.'</a></div>';
1971
				$balise_a_debut.'<img src="'.PROJET_CHEMIN_ICONES.$id.'.png" alt="'.$label.'" />'.$label.$balise_a_fin.'</div>';
1863
	}
1972
	}
1864
}
1973
}
-
 
1974
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
1975
*
-
 
1976
* $Log: not supported by cvs2svn $
1865
 
1977
*
-
 
1978
* +-- Fin du code ----------------------------------------------------------------------------------------+
-
 
1979
*/
1866
?>
1980
?>
1867
1981