Subversion Repositories Applications.papyrus

Rev

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

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