Subversion Repositories Applications.projet

Rev

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

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