Subversion Repositories Applications.papyrus

Rev

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

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