Subversion Repositories Applications.projet

Rev

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

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