Subversion Repositories Applications.projet

Rev

Rev 208 | 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: description.php,v 1.4 2008-08-25 15:02:35 alexandre_tb Exp $
/**
* Application projet
*
* Action description
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2005
*@version       $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/

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

// RAPPEL IMPORTANT
// On se situe dans la methode run() de la classe projetControleur
//

// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;

if ($this->_auth->getAuth()) {
        $loggue = true;
        $droits = PROJET_DROIT_AUCUN;
    $participant = new participe($this->_db) ;
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
    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 ;

            
    switch ($participant->getStatut($id_u, $this->_id_projet))
    {
        case PROJET_DROIT_AUCUN : 
                $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
                $lien_inscription = $this->_url->getURL();
                $laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
                $label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
                $lien_inscription = $this->_url->getURL();
                $label_url_inscription = 'S\'inscrire &agrave; ce projet'; 
                $bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
    <a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
  </div>';
        break;
        case PROJET_DROIT_CONTRIBUTEUR : 
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
                        $bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
                        
                        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
                        $bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
                        
                        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
        break;
        case PROJET_DROIT_COORDINATEUR : 
                $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
                        $bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
                        
                        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
                        $bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
                        
                        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
                        
                
        break;
        case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
                GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
                        GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
                                'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
                                'element = $(\'projet_lien_login\');'."\n".
                                'element.addEvent(
                                        \'click\', function() {
                                                fx.start({
                                                        \'height\' : \'320px\'
                                                })
                                        }
                                )});');
                        $laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
                        $lien_login = '#';
        break;
    }
    
    $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) ;
        $visible = true ;
    } else {
           $visible = false ;
    }
        // recuperation de la liste des documents associes
        $liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
                                                PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;

    
    // si chef de projet ou si proprietaire 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 ;
    // recuperation de la liste des documents associes
        $liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
                                                PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
        $lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
        $label_url_inscription = 'S\'inscrire &agrave; ce projet';
        
        GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
        GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
        GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
                        'animatedcollapse.init();' ."\n");
        $lien_login = '#';    
}

$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;

ob_start();
include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
$retour .= ob_get_contents();
ob_end_clean();
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>