Subversion Repositories Applications.projet

Rev

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

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