Subversion Repositories Applications.projet

Rev

Rev 431 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 431 Rev 437
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: HTML_listeDocuments.class.php,v 1.9 2007-06-25 12:15:06 alexandre_tb Exp $
22
// CVS : $Id: HTML_listeDocuments.class.php,v 1.9 2007-06-25 12:15:06 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe HTML_listeDocuments
26
* La classe HTML_listeDocuments
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-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.9 $
34
*@version       $Revision: 1.9 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
 
43
 
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
// |                                           LISTE des constantes                                       |
45
// |                                           LISTE des constantes                                       |
46
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
 
47
 
48
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
48
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
49
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
49
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
50
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
50
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
51
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
51
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
52
 
52
 
53
 
53
 
54
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
54
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
55
/**
55
/**
56
 * class HTML_listeDocuments
56
 * class HTML_listeDocuments
57
 * 
57
 * 
58
 */
58
 */
59
class HTML_listeDocuments extends HTML_Liste
59
class HTML_listeDocuments extends HTML_Liste
60
{
60
{
61
    /*** Attributes: ***/
61
    /*** Attributes: ***/
62
 
62
 
63
    /**
63
    /**
64
     * Une url.
64
     * Une url.
65
     * @access private
65
     * @access private
66
     */
66
     */
67
    var $_url;
67
    var $_url;
68
    
68
    
69
    /**
69
    /**
70
     * Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
70
     * Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
71
     * "supprimer" => 3 Elles seront pass�es en param�tre aux url des icones des
71
     * "supprimer" => 3 Elles seront pass�es en param�tre aux url des icones des
72
     * documents.
72
     * documents.
73
     * @access private
73
     * @access private
74
     */
74
     */
75
    var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
75
    var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
76
 
76
 
77
    /**
77
    /**
78
     * Indique le chemin des icones couper, coller, modifier, supprimer. 
78
     * Indique le chemin des icones couper, coller, modifier, supprimer. 
79
     * @access private
79
     * @access private
80
     */
80
     */
81
    var $_chemin_icone = "icones/";
81
    var $_chemin_icone = "icones/";
82
    
82
    
83
    /**
83
    /**
84
     * L'identifiant du repertoire que l'on est en train d'observer.
84
     * L'identifiant du repertoire que l'on est en train d'observer.
85
     * @access private
85
     * @access private
86
     */
86
     */
87
    var $_id_repertoire;
87
    var $_id_repertoire;
88
 
88
 
89
    /**
89
    /**
90
     * Un tableau contenant les id et les noms du chemin des r�pertoires. 0 => ["id"],
90
     * Un tableau contenant les id et les noms du chemin des r�pertoires. 0 => ["id"],
91
     * ["nom"] etc.
91
     * ["nom"] etc.
92
     * @access private
92
     * @access private
93
     */
93
     */
94
    var $_chemin_navigation = array ();
94
    var $_chemin_navigation = array ();
95
 
95
 
96
    /**
96
    /**
97
     * un pointeur vers une authentificatin PEAR
97
     * un pointeur vers une authentificatin PEAR
98
     * @access private
98
     * @access private
99
     */
99
     */
100
    var $_auth ;
100
    var $_auth ;
101
    
101
    
102
    /**
102
    /**
103
     * le style d affichage
103
     * le style d affichage
104
     * @access private
104
     * @access private
105
     */
105
     */
106
    var $_mode_affichage ;
106
    var $_mode_affichage ;
107
    /**
107
    /**
108
     * 
108
     * 
109
     *
109
     *
110
     * @param bool utilise_pager Indique l'utilisation ou non du Pager.
110
     * @param bool utilise_pager Indique l'utilisation ou non du Pager.
111
     * @return void
111
     * @return void
112
     * @access public
112
     * @access public
113
     */
113
     */
114
    function HTML_listeDocuments(&$url,  $utilise_pager = false, $id_repertoire = 0, $auth = '' )
114
    function HTML_listeDocuments(&$url,  $utilise_pager = false, $id_repertoire = 0, $auth = '' )
115
    {
115
    {
116
        HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
116
        HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
117
        $this->_url = $url ;
117
        $this->_url = $url ;
118
        
118
        
119
        $this->_id_repertoire = $id_repertoire ;
119
        $this->_id_repertoire = $id_repertoire ;
120
        if (is_object($auth)) {
120
        if (is_object($auth)) {
121
            $this->_auth = $auth ;
121
            $this->_auth = $auth ;
122
        }
122
        }
123
        $this->_mode_affichage = 'standart';
123
        $this->_mode_affichage = 'standart';
124
    } // end of member function HTML_listeDocuments
124
    } // end of member function HTML_listeDocuments
125
 
125
 
126
    /**
126
    /**
127
     * 
127
     * 
128
     *
128
     *
129
     * @param bool utilise_pager Voir HTML_listeDocuments
129
     * @param bool utilise_pager Voir HTML_listeDocuments
130
     * @return void
130
     * @return void
131
     * @access public
131
     * @access public
132
     */
132
     */
133
    function __construct( &$url,  $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' )
133
    function __construct( &$url,  $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' )
134
    {
134
    {
135
        $this->HTML_listeDocuments($url,  $utilise_pager, $id_repertoire, $auth);
135
        $this->HTML_listeDocuments($url,  $utilise_pager, $id_repertoire, $auth);
136
        
136
        
137
    } // end of member function __construct
137
    } // end of member function __construct
138
 
138
 
139
    /**
139
    /**
140
     * 
140
     * 
141
     *
141
     *
142
     * @param Array tableau_label Un tableau contenant les labels � afficher dans l'ent�te.
142
     * @param Array tableau_label Un tableau contenant les labels � afficher dans l'ent�te.
143
     * @return void
143
     * @return void
144
     * @access public
144
     * @access public
145
     */
145
     */
146
    function construitEntete( $tableau_label )
146
    function construitEntete( $tableau_label )
147
    {
147
    {
148
        $this->addRow ($tableau_label, NULL, 'TH') ;
148
        $this->addRow ($tableau_label, NULL, 'TH') ;
149
    }
149
    }
150
 
150
 
151
    /**
151
    /**
152
     * 
152
     * 
153
     *
153
     *
154
     * @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
154
     * @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
155
     * tableau.
155
     * tableau.
156
     * @return void
156
     * @return void
157
     * @access public
157
     * @access public
158
     */
158
     */
159
    function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
159
    function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
160
    {
160
    {
161
    
161
    
162
   // mail('aurelien@tela-botanica.org','contenu de tableau documents', print_r($tableau_document,true));
162
   // mail('aurelien@tela-botanica.org','contenu de tableau documents', print_r($tableau_document,true));
163
        if ($this->_mode_affichage == 'standart') {
163
        if ($this->_mode_affichage == 'standart') {
164
	        $compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
164
	        $compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
165
	//var_dump ($tableau_document);
165
	//var_dump ($tableau_document);
166
	        for ($i = 0; $i < count ($tableau_document) ; $i++) {
166
	        for ($i = 0; $i < count ($tableau_document) ; $i++) {
167
	            // Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche
167
	            // Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche
168
	            if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
168
	            if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
169
	                // d'abord l'image
169
	                // d'abord l'image
170
	                $icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
170
	                $icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
171
	                // Si le document est un repertoire, on ajoute id_repertoire au lien.
171
	                // Si le document est un repertoire, on ajoute id_repertoire au lien.
172
	                
172
	                
173
	                
173
	                
174
	                if ($tableau_document[$i]->isRepertoire()) {
174
	                if ($tableau_document[$i]->isRepertoire()) {
175
	                    $this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
175
	                    $this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
176
	                    
176
	                    
177
	                    $lien = $this->_url->getURL() ;
177
	                    $lien = $this->_url->getURL() ;
178
	                } else {    //  Si c'est un fichier, on fait un lien direct
178
	                } else {    //  Si c'est un fichier, on fait un lien direct
179
	                	
179
	                	
180
	                	$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
180
	                	$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
181
	                	$this->_url->addQueryString('service', 'telechargement');
181
	                	$this->_url->addQueryString('service', 'telechargement');
182
	                    $lien = $this->_url->getURL() ;
182
	                    $lien = $this->_url->getURL() ;
183
	                    $this->_url->removeQueryString('service');
183
	                    $this->_url->removeQueryString('service');
184
	                    $this->_url->removeQueryString('id_document');
184
	                    $this->_url->removeQueryString('id_document');
185
			   
185
			   
186
			   if($this->_url->querystring[PROJET_VARIABLE_ID_PROJET] == null) {
186
			   if($this->_url->querystring[PROJET_VARIABLE_ID_PROJET] == null) {
187
				$identifiant_projet =$tableau_document[$i]->_id_projet ;
187
				$identifiant_projet =$tableau_document[$i]->_id_projet ;
188
			   }
188
			   }
189
			   else
189
			   else
190
			   {
190
			   {
191
			       $identifiant_projet =$this->_url->querystring[PROJET_VARIABLE_ID_PROJET] ;
191
			       $identifiant_projet =$this->_url->querystring[PROJET_VARIABLE_ID_PROJET] ;
192
			   }
192
			   }
193
			    
193
			    
194
	                   //$lien = 'http://'.$this->_url->host.'/projets/'.$this->_url->querystring[PROJET_VARIABLE_ID_PROJET].'/telechargement/'.$tableau_document[$i]->getIdDocument();
194
	                   //$lien = 'http://'.$this->_url->host.'/projets/'.$this->_url->querystring[PROJET_VARIABLE_ID_PROJET].'/telechargement/'.$tableau_document[$i]->getIdDocument();
195
			  $lien = 'http://'.$this->_url->host.'/projets/'.$identifiant_projet.'/telechargement/'.$tableau_document[$i]->getIdDocument();
195
			  $lien = 'http://'.$this->_url->host.'/projets/'.$identifiant_projet.'/telechargement/'.$tableau_document[$i]->getIdDocument();
196
	                }
196
	                }
197
	                // pour eviter des effets de bords, on enleve id_repertoire de l'url
197
	                // pour eviter des effets de bords, on enleve id_repertoire de l'url
198
	                // dans le cas d'un repertoire, pour les fichiers on le laisse pour
198
	                // dans le cas d'un repertoire, pour les fichiers on le laisse pour
199
	                // qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
199
	                // qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
200
	                if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
200
	                if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
201
	                
201
	                
202
	                // on insere le lien
202
	                // on insere le lien
203
	                $lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
203
	                $lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
204
	                
204
	                
205
	                $taille = $tableau_document[$i]->getTailleFormatee();
205
	                $taille = $tableau_document[$i]->getTailleFormatee();
206
	                
206
	                
207
	                // Recuperation de l'auteur
207
	                // Recuperation de l'auteur
208
	                include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
208
	                include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
209
	                $annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID, 
209
	                $annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID, 
210
	                                            'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
210
	                                            'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
211
	                $annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
211
	                $annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
212
	                $nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
212
	                $nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
213
	                // On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne
213
	                // On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne
214
	                $ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
214
	                $ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
215
	                if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
215
	                if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
216
	                
216
	                
217
	                // On ajoute au tableau, les action couper / modifier / supprimer
217
	                // On ajoute au tableau, les action couper / modifier / supprimer
218
	                if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire) 
218
	                if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire) 
219
	                                                array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
219
	                                                array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
220
	                
220
	                
221
	                if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
221
	                if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
222
		                $this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
222
		                $this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
223
		                // enfin , s'il y a une description, on l'ajoute, mais sur une ligne enti�re (colspan)
223
		                // enfin , s'il y a une description, on l'ajoute, mais sur une ligne enti�re (colspan)
224
		                if ($tableau_document[$i]->getDescription() != "") {
224
		                if ($tableau_document[$i]->getDescription() != "") {
225
		                    $this->addRow (array ($tableau_document[$i]->getDescription()), 
225
		                    $this->addRow (array ($tableau_document[$i]->getDescription()), 
226
		                    		array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
226
		                    		array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
227
		                    $this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
227
		                    $this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
228
		                }
228
		                }
229
	                }
229
	                }
230
	                $compteur++;
230
	                $compteur++;
231
	            }
231
	            }
232
	            
232
	            
233
	            if ($compteur == 2) $compteur = 0 ;
233
	            if ($compteur == 2) $compteur = 0 ;
234
	        }
234
	        }
235
	        $this->_url->removeQueryString('id_document');
235
	        $this->_url->removeQueryString('id_document');
236
	        $this->updateColAttributes(0, array ('class' => 'col1')) ;
236
	        $this->updateColAttributes(0, array ('class' => 'col1')) ;
237
        } else {
237
        } else {
238
        	
238
        	
239
        }
239
        }
240
    } // end of member function construitListe
240
    } // end of member function construitListe
