Subversion Repositories Applications.papyrus

Rev

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

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