Subversion Repositories Applications.projet

Rev

Rev 117 | Rev 154 | 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
// +------------------------------------------------------------------------------------------------------+
138 alexandre_ 22
// CVS : $Id: documents.php,v 1.4 2006-09-21 15:12:02 alexandre_tb Exp $
2 ddelon 23
/**
24
* Application projet
25
*
26
* Action documents
27
*
28
*@package projet
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
138 alexandre_ 34
*@version       $Revision: 1.4 $
2 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
// RAPPEL IMPORTANT
43
// On se situe dans la méthode run() de la classe projetControleur
44
//
138 alexandre_ 45
$retour = '';
2 ddelon 46
 
47
// création de l'objet projet courant
48
$projet = new projet ($this->_db, $this->_id_projet) ;
49
 
50
// récupération de la liste des documents associés
51
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
52
 
53
// création de la vue liste de document, on nettoie l'url
54
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
55
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
56
 
57
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
58
 
59
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
60
 
61
// réglage de paramètres de la vue
62
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
63
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
64
 
65
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
66
 
67
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
68
 
69
// vérification des droits de l'utilisateur
70
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
71
 
72
if ($this->_auth->getAuth()) {
73
    $participant = new participe($this->_db) ;
74
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
75
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
76
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
77
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
78
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
79
    if ($isAdm) $isCoord = true ;
117 alexandre_ 80
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
81
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
2 ddelon 82
 
83
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
84
    // si participant, on ajoute le champs visibilite
85
 
86
    if ($statut !='' || $isAdm) {
87
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
88
    }
89
    // si chef de projet ou si propriétaire d'au moins 1 document
90
    $proprietaire_un_document = false ;
91
 
92
    foreach ($liste_documents as $document) {
93
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
94
            $proprietaire_un_document = true ;
95
            $droits = PROJET_DROIT_PROPRIETAIRE ;
96
        }
97
    }
98
    if ($statut > 0 || $proprietaire_un_document) {
99
        array_push ($entete_liste, PROJET_ACTION) ;
100
    }
101
} else {
102
    $droits = PROJET_DROIT_AUCUN ;
103
}
104
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
105
 
106
$vue_liste_document->construitEntete($entete_liste) ;
107
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
108
 
109
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
110
 
111
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
112
$retour .= $vue_liste_document->toHTML() ;
113
 
114
 
115
?>