Subversion Repositories Applications.projet

Rev

Rev 294 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 mathias 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
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: documents.php,v 1.10 2007-10-02 09:24:53 alexandre_tb Exp $
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
34
*@version       $Revision: 1.10 $
35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
// RAPPEL IMPORTANT
43
// On se situe dans la methode run() de la classe projetControleur
44
//
45
if (!isset($retour)) $retour = '';
46
 
47
$bouton_deposer_doc = '';
48
$bouton_creer_repertoire = '';
49
 
50
// creation de l'objet projet courant
51
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
52
$projet = new projet ($this->_db, $this->_id_projet) ;
53
 
54
// recuperation de la liste des documents associes
55
 
56
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $this->_id_repertoire) ;
57
 
58
//$html_document = print_r($liste_documents, true);
59
 
60
// creation de la vue liste de document, on nettoie l'url
61
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
62
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
63
 
64
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
65
 
66
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
67
if (count ($liste_documents) == 0) $pas_de_document = true;
68
 
69
// reglage de parametres de la vue
70
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
71
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
72
 
73
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
74
 
75
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
76
 
77
// verification des droits de l'utilisateur
78
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
79
$loggue = false;
80
if ($this->_auth->getAuth()) {
81
    $loggue = true;
82
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
83
    $participant = new participe($this->_db) ;
84
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
85
    $droits = $participant->getStatut($id_u, $this->_id_projet);
86
 
87
    // si participant, on ajoute le champs visibilite
88
 
89
    if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
90
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
91
    }
92
    // si chef de projet ou si proprietaire d'au moins 1 document
93
    $proprietaire_un_document = false ;
94
 
95
    if ($droit <= PROJET_DROIT_CONTRIBUTEUR ) {
96
        array_push ($entete_liste, PROJET_ACTION) ;
97
    }
98
 
99
    switch ($droits)
100
    {
101
    	case PROJET_DROIT_AUCUN :
102
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
103
    		$lien_inscription = $this->_url->getURL();
104
    		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
105
    		$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
106
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
107
    		$lien_inscription = $this->_url->getURL();
108
    		$label_url_inscription = 'S\'inscrire &agrave; ce projet';
109
    	break;
110
    }
111
 
112
    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
113
    $bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
114
	$bouton_deposer_doc .= '<br style="clear:both" />';
115
	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE);
116
	$bouton_creer_repertoire = bouton::toHTML($this->_url->getURL(), 'Cr&eacute;er un r&eacute;pertoire', 'repertoire');
117
	$bouton_creer_repertoire .= '<br style="clear:both" />';
118
	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT);
119
} else {
120
    $droits = PROJET_DROIT_AUCUN ;
121
    $lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
122
    GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
123
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
124
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
125
			'animatedcollapse.init();' ."\n");
126
	$label_url_inscription = 'S\'inscrire &agrave; au projet';
127
 
128
}
129
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
130
 
131
$vue_liste_document->construitEntete($entete_liste) ;
132
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
133
 
134
 
135
// Les liens pour l affichage classique ou arborescent (avec dojo)
136
$this->_url->addQueryString('affichage', 'ajax');
137
$url_ajax = $this->_url->getURL();
138
$this->_url->addQueryString('affichage', 'standart');
139
$url_classique = $this->_url->getURL();
140
$this->_url->removeQueryString('affichage');
141
 
142
$arbre = document::getArbreDocument($this->_id_projet) ;
143
 
144
if (!isset ($_SESSION['mode_affichage'])) {
145
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
146
} else {
147
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
148
}
149
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
150
 
151
$html_no_script = '';
152
if ($vue_liste_document->_mode_affichage == 'ajax') {
153
	$html_no_script .= '<noscript>';
154
	$vue_liste_document->setModeAffichage('standart');
155
	$html_no_script .= $vue_liste_document->toHTML('', '') ;
156
	$html_no_script .= '</noscript>';
157
}
158
 
159
 
160
$html_document .= $vue_liste_document->toHTML($projet->getId(), $droits);
161
$this->_url->removeQueryString(PROJET_VARIABLE_SERVICE);
162
 
163
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DOCUMENT;
164
 
165
ob_start();
166
include_once PROJET_CHEMIN_APPLI.'/squelettes/document.tpl.html';
167
$retour .= ob_get_contents();
168
ob_end_clean();
169
/* +--Fin du code ----------------------------------------------------------------------------------------+
170
*
171
* $Log$
172
*
173
* +-- Fin du code ----------------------------------------------------------------------------------------+
174
*/
2 ddelon 175
?>