Subversion Repositories Applications.projet

Rev

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

Rev 205 Rev 208
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.6 2007-04-19 09:37:25 alexandre_tb Exp $
22
// CVS : $Id: documents.php,v 1.7 2007-04-19 15:34:35 neiluj 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.6 $
34
*@version       $Revision: 1.7 $
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
$projet = new projet ($this->_db, $this->_id_projet) ;
49
$projet = new projet ($this->_db, $this->_id_projet) ;
49
 
50
 
50
// recuperation de la liste des documents associes
51
// recuperation de la liste des documents associes
51
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
52
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
52
 
53
 
53
// creation de la vue liste de document, on nettoie l'url
54
// creation de la vue liste de document, on nettoie l'url
54
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
55
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
55
include_once PROJET_CHEMIN_CLASSES.'AJAX_arbreDocuments.class.php' ;
56
include_once PROJET_CHEMIN_CLASSES.'AJAX_arbreDocuments.class.php' ;
56
 
57
 
57
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
58
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
58
 
59
 
59
$vue_liste_document = new AJAX_arbreDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
60
$vue_liste_document = new AJAX_arbreDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
60
 
61
 
61
// reglage de parametres de la vue
62
// reglage de parametres 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->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
63
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
64
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
64
 
65
 
65
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
66
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
66
 
67
 
67
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
68
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
68
 
69
 
69
// verification des droits de l'utilisateur
70
// verification des droits de l'utilisateur
70
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
71
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
71
 
72
 
72
if ($this->_auth->getAuth()) {
73
if ($this->_auth->getAuth()) {
-
 
74
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
73
    $participant = new participe($this->_db) ;
75
    $participant = new participe($this->_db) ;
74
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
76
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
75
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
77
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
76
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
78
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
77
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
79
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
78
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
80
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
79
    if ($isAdm) $isCoord = true ;
81
    if ($isAdm) $isCoord = true ;
80
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
82
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
81
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
83
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
82
    
84
    
83
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
85
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
84
    // si participant, on ajoute le champs visibilite
86
    // si participant, on ajoute le champs visibilite
85
    
87
    
86
    if ($statut !='' || $isAdm) {
88
    if ($statut !='' || $isAdm) {
87
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
89
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
88
    }
90
    }
89
    // si chef de projet ou si proprietaire d'au moins 1 document
91
    // si chef de projet ou si proprietaire d'au moins 1 document
90
    $proprietaire_un_document = false ;
92
    $proprietaire_un_document = false ;
91
 
93
 
92
    foreach ($liste_documents as $document) {
94
    foreach ($liste_documents as $document) {
93
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
95
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
94
            $proprietaire_un_document = true ;
96
            $proprietaire_un_document = true ;
95
            $droits = PROJET_DROIT_PROPRIETAIRE ;
97
            $droits = PROJET_DROIT_PROPRIETAIRE ;
96
        }
98
        }
97
    }
99
    }
98
    if ($statut > 0 || $proprietaire_un_document) {
100
    if ($statut > 0 || $proprietaire_un_document) {
99
        array_push ($entete_liste, PROJET_ACTION) ;
101
        array_push ($entete_liste, PROJET_ACTION) ;
100
    }
102
    }
101
} else {
103
} else {
102
    $droits = PROJET_DROIT_AUCUN ;
104
    $droits = PROJET_DROIT_AUCUN ;
103
}
105
}
104
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
106
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
105
 
107
 
106
$vue_liste_document->construitEntete($entete_liste) ;
108
$vue_liste_document->construitEntete($entete_liste) ;
107
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
109
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
108
 
110
 
109
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
111
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
110
 
112
 
111
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
113
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
112
$retour .= $vue_liste_document->toHTML() ;
114
$retour .= $vue_liste_document->toHTML() ;
113
 
115
 
114
$arbre = document::getArbreDocument($this->_id_projet) ;
116
$arbre = document::getArbreDocument($this->_id_projet) ;
115
 
117
 
116
 
118
 
117
$retour .= $vue_liste_document->AJAX_construitListe ($this->_id_projet, $droits, '', $this->_db) ;
119
$retour .= $vue_liste_document->AJAX_construitListe ($this->_id_projet, $droits, '', $this->_db) ;
118
 
120
 
119
 
121
 
120
?>
122
?>