Subversion Repositories Applications.projet

Rev

Rev 258 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 258 Rev 294
Line 17... Line 17...
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.10 2007-10-02 09:24:53 alexandre_tb Exp $
22
// CVS : $Id: documents.php,v 1.11 2008-08-25 15:02:49 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* Action documents
26
* Action documents
27
*
27
*
Line 29... Line 29...
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.10 $
34
*@version       $Revision: 1.11 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 42... Line 42...
42
// RAPPEL IMPORTANT
42
// RAPPEL IMPORTANT
43
// On se situe dans la methode run() de la classe projetControleur
43
// On se situe dans la methode run() de la classe projetControleur
44
//
44
//
45
if (!isset($retour)) $retour = '';
45
if (!isset($retour)) $retour = '';
Line -... Line 46...
-
 
46
 
-
 
47
$bouton_deposer_doc = '';
-
 
48
$bouton_creer_repertoire = '';
46
 
49
 
47
// creation de l'objet projet courant
50
// creation de l'objet projet courant
48
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
51
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
Line 49... Line 52...
49
$projet = new projet ($this->_db, $this->_id_projet) ;
52
$projet = new projet ($this->_db, $this->_id_projet) ;
50
 
-
 
Line -... Line 53...
-
 
53
 
-
 
54
// recuperation de la liste des documents associes
-
 
55
 
-
 
56
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $this->_id_repertoire) ;
51
// recuperation de la liste des documents associes
57
 
52
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
58
//$html_document = print_r($liste_documents, true);
53
 
59
 
Line 54... Line 60...
54
// creation de la vue liste de document, on nettoie l'url
60
// creation de la vue liste de document, on nettoie l'url
Line 55... Line 61...
55
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
61
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
-
 
62
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
Line 56... Line 63...
56
include_once PROJET_CHEMIN_CLASSES.'AJAX_arbreDocuments.class.php' ;
63
 
57
 
64
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
58
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
65
 
Line 67... Line 74...
67
 
74
 
Line 68... Line 75...
68
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
75
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
69
 
76
 
70
// verification des droits de l'utilisateur
-
 
-
 
77
// verification des droits de l'utilisateur
71
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
78
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
-
 
79
$loggue = false;
72
 
80
if ($this->_auth->getAuth()) {
73
if ($this->_auth->getAuth()) {
81
    $loggue = true;
74
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
82
    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
75
    $participant = new participe($this->_db) ;
-
 
76
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
-
 
77
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
-
 
78
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
83
    $participant = new participe($this->_db) ;
79
    
-
 
80
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
-
 
81
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
-
 
Line 82... Line -...
82
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
-
 
83
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
-
 
84
 
84
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
Line 85... Line 85...
85
 
85
    $droits = $participant->getStatut($id_u, $this->_id_projet);
86
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
86
 
87
    // si participant, on ajoute le champs visibilite
87
    // si participant, on ajoute le champs visibilite
88
    
88
    
89
    if ($statut !='' || $isAdm) {
89
    if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
Line 90... Line -...
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 ;
90
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
94
 
-
 
95
    foreach ($liste_documents as $document) {
-
 
96
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
-
 
97
            $proprietaire_un_document = true ;
91
    }
98
            $droits = PROJET_DROIT_PROPRIETAIRE ;
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');
99
        }
114
	$bouton_deposer_doc .= '<br style="clear:both" />';
100
    }
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');
101
    if ($statut > 0 || $proprietaire_un_document) {
123
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
102
        array_push ($entete_liste, PROJET_ACTION) ;
124
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
Line 103... Line 125...
103
    }
125
			'animatedcollapse.init();' ."\n");
104
} else {
126
	$label_url_inscription = 'S\'inscrire &agrave; au projet';
Line 105... Line -...
105
    $droits = PROJET_DROIT_AUCUN ;
-
 
Line 106... Line -...
106
}
-
 
107
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
127
	
108
 
128
}
109
$vue_liste_document->construitEntete($entete_liste) ;
129
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
110
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
130
 
111
 
131
$vue_liste_document->construitEntete($entete_liste) ;
112
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
132
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
Line 113... Line 133...
113
 
133
 
Line 114... Line -...
114
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
-
 
115
// Les liens pour l affichage classique ou arborescent (avec dojo)
-
 
116
$this->_url->addQueryString('affichage', 'ajax');
-
 
117
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
-
 
118
$this->_url->addQueryString('affichage', 'standart');
-
 
119
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
134
 
120
$this->_url->removeQueryString('affichage');
135
// Les liens pour l affichage classique ou arborescent (avec dojo)
121
 
136
$this->_url->addQueryString('affichage', 'ajax');
122
$arbre = document::getArbreDocument($this->_id_projet) ;
137
$url_ajax = $this->_url->getURL();
123
 
138
$this->_url->addQueryString('affichage', 'standart');
124
$retour .= '<noscript>';
139
$url_classique = $this->_url->getURL();
Line -... Line 140...
-
 
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
}
125
$vue_liste_document->setModeAffichage('standart');
149
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
126
$retour .= $vue_liste_document->toHTML('', '') ;
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;
127
$retour .= '</noscript>';
164
 
128
 
165
ob_start();