Subversion Repositories Applications.projet

Rev

Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU General Public                                                  |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | General Public License for more details.                                                             |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public                                            |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: resume.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
/**
* Application projet
*
* Action resume
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2005
*@version       $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//


// création de l'objet projet courant
$projet = new projet ($this->_db, $this->_id_projet) ;

// récupération de la liste des documents associés
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $this->_id_projet) ;

// création de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;

// réglage de paramètres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;


// vérification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;

if ($this->_auth->getAuth()) {
    $participant = new participe($this->_db) ;
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
    if ($isAdm) $isCoord = true ;
    
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
    // si participant, on ajoute le champs visibilite
    
    if ($statut !='' || $isAdm) {
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
    }
    // si chef de projet ou si propriétaire d'au moins 1 document
    $proprietaire_un_document = false ;

    foreach ($liste_documents as $document) {
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
            $proprietaire_un_document = true ;
            $droits = PROJET_DROIT_PROPRIETAIRE ;
        }
    }
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
        array_push ($entete_liste, PROJET_ACTION) ;
    }
} else {
    $droits = PROJET_DROIT_AUCUN ;
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;

$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;

$wiki_res = '' ;
// Les wikinis associés au projet
if ($projet->getWikini()) {
    $wiki_res .= '<div><a href="'.PROJET_URL_WIKINI.'wakka.php?wiki=PagePrincipale&wikini='.$projet->getWikini().'" target="_blank">'.PROJET_URL_WIKINI.'</a>' ;
    $wiki_res .= '</div>' ;
} else {
    $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
}
// On charge les listes de discussion du projet
// Pour le moment seul ezmlm est supportée

$projet->getListesAssociees();
$sortie_liste = '' ;

$liste_ext_res = '' ;
if ($projet->avoirListe()) {
    ob_start() ;
    foreach ($projet->_listes_associes as $info_liste) {
        $liste = new ezmlm_php() ;
        // Paramétrage de la liste
        
        $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
        
        $liste->listname = $info_liste->getNom() ;
        $liste->listdomain = $info_liste->getDomaine();
    
        if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
            $liste->set_action($GLOBALS['action']) ;
            $liste->set_actionargs($GLOBALS['actionargs']) ;
        } else {
            $liste->set_action('list_info') ;
        }
        $liste->sendheaders     = false;
        $liste->sendbody        = false;
        $liste->sendfooters    = false;
        $liste->forcehref = $this->_url->getURL() ;
        
        

        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
            switch ($liste->action) {
                case "list_info":
                    $info = new ezmlm_listinfo();
                    
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
                    
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
                    $info->forcehref = $this->_url->getURL();
                    $info->listdir = $liste->listdir ;
                    $info->listname = $info_liste->getNom();
                    $info->listdomain = $info_liste->getDomaine() ;
                    $info->show_recentmsgs() ;
                    break;
            }
        } else {
            print PROJET_MESSAGE_LISTE_PRIVEE;
        }
            $sortie_liste = ob_get_contents() ;
            ob_end_clean() ;
    }
}

// Site internet associé
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
if ($projet->getEspaceInternet() != '') {
    $sortie_web .= '<a href="'.$projet->getEspaceInternet().'" target="_blank">'.$projet->getEspaceInternet().'</a>'."\n" ;
} else {
    $sortie_web .= PROJET_PAS_DE_SITE ;
}

include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;

if (count ($tableau_liste) != 0) {
    $liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
    for ($i = 0; $i < count ($tableau_liste); $i++) {
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
        //$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
        //$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
        //$liste_ext_res .= '<br />'."\n" ;
    }
}

$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$retour .= '<h2>'.PROJET_RESUME.'</h2>'."\n" ;
$retour .= '<div>'.$projet->getResume().'</div>'."\n" ;
$retour .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
$retour .= $wiki_res ;
$retour .= $sortie_web ;
$retour .= '<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
$retour .= $liste_ext_res.$sortie_liste ;
$retour .= '<h2>'.PROJET_FICHIERS_RECENTS.'</h2>'."\n" ;
$retour .= $vue_liste_document->toHTML() ;
//$retour .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
//$retour .= $sortie_liste ;


?>