Subversion Repositories Applications.projet

Rev

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

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