241
 
241
 
242
    /**
242
    /**
243
     * 
243
     * 
244
     *
244
     *
245
     * @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
245
     * @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
246
     * "supprimer".
246
     * "supprimer".
247
     * @return void
247
     * @return void
248
     * @access public
248
     * @access public
249
     */
249
     */
250
    function setAction( $actions )
250
    function setAction( $actions )
251
    {
251
    {
252
        $this->_actions = $actions ;
252
        $this->_actions = $actions ;
253
    }
253
    }
254
 
254
 
255
    /**
255
    /**
256
     * 
256
     * 
257
     *
257
     *
258
     * @param string le mode, valeur possible standart ou ajax
258
     * @param string le mode, valeur possible standart ou ajax
259
     * @return void
259
     * @return void
260
     * @access public
260
     * @access public
261
     */
261
     */
262
    function setModeAffichage( $mode )
262
    function setModeAffichage( $mode )
263
    {
263
    {
264
        $this->_mode_affichage = $mode ;
264
        $this->_mode_affichage = $mode ;
265
    }
265
    }
266
    
266
    
267
 
267
 
268
    /**
268
    /**
269
     * 
269
     * 
270
     *
270
     *
271
     * @param string chemin Le chemin vers les icones couper, coller ...
271
     * @param string chemin Le chemin vers les icones couper, coller ...
272
     * @return void
272
     * @return void
273
     * @access public
273
     * @access public
274
     */
