Subversion Repositories Applications.projet

Rev

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

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