Subversion Repositories Applications.projet

Rev

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

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