274
     */
275
    function setCheminIcones( $chemin )
275
    function setCheminIcones( $chemin )
276
    {
276
    {
277
        $this->_chemin_icone = $chemin ;
277
        $this->_chemin_icone = $chemin ;
278
    }
278
    }
279
 
279
 
280
    /**
280
    /**
281
     * Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
281
     * Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
282
     * repertoires.
282
     * repertoires.
283
     *
283
     *
284
     * @return string
284
     * @return string
285
     * @access public
285
     * @access public
286
     */
286
     */
287
    function toHTML($id_projet = '', $droits)
287
    function toHTML($id_projet = '', $droits)
288
    {
288
    {
289
        if ($this->_mode_affichage == 'standart') {
289
        if ($this->_mode_affichage == 'standart') {
290
	        $chemin_navig = "" ;
290
	        $chemin_navig = "" ;
291
	        if ($this->_id_repertoire != "") {
291
	        if ($this->_id_repertoire != "") {
292
	            $this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
292
	            $this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
293
	            $chemin_navig = "<p>" ;
293
	            $chemin_navig = "<p>" ;
294
	            $chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
294
	            $chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
295
	            $this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
295
	            $this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
296
	            for ($i = 0; $i < count ($this->_chemin_navigation); $i++) {
296
	            for ($i = 0; $i < count ($this->_chemin_navigation); $i++) {
297
	                $chemin_navig .= "&gt;&nbsp;" ;
297
	                $chemin_navig .= "&gt;&nbsp;" ;
298
	                $doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
298
	                $doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
299
	                $nom = $doc->getNomLong() ;
299
	                $nom = $doc->getNomLong() ;
300
	                $this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
300
	                $this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
301
	                $chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ; 
301
	                $chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ; 
302
	            }
302
	            }
303
	            $chemin_navig .= "</p>\n" ;
303
	            $chemin_navig .= "</p>\n" ;
304
	        }
304
	        }
305
	        $res = $chemin_navig.HTML_Liste::toHTML() ;
305
	        $res = $chemin_navig.HTML_Liste::toHTML() ;
306
	        if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
306
	        if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
307
	            return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
307
	            return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
308
	        }
308
	        }
309
        } else {
309
        } else {
310
        	GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
310
        	GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
311
        	GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
311
        	GEN_stockerFichierScript('dojoScriptProjet', PROJET_CHEMIN_APPLI . 'js/arbreDocument.js');
312
		
312
		
313
			$res = '' ;
313
			$res = '' ;
314
			
314
			
315
			$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
315
			$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
316
			$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
316
			$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
317
			
317
			
318
			$RCPUrl = $this->_url->getURL();
318
			$RCPUrl = $this->_url->getURL();
319
			// Le noeud racine
319
			// Le noeud racine
320
				
320
				
321
			if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
321
			if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
322
				$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
322
				$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
323
			} else {
323
			} else {
324
				$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
324
				$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
325
			}
325
			}
