Subversion Repositories Applications.projet

Rev

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

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