| 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: projet.class.php,v 1.8 2007-04-19 15:34:35 neiluj Exp $
|
22 |
// CVS : $Id: projet.class.php,v 1.8.2.1 2007-05-11 13:49:14 alexandre_tb Exp $
|
| 23 |
/**
|
23 |
/**
|
| 24 |
* Application projet
|
24 |
* Application projet
|
| 25 |
*
|
25 |
*
|
| 26 |
* La classe projet
|
26 |
* La classe projet
|
| 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-2004
|
33 |
*@copyright Tela-Botanica 2000-2004
|
| 34 |
*@version $Revision: 1.8 $
|
34 |
*@version $Revision: 1.8.2.1 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| Line 369... |
Line 369... |
| 369 |
}
|
369 |
}
|
| 370 |
return true;
|
370 |
return true;
|
| 371 |
}
|
371 |
}
|
| Line 372... |
Line 372... |
| 372 |
|
372 |
|
| 373 |
/**
|
373 |
/**
|
| 374 |
* Renvoie la liste des documents associés sous forme d'un tableau, avec les
|
374 |
* Renvoie la liste des documents associes sous forme d'un tableau, avec les
|
| 375 |
* informations afférentes. 0 => "nom (cliquable)"
|
375 |
* informations afférentes. 0 => "nom (cliquable)"
|
| 376 |
"Taille"
|
376 |
"Taille"
|
| 377 |
"Date
|
377 |
"Date
|
| 378 |
* de création" "Proriàtaire" "Visibilità" "Action
|
378 |
* de creation" "Prorietaire" "Visibilite" "Action
|
| 379 |
* (cliquable)"
|
379 |
* (cliquable)"
|
| 380 |
*
|
380 |
*
|
| 381 |
* @param visibilite visibilite Si visibilite est à prive, tous les fichiers sont renvoyés ainsi qu'une entrée
|
381 |
* @param visibilite visibilite Si visibilite est prive, tous les fichiers sont renvoyes ainsi qu'une entree
|
| 382 |
* pour indiquer la visibilité du document.
|
382 |
* pour indiquer la visibilite du document.
|
| 383 |
* @return Array
|
383 |
* @return Array
|
| 384 |
* @access public
|
384 |
* @access public
|
| 385 |
*/
|
385 |
*/
|
| 386 |
function getListesDocuments( $chemin, $chemin_icones = "icones/" )
|
386 |
function getListesDocuments( $chemin, $chemin_icones = "icones/", $id_repertoire = '' )
|
| 387 |
{
|
387 |
{
|
| 388 |
// On réalise une requete sur projet_documents avec une jointure sur l'annuaire
|
388 |
// On realise une requete sur projet_documents avec une jointure sur l'annuaire
|
| 389 |
// et sur gen_type_de_fichier pour envoyer un résultat complet.
|
389 |
// et sur gen_type_de_fichier pour envoyer un resultat complet.
|
| 390 |
// On exclue les fichiers racines cad pd_pere is null
|
390 |
// On exclue les fichiers racines cad pd_pere is null
|
| - |
|
391 |
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet ;
|
| - |
|
392 |
if ($id_repertoire != '') $requete .= ' and pd_pere='.$id_repertoire;
|
| - |
|
393 |
if ($id_repertoire == 0) $requete .= ' and pd_pere=0';
|
| 391 |
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet.' order by pd_nom' ;
|
394 |
$requete .= ' order by pd_nom' ;
|
| 392 |
$resultat = $this->_db->query ($requete) ;
|
395 |
$resultat = $this->_db->query ($requete) ;
|
| 393 |
if (DB::isError($resultat)) {
|
396 |
if (DB::isError($resultat)) {
|
| 394 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
397 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 395 |
}
|
398 |
}
|
| 396 |
$tableau_document = array() ;
|
- |
|
| 397 |
|
399 |
$tableau_document = array() ;
|
| 398 |
// Un compteur
|
400 |
// Un compteur
|
| 399 |
$i = 0 ;
|
- |
|
| 400 |
|
401 |
$i = 0 ;
|
| 401 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
402 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
| 402 |
array_push ($tableau_document, new document ($ligne->pd_id, &$this->_db, $chemin, $chemin_icones)) ;
|
403 |
array_push ($tableau_document, new document ($ligne->pd_id, &$this->_db, $chemin, $chemin_icones)) ;
|
| 403 |
}
|
404 |
}
|
| 404 |
return $tableau_document ;
|
405 |
return $tableau_document ;
|
| Line 405... |
Line 406... |
| 405 |
} // end of member function getListesDocuments
|
406 |
}
|
| 406 |
|
407 |
|
| 407 |
|
408 |
|
| 408 |
/**
|
409 |
/**
|
| 409 |
* Renvoie un tableau avec tous les répertoires d'un projet, imbriqué. ['rep1'],
|
410 |
* Renvoie un tableau avec tous les repertoires d'un projet, imbrique. ['rep1'],
|
| 410 |
* ['rep2'] => array (['rep21'], ['rep22']), etc .
|
411 |
* ['rep2'] => array (['rep21'], ['rep22']), etc .
|
| 411 |
*
|
412 |
*
|
| 412 |
* @return Array
|
413 |
* @return Array
|
| 413 |
* @access public
|
414 |
* @access public
|
| 414 |
*/
|
415 |
*/
|
| 415 |
function getListeRepertoireHierarchisee( )
|
416 |
function getListeRepertoireHierarchisee( )
|
| 416 |
{
|
417 |
{
|
| 417 |
// On ne prend que les répertoires
|
418 |
// On ne prend que les repertoires
|
| 418 |
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet.' and pd_ce_type=0 order by pd_nom' ;
|
419 |
$requete = "select pd_id, pd_pere, pd_nom from projet_documents where pd_ce_projet=".$this->_id_projet.' and pd_ce_type=0 order by pd_nom' ;
|
| 419 |
$resultat = $this->_db->query ($requete) ;
|
420 |
$resultat = $this->_db->query ($requete) ;
|
| 420 |
if (DB::isError($resultat)) {
|
421 |
if (DB::isError($resultat)) {
|
| 421 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
422 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 422 |
}
|
423 |
}
|
| 423 |
$tableau_document = array() ;
|
424 |
$tableau_document = array() ;
|
| 424 |
|
425 |
/*
|
| - |
|
426 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
| - |
|
427 |
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
|
| - |
|
428 |
}
|
| Line -... |
Line 429... |
| - |
|
429 |
*/
|
| - |
|
430 |
$tableau = array();
|
| - |
|
431 |
$tab = array();
|
| - |
|
432 |
|
| - |
|
433 |
|
| - |
|
434 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
| - |
|
435 |
array_push ($tableau, array ('id' => $ligne->pd_id,
|
| - |
|
436 |
'id_pere' => $ligne->pd_pere,
|
| - |
|
437 |
'fils' => array(),
|
| - |
|
438 |
'label' => $ligne->pd_nom));
|
| - |
|
439 |
|
| - |
|
440 |
}
|
| - |
|
441 |
|
| 425 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
442 |
// la $tableau reste un tableau de valeur a plat
|
| - |
|
443 |
|
| - |
|
444 |
|
| - |
|
445 |
$i = 0;
|
| - |
|
446 |
foreach ($tableau as $noeud) {
|
| - |
|
447 |
// On teste si le noeud est racine si oui on l ajoute a l arbre sinon on ne l ajoute pas
|
| - |
|
448 |
if ($noeud['id_pere'] == 0) {
|
| - |
|
449 |
$tab[$i] = $noeud;
|
| - |
|
450 |
$this->construireArbre($tab[$i], $tableau) ;
|
| 426 |
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
|
451 |
}
|
| Line -... |
Line 452... |
| - |
|
452 |
$i++;
|
| - |
|
453 |
}
|
| - |
|
454 |
return $tab;
|
| - |
|
455 |
} // end of member function getListeRepertoireHierarchisee
|
| - |
|
456 |
|
| - |
|
457 |
function construireArbre(&$noeud, $tableau) {
|
| - |
|
458 |
$j = 0;
|
| - |
|
459 |
foreach ($tableau as $element) {
|
| - |
|
460 |
// pour chaque element on teste
|
| - |
|
461 |
if ($element['id_pere'] == $noeud['id']) {
|
| - |
|
462 |
$noeud['fils'][$j]= $element ;
|
| Line 427... |
Line 463... |
| 427 |
}
|
463 |
$this->construireArbre($noeud['fils'][$j],$tableau);
|
| 428 |
|
464 |
}
|
| 429 |
return $tableau_document ;
|
465 |
$j++;
|
| 430 |
} // end of member function getListeRepertoireHierarchisee
|
466 |
}
|