326
	        $res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
326
	        $res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
327
				<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
327
				<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
328
				'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';    
328
				'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';    
329
			                              
329
			                              
330
        }
330
        }
331
        return $res ;
331
        return $res ;
332
    } // end of member function toHTML
332
    } // end of member function toHTML
333
 
333
 
334
    /**
334
    /**
335
     * 
335
     * 
336
     *
336
     *
337
     * @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires.  0 => ["id"],
337
     * @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires.  0 => ["id"],
338
     * ["nom"] etc.
338
     * ["nom"] etc.
339
     * @return void
339
     * @return void
340
     * @access public
340
     * @access public
341
     */
341
     */
342
    function setCheminNavigation( $tableau_navigation )
342
    function setCheminNavigation( $tableau_navigation )
343
    {
343
    {
344
        $this->_chemin_navigation = $tableau_navigation ;
344
        $this->_chemin_navigation = $tableau_navigation ;
345
    } // end of member function setCheminNavigation
345
    } // end of member function setCheminNavigation
346
 
346
 
347
    /**
347
    /**
348
     * Affiche la legende des actions du module "documents"
348
     * Affiche la legende des actions du module "documents"
349
     *
349
     *
350
     * @return string
350
     * @return string
351
     * @access public
351
     * @access public
352
     */
