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: document.class.php,v 1.10 2008-08-26 12:41:10 alexandre_tb Exp $
|
22 |
// CVS : $Id: document.class.php,v 1.9 2008-08-25 15:18:10 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Application projet
|
24 |
* Application projet
|
25 |
*
|
25 |
*
|
26 |
* La classe document
|
26 |
* La classe document
|
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.10 $
|
34 |
*@version $Revision: 1.9 $
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
*/
|
36 |
*/
|
Line 37... |
Line 37... |
37 |
|
37 |
|
Line 137... |
Line 137... |
137 |
$requete = "select * from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
|
137 |
$requete = "select * from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
|
138 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
138 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
139 |
if (DB::isError($resultat)) {
|
139 |
if (DB::isError($resultat)) {
|
140 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
140 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
141 |
}
|
141 |
}
|
- |
|
142 |
|
142 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
143 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
- |
|
144 |
|
143 |
if ($resultat->numRows()>0) {
|
145 |
if ($resultat->numRows()>0) {
|
- |
|
146 |
|
144 |
$this->nom_fichier = $ligne->pd_lien;
|
147 |
$this->nom_fichier = $ligne->pd_lien;
|
145 |
$this->_id_projet = $ligne->pd_ce_projet;
|
148 |
$this->_id_projet = $ligne->pd_ce_projet;
|
146 |
$this->_id = $ligne->pd_id ;
|
149 |
$this->_id = $ligne->pd_id ;
|
- |
|
150 |
|
147 |
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
|
151 |
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
|
Line 148... |
Line 152... |
148 |
|
152 |
|
149 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
153 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
150 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
154 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
Line 308... |
Line 312... |
308 |
{
|
312 |
{
|
309 |
$chemin_repertoire_entre_racine_et_fichier = '';
|
313 |
$chemin_repertoire_entre_racine_et_fichier = '';
|
Line 310... |
Line 314... |
310 |
|
314 |
|
311 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
315 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
- |
|
316 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
312 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
317 |
|
Line 313... |
Line 318... |
313 |
// l arborescence des repertoires
|
318 |
// l arborescence des repertoires
|
- |
|
319 |
|
314 |
|
320 |
$tableau_navigation = $this->getPath($this->_id) ;
|
315 |
$tableau_navigation = $this->getPath($this->_id) ;
|
321 |
|
316 |
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
|
322 |
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
|
317 |
for ($i = 0; $i < count ($tableau_navigation); $i++) {
|
323 |
for ($i = 0; $i < count ($tableau_navigation); $i++) {
|
- |
|
324 |
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
|
318 |
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
|
325 |
}
|
319 |
}
|
326 |
|
Line 320... |
Line 327... |
320 |
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
|
327 |
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
|
Line 376... |
Line 383... |
376 |
}
|
383 |
}
|
Line 377... |
Line 384... |
377 |
|
384 |
|
378 |
return $chemin_rep_id_nom;
|
385 |
return $chemin_rep_id_nom;
|
Line -... |
Line 386... |
- |
|
386 |
}
|
379 |
}
|
387 |
|
380 |
|
388 |
|
381 |
/**
|
389 |
/**
|
382 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
390 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
383 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
391 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
Line 450... |
Line 458... |
450 |
//$pd_lien .= SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
|
458 |
//$pd_lien .= SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
|
451 |
$pd_lien = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
|
459 |
$pd_lien = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
|
452 |
}
|
460 |
}
|
453 |
$id = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id') ;
|
461 |
$id = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id') ;
|
Line 454... |
Line 462... |
454 |
|
462 |
|
455 |
$requete = "insert into projet_documents set pd_id=".$id ;
|
463 |
$requete = "insert into projet_documents set pd_id=".$GLOBALS['projet_db']->escapeSimple($id) ;
|
456 |
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
|
464 |
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
|
457 |
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
|
465 |
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
|
458 |
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
|
466 |
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
|
Line 592... |
Line 600... |
592 |
* @param int nombre Le nombre de document à renvoyer
|
600 |
* @param int nombre Le nombre de document à renvoyer
|
593 |
* @return Array
|
601 |
* @return Array
|
594 |
* @static
|
602 |
* @static
|
595 |
* @access public
|
603 |
* @access public
|
596 |
*/
|
604 |
*/
|
597 |
function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
|
605 |
static function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
|
598 |
{
|
606 |
{
|
599 |
// on recherche les documents, hors repertoire
|
607 |
// on recherche les documents, hors repertoire
|
600 |
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
|
608 |
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
|
601 |
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet).' ';
|
609 |
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$GLOBALS['projet_db']->escapeSimple($id_projet).' ';
|
602 |
if (!$visible) $requete .= ' and pd_visibilite="public" ';
|
610 |
if (!$visible) $requete .= ' and pd_visibilite="public" ';
|
603 |
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
|
611 |
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
|
604 |
$resultat = $objetDB->query ($requete) ;
|
612 |
$resultat = $objetDB->query ($requete) ;
|
- |
|
613 |
|
605 |
if (DB::isError ($resultat)) {
|
614 |
if (DB::isError ($resultat)) {
|
606 |
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
615 |
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
607 |
}
|
616 |
}
|
608 |
$tableau_document = array() ;
|
617 |
$tableau_document = array() ;
|
Line 609... |
Line 618... |
609 |
|
618 |
|
610 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
619 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
611 |
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
|
620 |
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
|
- |
|
621 |
}
|
612 |
}
|
622 |
|
613 |
return $tableau_document ;
|
623 |
return $tableau_document ;
|
Line 614... |
Line 624... |
614 |
} // end of member function getDocumentsRecents
|
624 |
} // end of member function getDocumentsRecents
|
615 |
|
625 |
|