| Line 1... |
Line 1... |
| 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 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 79... |
Line 79... |
| 79 |
/**
|
79 |
/**
|
| 80 |
* Un objet PEAR:DB
|
80 |
* Un objet PEAR:DB
|
| 81 |
* @access private
|
81 |
* @access private
|
| 82 |
*/
|
82 |
*/
|
| 83 |
var $_db;
|
83 |
var $_db;
|
| 84 |
|
84 |
|
| 85 |
/**
|
85 |
/**
|
| 86 |
* L'identifiant du document dans la table projet_document.
|
86 |
* L'identifiant du document dans la table projet_document.
|
| 87 |
* @access private
|
87 |
* @access private
|
| 88 |
*/
|
88 |
*/
|
| 89 |
var $_id;
|
89 |
var $_id;
|
| Line 90... |
Line 90... |
| 90 |
|
90 |
|
| 91 |
/**
|
91 |
/**
|
| 92 |
*
|
92 |
*
|
| 93 |
* @access private
|
93 |
* @access private
|
| 94 |
*/
|
94 |
*/
|
| 95 |
var $_chemin_icone;
|
95 |
var $_chemin_icone;
|
| 96 |
|
96 |
|
| 97 |
/**
|
97 |
/**
|
| 98 |
* L'identifiant du père, peut être à NULL
|
98 |
* L'identifiant du père, peut être à NULL
|
| 99 |
* @access private
|
99 |
* @access private
|
| 100 |
*/
|
100 |
*/
|
| 101 |
var $_id_pere;
|
101 |
var $_id_pere;
|
| 102 |
|
102 |
|
| 103 |
/**
|
103 |
/**
|
| 104 |
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
|
104 |
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
|
| 105 |
* @access private
|
105 |
* @access private
|
| 106 |
*/
|
106 |
*/
|
| Line 114... |
Line 114... |
| 114 |
/**
|
114 |
/**
|
| 115 |
* Le chemin du fichier, depuis le répertoire du projet
|
115 |
* Le chemin du fichier, depuis le répertoire du projet
|
| 116 |
*
|
116 |
*
|
| 117 |
*/
|
117 |
*/
|
| 118 |
var $_pd_lien ;
|
118 |
var $_pd_lien ;
|
| 119 |
|
119 |
|
| 120 |
var $nom_fichier ;
|
120 |
var $nom_fichier ;
|
| 121 |
/**
|
121 |
/**
|
| 122 |
*
|
122 |
*
|
| 123 |
*
|
123 |
*
|
| 124 |
* @param int id_document L'identifiant du document dans la base.
|
124 |
* @param int id_document L'identifiant du document dans la base.
|
| 125 |
* @param int objetDB un objet PEAR:DB
|
125 |
* @param int objetDB un objet PEAR:DB
|
| 126 |
* @return void
|
126 |
* @return void
|
| 127 |
* @access public
|
127 |
* @access public
|
| 128 |
*/
|
128 |
*/
|
| 129 |
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
|
129 |
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
|
| 130 |
{
|
130 |
{
|
| 131 |
if (is_object($objetDB)) {
|
131 |
if (is_object($objetDB)) {
|
| 132 |
$GLOBALS['projet_db'] = $objetDB;
|
132 |
$GLOBALS['projet_db'] = $objetDB;
|
| 133 |
}
|
133 |
}
|
| 134 |
$this->_chemin_icone = $chemin_icones ;
|
134 |
$this->_chemin_icone = $chemin_icones ;
|
| 135 |
|
135 |
|
| 136 |
if ($id_document != "") {
|
136 |
if ($id_document != "") {
|
| 137 |
$requete = "select * from projet_documents where pd_id=".$id_document ;
|
137 |
$requete = "select * from projet_documents where pd_id=".$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()) ;
|
| Line 143... |
Line 143... |
| 143 |
if ($resultat->numRows()>0) {
|
143 |
if ($resultat->numRows()>0) {
|
| 144 |
$this->nom_fichier = $ligne->pd_lien;
|
144 |
$this->nom_fichier = $ligne->pd_lien;
|
| 145 |
$this->_id_projet = $ligne->pd_ce_projet;
|
145 |
$this->_id_projet = $ligne->pd_ce_projet;
|
| 146 |
$this->_id = $ligne->pd_id ;
|
146 |
$this->_id = $ligne->pd_id ;
|
| 147 |
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
|
147 |
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
|
| 148 |
|
148 |
|
| 149 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
149 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
| 150 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
150 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
| 151 |
$this->_nom_long = $ligne->pd_nom ;
|
151 |
$this->_nom_long = $ligne->pd_nom ;
|
| 152 |
$this->_visibilite = $ligne->pd_visibilite ;
|
152 |
$this->_visibilite = $ligne->pd_visibilite ;
|
| 153 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
153 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
| 154 |
$this->_description = $ligne->pd_description ;
|
154 |
$this->_description = $ligne->pd_description ;
|
| 155 |
$this->_pd_lien = $ligne->pd_lien;
|
155 |
$this->_pd_lien = $ligne->pd_lien;
|
| 156 |
|
156 |
|
| 157 |
if ($this->_isRacine($ligne->pd_pere)) {
|
157 |
if ($this->_isRacine($ligne->pd_pere)) {
|
| 158 |
$this->_id_pere = 0 ;
|
158 |
$this->_id_pere = 0 ;
|
| 159 |
} else {
|
159 |
} else {
|
| 160 |
$this->_id_pere = $ligne->pd_pere ;
|
160 |
$this->_id_pere = $ligne->pd_pere ;
|
| 161 |
}
|
161 |
}
|
| 162 |
}
|
162 |
}
|
| 163 |
}
|
163 |
}
|
| 164 |
|
164 |
|
| 165 |
} // end of member function document
|
165 |
} // end of member function document
|
| Line 166... |
Line 166... |
| 166 |
|
166 |
|
| 167 |
/**
|
167 |
/**
|
| 168 |
*
|
168 |
*
|
| 169 |
*
|
169 |
*
|
| 170 |
* @param int id_document L'identifiant du document dans la base.
|
170 |
* @param int id_document L'identifiant du document dans la base.
|
| 171 |
* @param int objetDB Un objet PEAR:DB
|
171 |
* @param int objetDB Un objet PEAR:DB
|
| 172 |
* @return document
|
172 |
* @return document
|
| 173 |
* @access public
|
173 |
* @access public
|
| 174 |
*/
|
174 |
*/
|
| 175 |
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
|
175 |
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
|
| 176 |
{
|
176 |
{
|
| 177 |
|
177 |
|
| 178 |
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
|
178 |
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
|
| 179 |
|
179 |
|
| Line 180... |
Line 180... |
| 180 |
} // end of member function __construct
|
180 |
} // end of member function __construct
|
| 181 |
|
181 |
|
| Line 309... |
Line 309... |
| 309 |
$chemin_repertoire_entre_racine_et_fichier = '';
|
309 |
$chemin_repertoire_entre_racine_et_fichier = '';
|
| Line 310... |
Line 310... |
| 310 |
|
310 |
|
| 311 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
311 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
| 312 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
312 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
| 313 |
// l arborescence des repertoires
|
313 |
// l arborescence des repertoires
|
| 314 |
|
314 |
|
| 315 |
$tableau_navigation = $this->getPath($this->_id) ;
|
315 |
$tableau_navigation = $this->getPath($this->_id) ;
|
| 316 |
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
|
316 |
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
|
| 317 |
for ($i = 0; $i < count ($tableau_navigation); $i++) {
|
317 |
for ($i = 0; $i < count ($tableau_navigation); $i++) {
|
| 318 |
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
|
318 |
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
|
| 319 |
}
|
319 |
}
|
| 320 |
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
|
320 |
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
|
| Line 321... |
Line 321... |
| 321 |
}
|
321 |
}
|
| 322 |
|
322 |
|
| 323 |
|
323 |
|
| Line 329... |
Line 329... |
| 329 |
*
|
329 |
*
|
| 330 |
* @param int id_repertoire L'identifiant d'un répertoire.
|
330 |
* @param int id_repertoire L'identifiant d'un répertoire.
|
| 331 |
* @return Array
|
331 |
* @return Array
|
| 332 |
* @access public
|
332 |
* @access public
|
| 333 |
*/
|
333 |
*/
|
| 334 |
|
334 |
|
| 335 |
function getCheminIdRepertoire( $id_doc, &$objetDB )
|
335 |
function getCheminIdRepertoire( $id_doc, &$objetDB )
|
| 336 |
{
|
336 |
{
|
| 337 |
if ($id_doc == "") $id_doc = 0;
|
337 |
if ($id_doc == "") $id_doc = 0;
|
| 338 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
338 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
| 339 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
339 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
| Line 351... |
Line 351... |
| 351 |
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
|
351 |
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
|
| 352 |
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
|
352 |
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
|
| 353 |
}
|
353 |
}
|
| 354 |
return ($chemin_rep_id_nom);
|
354 |
return ($chemin_rep_id_nom);
|
| 355 |
}
|
355 |
}
|
| - |
|
356 |
|
| 356 |
function getPath( $id_doc)
|
357 |
function getPath( $id_doc)
|
| 357 |
{
|
358 |
{
|
| 358 |
if ($id_doc == "") $id_doc = 0;
|
359 |
if ($id_doc == "") $id_doc = 0;
|
| 359 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
360 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
| 360 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
361 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
| 361 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
362 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
| - |
|
363 |
|
| 362 |
if (DB::isError($resultat)) {
|
364 |
if (DB::isError($resultat)) {
|
| 363 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
365 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 364 |
}
|
366 |
}
|
| 365 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
367 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| - |
|
368 |
|
| 366 |
$chemin_rep_id_nom = array() ;
|
369 |
$chemin_rep_id_nom = array() ;
|
| 367 |
if ($resultat->numRows()>0) {
|
370 |
if ($resultat->numRows()>0 && $ligne->pd_pere != 0 && $ligne->pd_pere != $ligne->pd_id) {
|
| - |
|
371 |
|
| 368 |
if ($ligne->pd_pere == 0) {
|
372 |
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
|
| 369 |
return array();
|
- |
|
| 370 |
}
|
373 |
|
| 371 |
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
|
374 |
// Récursion sur le répertoires ou fichiers fils
|
| 372 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
|
375 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
|
| 373 |
}
|
376 |
}
|
| - |
|
377 |
|
| 374 |
return $chemin_rep_id_nom;
|
378 |
return $chemin_rep_id_nom;
|
| 375 |
}
|
379 |
}
|
| - |
|
380 |
|
| 376 |
/**
|
381 |
/**
|
| 377 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
382 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
| 378 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
383 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
| 379 |
* En prenant comme racine le répertoire du projet, exclu.
|
384 |
* En prenant comme racine le répertoire du projet, exclu.
|
| 380 |
* @return string Le chemin
|
385 |
* @return string Le chemin
|
| Line 382... |
Line 387... |
| 382 |
|
387 |
|
| Line 383... |
Line 388... |
| 383 |
function calculeCheminUploaded ($radical) {
|
388 |
function calculeCheminUploaded ($radical) {
|
| 384 |
|
389 |
|
| 385 |
if (isset($_FILES['fichier']['name'])) {
|
390 |
if (isset($_FILES['fichier']['name'])) {
|
| Line 386... |
Line 391... |
| 386 |
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
|
391 |
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
|
| 387 |
}
|
392 |
}
|
| 388 |
|
393 |
|
| 389 |
if ($this->_id_pere != '') {
|
394 |
if ($this->_id_pere != '') {
|
| 390 |
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
|
395 |
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
|
| 391 |
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
|
396 |
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
|
| 392 |
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
|
397 |
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
|
| 393 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
398 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
| 394 |
$doc_pere = new document ($this->_id_pere, $GLOBALS['projet_db']);
|
399 |
$doc_pere = new document ($this->_id_pere, $GLOBALS['projet_db']);
|
| 395 |
return $doc_pere->getChemin();
|
400 |
return $doc_pere->getChemin();
|
| 396 |
$tableau_navigation = $this->getPath($this->_id_pere) ;
|
401 |
$tableau_navigation = $this->getPath($this->_id_pere) ;
|
| 397 |
|
402 |
|
| 398 |
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
403 |
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
| 399 |
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
|
404 |
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
|
| Line 412... |
Line 417... |
| 412 |
* @access public
|
417 |
* @access public
|
| 413 |
* @return void
|
418 |
* @return void
|
| 414 |
*/
|
419 |
*/
|
| Line 415... |
Line 420... |
| 415 |
|
420 |
|
| 416 |
function enregistrerSQL ($valeur, $chemin) {
|
421 |
function enregistrerSQL ($valeur, $chemin) {
|
| 417 |
|
422 |
|
| 418 |
// On teste si on a affaire à un répertoire ou un fichier
|
423 |
// On teste si on a affaire à un répertoire ou un fichier
|
| 419 |
if (isset ($_FILES['fichier']['name'])) {
|
424 |
if (isset ($_FILES['fichier']['name'])) {
|
| 420 |
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
|
425 |
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
|
| 421 |
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
|
426 |
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
|
| 422 |
|
427 |
|
| 423 |
// On prend le dernier élément du tableau, si c'est un tableau
|
428 |
// On prend le dernier élément du tableau, si c'est un tableau
|
| 424 |
if (is_array($tableau_nom)) {
|
429 |
if (is_array($tableau_nom)) {
|
| 425 |
$extension = array_pop($tableau_nom) ;
|
430 |
$extension = array_pop($tableau_nom) ;
|
| 426 |
$type = type_fichier_mime::factory($extension) ;
|
431 |
$type = type_fichier_mime::factory($extension) ;
|
| 427 |
$id_extension = $type->getIdType() ;
|
432 |
$id_extension = $type->getIdType() ;
|
| Line 491... |
Line 496... |
| 491 |
/** Supprime les donnéexs du document dans la table projet_documents
|
496 |
/** Supprime les donnéexs du document dans la table projet_documents
|
| 492 |
*
|
497 |
*
|
| 493 |
*
|
498 |
*
|
| 494 |
* @return true en cas de succès
|
499 |
* @return true en cas de succès
|
| 495 |
*/
|
500 |
*/
|
| 496 |
|
501 |
|
| 497 |
function suppressionSQL () {
|
502 |
function suppressionSQL () {
|
| 498 |
$requete = 'delete from projet_documents where pd_id='.$this->_id ;
|
503 |
$requete = 'delete from projet_documents where pd_id='.$this->_id ;
|
| 499 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
504 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
| 500 |
if ($GLOBALS['projet_db']->affectedRows()) return true ;
|
505 |
if ($GLOBALS['projet_db']->affectedRows()) return true ;
|
| 501 |
return false ;
|
506 |
return false ;
|
| 502 |
}
|
507 |
}
|
| 503 |
|
508 |
|
| 504 |
/**
|
509 |
/**
|
| 505 |
* Déplace un document au sein d'un même projet
|
510 |
* Déplace un document au sein d'un même projet
|
| 506 |
*
|
511 |
*
|
| 507 |
* @param int repertoire_destination L'identifiant du répertoire destination.
|
512 |
* @param int repertoire_destination L'identifiant du répertoire destination.
|
| 508 |
* @return bool
|
513 |
* @return bool
|
| Line 515... |
Line 520... |
| 515 |
if ($repertoire_destination != 0) {
|
520 |
if ($repertoire_destination != 0) {
|
| 516 |
$repertoire_cible = new document ($repertoire_destination, $GLOBALS['projet_db']) ;
|
521 |
$repertoire_cible = new document ($repertoire_destination, $GLOBALS['projet_db']) ;
|
| 517 |
$chemin_rep_cible = $repertoire_cible->getChemin();
|
522 |
$chemin_rep_cible = $repertoire_cible->getChemin();
|
| 518 |
} else {
|
523 |
} else {
|
| 519 |
// Si le repertoire destination est la racine cad id =0
|
524 |
// Si le repertoire destination est la racine cad id =0
|
| 520 |
// on cree un document qui aura pour chemin le repertoire du projet
|
525 |
// on cree un document qui aura pour chemin le repertoire du projet
|
| 521 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
526 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
| 522 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
527 |
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
|
| 523 |
$chemin_rep_cible = $projet->getNomRepertoire().'/';
|
528 |
$chemin_rep_cible = $projet->getNomRepertoire().'/';
|
| 524 |
}
|
529 |
}
|
| 525 |
|
530 |
|
| 526 |
$nom_fichier = $this->_pd_lien ;
|
531 |
$nom_fichier = $this->_pd_lien ;
|
| 527 |
$requete = 'update projet_documents set pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
|
532 |
$requete = 'update projet_documents set pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
|
| 528 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
533 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
| 529 |
if (DB::isError($resultat)) {
|
534 |
if (DB::isError($resultat)) {
|
| 530 |
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
535 |
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 531 |
return false ;
|
536 |
return false ;
|
| 532 |
}
|
537 |
}
|
| 533 |
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
|
538 |
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
|
| 534 |
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
|
539 |
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
|
| 535 |
|
540 |
|
| 536 |
} // end of member function deplace
|
541 |
} // end of member function deplace
|
| Line 537... |
Line 542... |
| 537 |
|
542 |
|
| 538 |
|
543 |
|
| Line 599... |
Line 604... |
| 599 |
$resultat = $objetDB->query ($requete) ;
|
604 |
$resultat = $objetDB->query ($requete) ;
|
| 600 |
if (DB::isError ($resultat)) {
|
605 |
if (DB::isError ($resultat)) {
|
| 601 |
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
606 |
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
| 602 |
}
|
607 |
}
|
| 603 |
$tableau_document = array() ;
|
608 |
$tableau_document = array() ;
|
| 604 |
|
609 |
|
| 605 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
610 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
|
| 606 |
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
|
611 |
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
|
| 607 |
}
|
612 |
}
|
| 608 |
return $tableau_document ;
|
613 |
return $tableau_document ;
|
| 609 |
} // end of member function getDocumentsRecents
|
614 |
} // end of member function getDocumentsRecents
|
| Line 620... |
Line 625... |
| 620 |
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$id_projet;
|
625 |
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$id_projet;
|
| 621 |
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
|
626 |
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
|
| 622 |
if (DB::isError ($resultat)) {
|
627 |
if (DB::isError ($resultat)) {
|
| 623 |
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
628 |
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
|
| 624 |
}
|
629 |
}
|
| 625 |
|
630 |
|
| 626 |
return $resultat;
|
631 |
return $resultat;
|
| 627 |
}
|
632 |
}
|
| 628 |
/**
|
633 |
/**
|
| 629 |
* Renvoie la taille du document formatee avec une unite adapte
|
634 |
* Renvoie la taille du document formatee avec une unite adapte
|
| 630 |
*
|
635 |
*
|
| Line 640... |
Line 645... |
| 640 |
$diviseur = 1000 ;
|
645 |
$diviseur = 1000 ;
|
| 641 |
$unite = 'Ko';
|
646 |
$unite = 'Ko';
|
| 642 |
}
|
647 |
}
|
| 643 |
return round ($taille / $diviseur, $precision).' '.$unite;
|
648 |
return round ($taille / $diviseur, $precision).' '.$unite;
|
| 644 |
}
|
649 |
}
|
| 645 |
|
650 |
|
| 646 |
/**
|
651 |
/**
|
| 647 |
* Renvoie une liste de document, enfant du document courant
|
652 |
* Renvoie une liste de document, enfant du document courant
|
| 648 |
* qui doit etre un repertoire bien sur
|
653 |
* qui doit etre un repertoire bien sur
|
| 649 |
*
|
654 |
*
|
| 650 |
* @return mixed un tableau de document
|
655 |
* @return mixed un tableau de document
|
| 651 |
* @access public
|
656 |
* @access public
|
| 652 |
*/
|
657 |
*/
|
| 653 |
function getDocumentsEnfant() {
|
658 |
function getDocumentsEnfant() {
|
| 654 |
|
659 |
|
| 655 |
}
|
660 |
}
|
| 656 |
|
661 |
|
| 657 |
} // end of document
|
662 |
} // end of document
|
| Line 658... |
Line 663... |
| 658 |
|
663 |
|