Subversion Repositories Applications.papyrus

Rev

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

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