Subversion Repositories Applications.projet

Rev

Rev 28 | Rev 34 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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