Subversion Repositories Applications.papyrus

Rev

Rev 1314 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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