Subversion Repositories Applications.papyrus

Rev

Rev 1378 | 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
// +------------------------------------------------------------------------------------------------------+
1633 alexandre_ 22
// CVS : $Id: documents.php,v 1.7.2.2 2007-10-02 09:23:07 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
1633 alexandre_ 34
*@version       $Revision: 1.7.2.2 $
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
//
1180 alexandre_ 45
if (!isset($retour)) $retour = '';
448 ddelon 46
 
1327 alexandre_ 47
// creation de l'objet projet courant
1336 neiluj 48
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
448 ddelon 49
$projet = new projet ($this->_db, $this->_id_projet) ;
50
 
1327 alexandre_ 51
// recuperation de la liste des documents associes
1378 alexandre_ 52
// en filtrant sur le repertoire courant pour limiter le nombre de resultat
53
if ($this->_id_repertoire != "") {
54
	$id_repertoire = $this->_id_repertoire;
55
} else {
56
	$id_repertoire = 0 ;
57
}
448 ddelon 58
 
1378 alexandre_ 59
 
60
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $id_repertoire) ;
61
 
1327 alexandre_ 62
// creation de la vue liste de document, on nettoie l'url
448 ddelon 63
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
64
 
1378 alexandre_ 65
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
448 ddelon 66
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
67
 
1378 alexandre_ 68
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth, $projet->getId()) ;
448 ddelon 69
 
1327 alexandre_ 70
// reglage de parametres de la vue
448 ddelon 71
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
72
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
73
 
1378 alexandre_ 74
$tableau_navigation = document::getPath($this->_id_repertoire, $this->_db) ;
75
//$retour .= $GLOBALS['log'];
76
$tableau_navigation = array_merge(is_array ($tableau_navigation) ? array_reverse($tableau_navigation) : array(), array($id_repertoire));
448 ddelon 77
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
78
 
1327 alexandre_ 79
// verification des droits de l'utilisateur
448 ddelon 80
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
81
 
82
if ($this->_auth->getAuth()) {
1336 neiluj 83
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
448 ddelon 84
    $participant = new participe($this->_db) ;
85
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
1633 alexandre_ 86
 
87
 
88
 
89
 
90
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
91
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
92
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
93
     if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
94
     $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
448 ddelon 95
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
96
    if ($isAdm) $isCoord = true ;
97
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
98
    // si participant, on ajoute le champs visibilite
99
 
100
    if ($statut !='' || $isAdm) {
101
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
102
    }
1327 alexandre_ 103
    // si chef de projet ou si proprietaire d'au moins 1 document
448 ddelon 104
    $proprietaire_un_document = false ;
105
 
106
    foreach ($liste_documents as $document) {
1327 alexandre_ 107
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
448 ddelon 108
            $proprietaire_un_document = true ;
109
            $droits = PROJET_DROIT_PROPRIETAIRE ;
110
        }
111
    }
112
    if ($statut > 0 || $proprietaire_un_document) {
113
        array_push ($entete_liste, PROJET_ACTION) ;
114
    }
115
} else {
116
    $droits = PROJET_DROIT_AUCUN ;
117
}
118
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
119
 
120
$vue_liste_document->construitEntete($entete_liste) ;
121
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
122
 
123
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
124
 
125
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
1378 alexandre_ 126
// Les liens pour l affichage classique ou arborescent (avec dojo)
127
$this->_url->addQueryString('affichage', 'ajax');
128
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
129
$this->_url->addQueryString('affichage', 'standart');
130
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
131
$this->_url->removeQueryString('affichage');
448 ddelon 132
 
133
 
1378 alexandre_ 134
$retour .= '<noscript>';
135
$vue_liste_document->setModeAffichage('standart');
136
$retour .= $vue_liste_document->toHTML('', '') ;
137
$retour .= '</noscript>';
1327 alexandre_ 138
 
1378 alexandre_ 139
if (!isset ($_SESSION['mode_affichage'])) {
1633 alexandre_ 140
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
1378 alexandre_ 141
} else {
142
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
143
}
144
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
1327 alexandre_ 145
 
1378 alexandre_ 146
$retour .= $vue_liste_document->toHTML($projet->getId(), $droits);
147
//$retour .= $GLOBALS['log'];
1327 alexandre_ 148
 
448 ddelon 149
?>