Subversion Repositories Applications.papyrus

Rev

Rev 1378 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1378 Rev 1633
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: documents.php,v 1.7.2.1 2007-05-11 13:38:32 alexandre_tb Exp $
22
// CVS : $Id: documents.php,v 1.7.2.2 2007-10-02 09:23:07 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* Action documents
26
* Action documents
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
33
*@copyright     Tela-Botanica 2000-2005
34
*@version       $Revision: 1.7.2.1 $
34
*@version       $Revision: 1.7.2.2 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
42
// RAPPEL IMPORTANT
42
// RAPPEL IMPORTANT
43
// On se situe dans la méthode run() de la classe projetControleur
43
// On se situe dans la méthode run() de la classe projetControleur
44
//
44
//
45
if (!isset($retour)) $retour = '';
45
if (!isset($retour)) $retour = '';
46
 
46
 
47
// creation de l'objet projet courant
47
// creation de l'objet projet courant
48
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
48
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
49
$projet = new projet ($this->_db, $this->_id_projet) ;
49
$projet = new projet ($this->_db, $this->_id_projet) ;
50
 
50
 
51
// recuperation de la liste des documents associes
51
// recuperation de la liste des documents associes
52
// en filtrant sur le repertoire courant pour limiter le nombre de resultat
52
// en filtrant sur le repertoire courant pour limiter le nombre de resultat
53
if ($this->_id_repertoire != "") {
53
if ($this->_id_repertoire != "") {
54
	$id_repertoire = $this->_id_repertoire;
54
	$id_repertoire = $this->_id_repertoire;
55
} else {
55
} else {
56
	$id_repertoire = 0 ;
56
	$id_repertoire = 0 ;
57
}
57
}
58
 
58
 
59
 
59
 
60
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $id_repertoire) ;
60
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $id_repertoire) ;
61
 
61
 
62
// creation de la vue liste de document, on nettoie l'url
62
// creation de la vue liste de document, on nettoie l'url
63
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
63
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
64
 
64
 
65
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
65
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
66
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
66
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
67
 
67
 
68
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth, $projet->getId()) ;
68
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth, $projet->getId()) ;
69
 
69
 
70
// reglage de parametres de la vue
70
// reglage de parametres de la vue
71
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
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) ;
72
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
73
 
73
 
74
$tableau_navigation = document::getPath($this->_id_repertoire, $this->_db) ;
74
$tableau_navigation = document::getPath($this->_id_repertoire, $this->_db) ;
75
//$retour .= $GLOBALS['log'];
75
//$retour .= $GLOBALS['log'];
76
$tableau_navigation = array_merge(is_array ($tableau_navigation) ? array_reverse($tableau_navigation) : array(), array($id_repertoire));
76
$tableau_navigation = array_merge(is_array ($tableau_navigation) ? array_reverse($tableau_navigation) : array(), array($id_repertoire));
77
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
77
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
78
 
78
 
79
// verification des droits de l'utilisateur
79
// verification des droits de l'utilisateur
80
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
80
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
81
 
81
 
82
if ($this->_auth->getAuth()) {
82
if ($this->_auth->getAuth()) {
83
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
83
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
84
    $participant = new participe($this->_db) ;
84
    $participant = new participe($this->_db) ;
85
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
85
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
86
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
-
 
87
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
-
 
88
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
-
 
89
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
-
 
90
    if ($isAdm) $isCoord = true ;
-
 
-
 
86
    
-
 
87
    
-
 
88
   
-
 
89
    
91
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
90
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
92
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
91
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
93
    
-
 
-
 
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) ;
-
 
95
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
-
 
96
    if ($isAdm) $isCoord = true ;
94
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
97
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
95
    // si participant, on ajoute le champs visibilite
98
    // si participant, on ajoute le champs visibilite
96
    
99
    
97
    if ($statut !='' || $isAdm) {
100
    if ($statut !='' || $isAdm) {
98
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
101
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
99
    }
102
    }
100
    // si chef de projet ou si proprietaire d'au moins 1 document
103
    // si chef de projet ou si proprietaire d'au moins 1 document
101
    $proprietaire_un_document = false ;
104
    $proprietaire_un_document = false ;
102
 
105
 
103
    foreach ($liste_documents as $document) {
106
    foreach ($liste_documents as $document) {
104
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
107
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
105
            $proprietaire_un_document = true ;
108
            $proprietaire_un_document = true ;
106
            $droits = PROJET_DROIT_PROPRIETAIRE ;
109
            $droits = PROJET_DROIT_PROPRIETAIRE ;
107
        }
110
        }
108
    }
111
    }
109
    if ($statut > 0 || $proprietaire_un_document) {
112
    if ($statut > 0 || $proprietaire_un_document) {
110
        array_push ($entete_liste, PROJET_ACTION) ;
113
        array_push ($entete_liste, PROJET_ACTION) ;
111
    }
114
    }
112
} else {
115
} else {
113
    $droits = PROJET_DROIT_AUCUN ;
116
    $droits = PROJET_DROIT_AUCUN ;
114
}
117
}
115
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
118
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
116
 
119
 
117
$vue_liste_document->construitEntete($entete_liste) ;
120
$vue_liste_document->construitEntete($entete_liste) ;
118
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
121
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
119
 
122
 
120
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
123
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
121
 
124
 
122
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
125
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
123
// Les liens pour l affichage classique ou arborescent (avec dojo)
126
// Les liens pour l affichage classique ou arborescent (avec dojo)
124
$this->_url->addQueryString('affichage', 'ajax');
127
$this->_url->addQueryString('affichage', 'ajax');
125
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
128
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
126
$this->_url->addQueryString('affichage', 'standart');
129
$this->_url->addQueryString('affichage', 'standart');
127
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
130
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
128
$this->_url->removeQueryString('affichage');
131
$this->_url->removeQueryString('affichage');
129
 
132
 
130
 
133
 
131
$retour .= '<noscript>';
134
$retour .= '<noscript>';
132
$vue_liste_document->setModeAffichage('standart');
135
$vue_liste_document->setModeAffichage('standart');
133
$retour .= $vue_liste_document->toHTML('', '') ;
136
$retour .= $vue_liste_document->toHTML('', '') ;
134
$retour .= '</noscript>';
137
$retour .= '</noscript>';
135
 
138
 
136
if (!isset ($_SESSION['mode_affichage'])) {
139
if (!isset ($_SESSION['mode_affichage'])) {
137
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'ajax';
140
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
138
} else {
141
} else {
139
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
142
	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
140
}
143
}
141
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
144
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
142
 
145
 
143
$retour .= $vue_liste_document->toHTML($projet->getId(), $droits);
146
$retour .= $vue_liste_document->toHTML($projet->getId(), $droits);
144
//$retour .= $GLOBALS['log'];
147
//$retour .= $GLOBALS['log'];
145
 
148
 
146
?>
149
?>