Subversion Repositories Applications.projet

Rev

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

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