Subversion Repositories Applications.papyrus

Rev

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

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