Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
448 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
// +------------------------------------------------------------------------------------------------------+
1302 alexandre_ 22
// CVS : $Id: documents.php,v 1.4.2.1 2007-04-11 12:19:09 alexandre_tb Exp $
448 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
1302 alexandre_ 34
*@version       $Revision: 1.4.2.1 $
448 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
//
957 alexandre_ 45
$retour = '';
448 ddelon 46
 
47
// création de l'objet projet courant
1302 alexandre_ 48
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
448 ddelon 49
$projet = new projet ($this->_db, $this->_id_projet) ;
50
 
51
// récupération de la liste des documents associés
52
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
53
 
54
// création de la vue liste de document, on nettoie l'url
55
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
56
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
57
 
58
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
59
 
60
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
61
 
62
// réglage de paramètres de la vue
63
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
64
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
65
 
66
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
67
 
68
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
69
 
70
// vérification des droits de l'utilisateur
71
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
72
 
73
if ($this->_auth->getAuth()) {
1302 alexandre_ 74
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
448 ddelon 75
    $participant = new participe($this->_db) ;
76
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
77
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
78
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
79
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
80
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
81
    if ($isAdm) $isCoord = true ;
883 alexandre_ 82
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
83
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
448 ddelon 84
 
85
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
86
    // si participant, on ajoute le champs visibilite
87
 
88
    if ($statut !='' || $isAdm) {
89
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
90
    }
91
    // si chef de projet ou si propriétaire d'au moins 1 document
92
    $proprietaire_un_document = false ;
93
 
94
    foreach ($liste_documents as $document) {
95
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
96
            $proprietaire_un_document = true ;
97
            $droits = PROJET_DROIT_PROPRIETAIRE ;
98
        }
99
    }
100
    if ($statut > 0 || $proprietaire_un_document) {
101
        array_push ($entete_liste, PROJET_ACTION) ;
102
    }
103
} else {
104
    $droits = PROJET_DROIT_AUCUN ;
105
}
106
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
107
 
108
$vue_liste_document->construitEntete($entete_liste) ;
109
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
110
 
111
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
112
 
113
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
114
$retour .= $vue_liste_document->toHTML() ;
115
 
116
 
117
?>