Subversion Repositories Applications.papyrus

Rev

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

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