Subversion Repositories Applications.projet

Rev

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

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