352
     */
353
    function affLegende( )
353
    function affLegende( )
354
    {
354
    {
355
        $res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
355
        $res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
356
        $res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
356
        $res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
357
        $res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
357
        $res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
358
        $res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
358
        $res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
359
        return $res ;
359
        return $res ;
360
    }
360
    }
361
 
361
 
362
 
362
 
363
    /**
363
    /**
364
     * Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
364
     * Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
365
     *
365
     *
366
     * @return string
366
     * @return string
367
     * @access private
367
     * @access private
368
     */
368
     */
369
    function _getCheminHTML( )
369
    function _getCheminHTML( )
370
    {
370
    {
371
        $path = "" ;
371
        $path = "" ;
372
 
372
 
373
        return $path ;
373
        return $path ;
374
    }
374
    }
375
 
375
 
376
    /**
376
    /**
377
     * Renvoie une chaine contenant le code html des icones des actions possibles sur un
377
     * Renvoie une chaine contenant le code html des icones des actions possibles sur un
378
     * fichier, c'est a dire couper, modifier, supprimer.
378
     * fichier, c'est a dire couper, modifier, supprimer.
379
     *
379
     *
380
     * @return string
380
     * @return string
381
     * @access private
381
     * @access private
382
     */
382
     */
383
    function _actions($document)
383
    function _actions($document)
384
    {
384
    {
385
        $this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
385
        $this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
386
        
386
        
387
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
387
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
388
        $couper = ' '.PROJET_FICHIER_COUPER ;
388
        $couper = ' '.PROJET_FICHIER_COUPER ;
389
        $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
389
        $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
390
        
390
        
391
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
391
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
392
        $modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
392
        $modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
393
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
393
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
394
        $supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
394
        $supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
395
        $this->_url->removeQueryString ('id_document') ;
395
        $this->_url->removeQueryString ('id_document') ;
396
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
396
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
397
        return $modifier.$supprimer.$couper ;
397
        return $modifier.$supprimer.$couper ;
398
    } // end of member function _action
398
    } // end of member function _action
399
 
399
 
400
 
400
 
401
} // end of HTML_listeDocuments
401
} // end of HTML_listeDocuments
402
?>
402
?>