Subversion Repositories Applications.papyrus

Rev

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

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