Subversion Repositories Applications.projet

Rev

Rev 63 | Rev 74 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 63 Rev 68
Line 18... Line 18...
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
Line 22... Line 22...
22
 
22
 
Line 23... Line 23...
23
// CVS : $Id: projetControleur.class.php,v 1.20 2005-11-23 11:37:05 alexandre_tb Exp $
23
// CVS : $Id: projetControleur.class.php,v 1.21 2005-11-25 14:49:26 alexandre_tb Exp $
24
 
24
 
25
/**
25
/**
26
* Application projet
26
* Application projet
Line 31... Line 31...
31
//Auteur original :
31
//Auteur original :
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.20 $
36
*@version       $Revision: 1.21 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 306... Line 306...
306
            break ;
306
            break ;
307
            case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
307
            case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
308
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
308
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
309
            break ;
309
            break ;
310
            case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
310
            case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
311
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
311
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
312
            break ;
312
            break ;
313
            case PROJET_ACTION_DESINSCRIPTION_LISTE : $retour .= $this->desinscriptionListe() ;
313
            case PROJET_ACTION_DESINSCRIPTION_LISTE : $retour .= $this->desinscriptionListe() ;
314
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
314
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
315
            break ;
315
            break ;
316
            case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
316
            case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
317
            break ;
317
            break ;
318
            case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
318
            case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
319
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
319
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
Line 400... Line 400...
400
        // Les entêtes des tableaux
400
        // Les entêtes des tableaux
401
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
401
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
Line 402... Line 402...
402
 
402
 
403
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
403
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
404
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
-
 
405
 
404
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
406
 
-
 
407
        // Si la présentation est par arbre
-
 
408
        // TODO : Organiser différemment les présentations
-
 
409
        // En utilisant des templates
-
 
410
        if ($this->_presentation == 'arbre') {
-
 
411
            $titre = '<h1>Arbre des Projets</h1>'."\n" ;
-
 
412
            include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
-
 
413
            // initialisation de variables
-
 
414
            $intensite_feuille = '' ; $longueur_branche = '' ;
-
 
415
            $arbre = new arbre() ;
-
 
416
            // recherche du projet principal
-
 
417
 
-
 
418
            $cime='';
-
 
419
 
-
 
420
            foreach ($projetListe as $projet) {
-
 
421
                $this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
-
 
422
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
-
 
423
                $lien_feuille = $this->_url->getURL() ;
-
 
424
                $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
-
 
425
 
-
 
426
                if ($projet->isRacine()) {
-
 
427
                    $cime = $arbre->cime($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(), $lien_feuille, '') ;
-
 
428
                } else {
-
 
429
 
-
 
430
                    $arbre->addBranche($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(),
-
 
431
                                        $lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
-
 
432
                }
-
 
433
            }
-
 
434
            return $titre.'<table>'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
-
 
435
        }
-
 
436
 
-
 
437
        // Présentation par liste
-
 
438
 
-
 
439
        $titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
-
 
440
 
-
 
441
        // On inclue un fichier local
-
 
442
        if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
405
		
443
        	include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
-
 
444
        // On vérifie si l'utilisateur participe à des projets
-
 
445
        if ($auth) {
-
 
446
 
-
 
447
            $utilisateur_liste = new inscription_liste($this->_db) ;
-
 
448
            // On teste ici s'il y a une mise à jour de statut
-
 
449
            if (isset($_POST['statut'])) {
-
 
450
                // $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
-
 
451
                include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
-
 
452
                $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
-
 
453
                $annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
-
 
454
                $projet = new projet ($this->_db, $_GET['identifiant_projet']) ;
-
 
455
                $projet->getListesAssociees() ;
-
 
456
                $utilisateur_liste->modifierTypeInscription($projet->_listes_associes[0],$annuaire, $_POST['statut']) ;
-
 
457
            }
-
 
458
            if (count($participant->getIdProjetsStatuts($id_u))) {
-
 
459
 
-
 
460
                $HTML_projetListe = new HTML_listeProjet(true) ;
-
 
461
                $entete_liste = array($auth ? PROJET_VOUS_PARTICIPEZ : PROJET_LISTE) ;
-
 
462
                if ($auth) array_push ($entete_liste, PROJET_SE_DESINSCRIRE, PROJET_LISTE_DE_DISCUSSION) ;
-
 
463
 
-
 
464
 
-
 
465
                $tableau_resultat = array () ;
-
 
466
 
-
 
467
                $HTML_projetListe->construitEntete ($entete_liste) ;
-
 
468
 
-
 
469
                // On construit $tableau_resultat avec une ligne par projet contenant un tableau (titre, statut_nom, id_statut, id_projet)
-
 
470
                $statut_liste = new statut_liste($this->_db) ;
-
 
471
                $tableau_statut = $statut_liste->getTousLesStatuts() ;
-
 
472
 
-
 
473
                $statut = '' ;
-
 
474
                $i = 0 ;
-
 
475
                $HTML_projetListe->setModeModification() ;
-
 
476
                $HTML_projetListe->setURL($this->_url) ;
-
 
477
                foreach ($projetListe as $projet) {
-
 
478
                    if (participe::getStatutSurProjetCourant($id_u, $projet->getId(), $this->_db) == 4) continue ;
-
 
479
                    if ($auth) {
-
 
480
                        if ($projet->avoirListe()) {
-
 
481
                            $projet->getListesAssociees() ;
-
 
482
                            $statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
-
 
483
                            //if ($statut == '') $statut = 0 ;
-
 
484
                        }
-
 
485
                    }
-
 
486
 
-
 
487
                    $this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
-
 
488
                    $ligne_tableau = array ($projet->getId(), $projet->getResume(),
-
 
489
								'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
-
 
490
								) ;
-
 
491
                    if ($auth) {
-
 
492
                        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
-
 
493
                        array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
-
 
494
                                                PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
-
 
495
                        if ($projet->avoirListe()) {
-
 
496
                            array_push ($ligne_tableau, $statut) ;
-
 
497
                        } else {
-
 
498
                            array_push($ligne_tableau, '') ;
-
 
499
                        }
-
 
500
                        array_push ($tableau_resultat, $ligne_tableau) ;
-
 
501
                        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
-
 
502
                    }
-
 
503
                    $statut = '' ;
-
 
504
                }
-
 
505
                $HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
-
 
506
 
-
 
507
 
-
 
508
                if ($HTML_projetListe->getRowCount() > 1) {
-
 
509
                	$res .= '<p>'.PROJET_PARTICIPER.'</p>';
-
 
510
                	$res .= $HTML_projetListe->toHTML() ;
-
 
511
                }
-
 
512
            } else {
-
 
513
                $res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
-
 
514
            }
-
 
515
        }
406
		return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
516
 
-
 
517
        // Un texte pour ceux qui ne sont pas identifiés
-
 
518
        if (!$auth) {
-
 
519
            $res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
-
 
520
        }
407
		
521
 
-
 
522
        // Maintenant la liste des projets où l'utilisateur ne participe pas.
-
 
523
        // Et si pas loggué tous les projets
-
 
524
        if ($auth) {
-
 
525
            $projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
-
 
526
            // Si certain projet sont à exclure, on les exclu
-
 
527
	        $projet_a_exclure = array() ;
-
 
528
	        if (count($this->_projet_exclu)) {
-
 
529
	        	arsort($this->_projet_exclu) ;
-
 
530
	            foreach ($this->_projet_exclu as $valeur) {
-
 
531
	            	for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
-
 
532
	            		if ($projetNonParticipantListe[$i]->getId() == $valeur)  array_push ($projet_a_exclure, $i);}
-
 
533
	            }
-
 
534
	        }
-
 
535
	        if (PROJET_UTILISE_TYPE && $this->_type != '') {
-
 
536
	        	for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
-
 
537
	        		if ($projetNonParticipantListe[$i]->getType() != $this->_type) array_push ($projet_a_exclure, $i) ;
-
 
538
	        	}
-
 
539
           	}
-
 
540
 
-
 
541
	        foreach ($projet_a_exclure as $valeur) {
-
 
542
	        	unset ($projetNonParticipantListe[$valeur]) ;
-
 
543
	        }
-
 
544
 
-
 
545
            $HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
-
 
546
            $entete_liste = array (PROJET_LISTE) ;
-
 
547
            array_push ($entete_liste, PROJET_S_INSCRIRE) ;
-
 
548
 
-
 
549
            $HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
-
 
550
 
-
 
551
            $liste_projet = array() ;
-
 
552
            // La liste
-
 
553
 
-
 
554
            foreach ($projetNonParticipantListe as $projet) {
-
 
555
                $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
-
 
556
                $ligne_projet = array ($projet->getResume(),
-
 
557
                                    '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'      // le nom du projet
-
 
558
                                        ) ;
-
 
559
                $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
-
 
560
                array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
-
 
561
 
-
 
562
                $this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
-
 
563
                array_push ($liste_projet, $ligne_projet) ;
-
 
564
            }
-
 
565
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
-
 
566
            $HTML_projetNonParticipantListe->construitListe($liste_projet) ;
-
 
567
            if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
-
 
568
        } else {
-
 
569
            $projetNonParticipantListe = & $projetListe ;
-
 
570
            $HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
-
 
571
            $entete_liste = array (PROJET_LISTE) ;
-
 
572
            $HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
-
 
573
 
-
 
574
            $liste_projet = array() ;
-
 
575
            // La liste
-
 
576
            foreach ($projetNonParticipantListe as $projet) {
-
 
577
                $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
-
 
578
                $ligne_projet = array ( $projet->getResume(),
-
 
579
                                    '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>',  // le nom du projet
-
 
580
                                    ) ;
-
 
581
 
-
 
582
                $this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
-
 
583
                array_push ($liste_projet, $ligne_projet) ;
-
 
584
            }
-
 
585
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
-
 
586
            $HTML_projetNonParticipantListe->construitListe($liste_projet) ;
-
 
587
            if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
-
 
588
        		$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
-
 
589
        		$res .= $HTML_projetNonParticipantListe->toHTML() ;
-
 
590
            }
-
 
591
        }
-
 
592
        return $titre.$res ;
408
        
Line 593... Line 409...
593
    } // end of member function mesProjets
409
    } // end of member function mesProjets
594
 
410
 
595
    /**
411
    /**
Line 763... Line 579...
763
		        $res .= '</ul></li>' ;
579
		        $res .= '</ul></li>' ;
764
        	}	
580
        	}	
765
        }
581
        }
766
        $res .= '</ul>' ;
582
        $res .= '</ul>' ;
767
        $res .= "</div>\n" ;
583
        $res .= "</div>\n" ;
-
 
584
        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
768
        return $res ;
585
        return $res ;
769
    } // end of member function menuGeneral
586
    } // end of member function menuGeneral
Line 770... Line 587...
770
 
587
 
771
    /**
588
    /**
Line 1739... Line 1556...
1739
	        								  '<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
1556
	        								  '<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
1740
	                                            ));
1557
	                                            ));
1741
	    }
1558
	    }
1742
	    $liste->construireListe($tableau_wikini) ;
1559
	    $liste->construireListe($tableau_wikini) ;
1743
	    $res .= $liste->toHTML();
1560
	    $res .= $liste->toHTML();
-
 
1561
	    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
1744
	    return $res ;
1562
	    return $res ;
Line 1745... Line 1563...
1745
 
1563