| 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.7 2007-04-19 09:22:29 alexandre_tb Exp $
|
22 |
// CVS : $Id: document.class.php,v 1.7.2.1 2007-05-11 13:44:22 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.7 $
|
34 |
*@version $Revision: 1.7.2.1 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 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 |
|
| - |
|
120 |
var $nom_fichier ;
|
| 119 |
/**
|
121 |
/**
|
| 120 |
*
|
122 |
*
|
| 121 |
*
|
123 |
*
|
| 122 |
* @param int id_document L'identifiant du document dans la base.
|
124 |
* @param int id_document L'identifiant du document dans la base.
|
| 123 |
* @param int objetDB un objet PEAR:DB
|
125 |
* @param int objetDB un objet PEAR:DB
|
| Line 126... |
Line 128... |
| 126 |
*/
|
128 |
*/
|
| 127 |
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
|
129 |
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
|
| 128 |
{
|
130 |
{
|
| 129 |
$this->_db = $objetDB ;
|
131 |
$this->_db = $objetDB ;
|
| 130 |
$this->_chemin_icone = $chemin_icones ;
|
132 |
$this->_chemin_icone = $chemin_icones ;
|
| - |
|
133 |
|
| 131 |
if ($id_document != "") {
|
134 |
if ($id_document != "") {
|
| 132 |
$requete = "select * from projet_documents where pd_id=".$id_document ;
|
135 |
$requete = "select * from projet_documents where pd_id=".$id_document ;
|
| 133 |
$resultat = $this->_db->query ($requete) ;
|
136 |
$resultat = $this->_db->query ($requete) ;
|
| 134 |
if (DB::isError($resultat)) {
|
137 |
if (DB::isError($resultat)) {
|
| 135 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
138 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 136 |
}
|
139 |
}
|
| 137 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
140 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| 138 |
if ($resultat->numRows()>0) {
|
141 |
if ($resultat->numRows()>0) {
|
| 139 |
fichier::fichier($chemin.$ligne->pd_lien, $this->_db) ;
|
142 |
$this->nom_fichier = $ligne->pd_lien;
|
| - |
|
143 |
$this->_id_projet = $ligne->pd_ce_projet;
|
| 140 |
$this->_id = $ligne->pd_id ;
|
144 |
$this->_id = $ligne->pd_id ;
|
| - |
|
145 |
fichier::fichier($chemin.$this->getChemin(), $this->_db) ;
|
| - |
|
146 |
|
| 141 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
147 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
| 142 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
148 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
| 143 |
$this->_nom_long = $ligne->pd_nom ;
|
149 |
$this->_nom_long = $ligne->pd_nom ;
|
| 144 |
$this->_visibilite = $ligne->pd_visibilite ;
|
150 |
$this->_visibilite = $ligne->pd_visibilite ;
|
| 145 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
151 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
| 146 |
$this->_description = $ligne->pd_description ;
|
152 |
$this->_description = $ligne->pd_description ;
|
| 147 |
$this->_pd_lien = $ligne->pd_lien;
|
153 |
$this->_pd_lien = $ligne->pd_lien;
|
| - |
|
154 |
|
| 148 |
if ($this->_isRacine($ligne->pd_pere)) {
|
155 |
if ($this->_isRacine($ligne->pd_pere)) {
|
| 149 |
$this->_id_pere = 0 ;
|
156 |
$this->_id_pere = 0 ;
|
| 150 |
} else {
|
157 |
} else {
|
| 151 |
$this->_id_pere = $ligne->pd_pere ;
|
158 |
$this->_id_pere = $ligne->pd_pere ;
|
| 152 |
}
|
159 |
}
|
| Line 235... |
Line 242... |
| 235 |
function getCheminIcone()
|
242 |
function getCheminIcone()
|
| 236 |
{
|
243 |
{
|
| 237 |
if ($this->isRepertoire()) {
|
244 |
if ($this->isRepertoire()) {
|
| 238 |
return $this->_chemin_icone."repertoire.gif" ;
|
245 |
return $this->_chemin_icone."repertoire.gif" ;
|
| 239 |
} else {
|
246 |
} else {
|
| 240 |
return $this->_type_mime->getCheminIcone() ;
|
247 |
if (is_object ($this->_type_mime)) return $this->_type_mime->getCheminIcone() ;
|
| 241 |
}
|
248 |
}
|
| 242 |
} // end of member function getCheminIcone
|
249 |
} // end of member function getCheminIcone
|
| Line 243... |
Line 250... |
| 243 |
|
250 |
|
| 244 |
/**
|
251 |
/**
|
| Line 293... |
Line 300... |
| 293 |
* mère, cette méthode renvoie une URL projet et non pas un fichier.
|
300 |
* mère, cette méthode renvoie une URL projet et non pas un fichier.
|
| 294 |
*
|
301 |
*
|
| 295 |
* @return string
|
302 |
* @return string
|
| 296 |
* @access public
|
303 |
* @access public
|
| 297 |
*/
|
304 |
*/
|
| 298 |
function getChemin( )
|
305 |
function getChemin($prefixe = '')
|
| 299 |
{
|
306 |
{
|
| 300 |
if ($this->isRepertoire()) {
|
307 |
$chemin_repertoire_entre_racine_et_fichier = '';
|
| - |
|
308 |
|
| - |
|
309 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
| 301 |
return $this->_id ;
|
310 |
$projet = new projet ($this->_db, $this->_id_projet);
|
| 302 |
} else {
|
311 |
// l arborescence des repertoires
|
| - |
|
312 |
|
| 303 |
return $this->_chemin ;
|
313 |
$tableau_navigation = $this->getPath($this->_id) ;
|
| - |
|
314 |
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
|
| - |
|
315 |
for ($i = 0; $i < count ($tableau_navigation); $i++) {
|
| - |
|
316 |
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
|
| 304 |
}
|
317 |
}
|
| 305 |
} // end of member function getChemin
|
318 |
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
|
| - |
|
319 |
}
|
| Line 306... |
Line 320... |
| 306 |
|
320 |
|
| 307 |
|
321 |
|
| 308 |
/**
|
322 |
/**
|
| 309 |
* Renvoie pour le répertoire courant, les identifiants et les noms de tous les
|
323 |
* Renvoie pour le repertoire ou le fichier courant, les identifiants et les noms de tous les
|
| 310 |
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
|
324 |
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
|
| 311 |
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
|
325 |
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
|
| 312 |
* vaut "".
|
326 |
* vaut "".
|
| 313 |
*
|
327 |
*
|
| 314 |
* @param int id_repertoire L'identifiant d'un répertoire.
|
328 |
* @param int id_repertoire L'identifiant d'un répertoire.
|
| 315 |
* @return Array
|
329 |
* @return Array
|
| - |
|
330 |
* @access public
|
| 316 |
* @access public
|
331 |
*/
|
| 317 |
*/
|
332 |
|
| 318 |
function getCheminIdRepertoire( $id_repertoire, &$objetDB )
|
333 |
function getCheminIdRepertoire( $id_doc, &$objetDB )
|
| 319 |
{
|
334 |
{
|
| 320 |
if ($id_repertoire == "") $id_repertoire = 0;
|
335 |
if ($id_doc == "") $id_doc = 0;
|
| 321 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
336 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
| 322 |
$requete = "select pd_pere, pd_nom, pd_id from projet_documents where pd_id=$id_repertoire" ;
|
337 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
| 323 |
$resultat = $objetDB->query ($requete) ;
|
338 |
$resultat = $objetDB->query ($requete) ;
|
| 324 |
if (DB::isError($resultat)) {
|
339 |
if (DB::isError($resultat)) {
|
| 325 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
340 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 326 |
}
|
341 |
}
|
| 327 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
342 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| 328 |
$chemin_rep_id_nom = array() ;
|
343 |
$chemin_rep_id_nom = array() ;
|
| 329 |
if ($resultat->numRows()>0) {
|
344 |
if ($resultat->numRows()>0) {
|
| 330 |
if ($ligne->pd_pere == 0) {
|
- |
|
| 331 |
$tab = array ($ligne->pd_id, $ligne->pd_nom) ;
|
- |
|
| 332 |
return $tab ;
|
- |
|
| 333 |
}
|
- |
|
| 334 |
else {
|
- |
|
| 335 |
$requete_pere = "select pd_id, pd_nom from projet_documents where pd_id=$ligne->pd_pere" ;
|
- |
|
| 336 |
$resultat_pere = $objetDB->query ($requete_pere) ;
|
- |
|
| 337 |
if (DB::isError($resultat_pere)) {
|
- |
|
| 338 |
die ("Echec de la requete<br />".$resultat_pere->getMessage()."<br />".$resultat_pere->getDebugInfo()) ;
|
- |
|
| 339 |
}
|
- |
|
| 340 |
$ligne_pere = $resultat_pere->fetchRow (DB_FETCHMODE_OBJECT) ;
|
- |
|
| 341 |
array_push ($chemin_rep_id_nom, $ligne->pd_id,$ligne->pd_nom) ;
|
- |
|
| 342 |
$tab = document::getCheminIdRepertoire($ligne_pere->pd_id, $objetDB) ;
|
345 |
if ($ligne->pd_pere == 0) {
|
| - |
|
346 |
return ; //array ($ligne->pd_pere);
|
| - |
|
347 |
}
|
| - |
|
348 |
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
|
| 343 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, $tab) ;
|
349 |
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
|
| 344 |
}
|
350 |
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
|
| - |
|
351 |
}
|
| - |
|
352 |
return array_reverse($chemin_rep_id_nom);
|
| - |
|
353 |
}
|
| 345 |
}
|
354 |
function getPath( $id_doc)
|
| 346 |
$tabl_resultat = array() ;
|
355 |
{
|
| - |
|
356 |
if ($id_doc == "") $id_doc = 0;
|
| 347 |
for ($i = 0; $i < count ($chemin_rep_id_nom); $i++) {
|
357 |
// on commence par rechercher le répertoire père, dans la base de donnée
|
| 348 |
$val1 = array_pop ($chemin_rep_id_nom) ;
|
358 |
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
|
| - |
|
359 |
$resultat = $GLOBALS['projet_db']->query ($requete) ;
|
| 349 |
$val2 = array_pop ($chemin_rep_id_nom) ;
|
360 |
if (DB::isError($resultat)) {
|
| - |
|
361 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| - |
|
362 |
}
|
| - |
|
363 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| - |
|
364 |
$chemin_rep_id_nom = array() ;
|
| 350 |
array_push ($tabl_resultat, $val2, $val1) ;
|
365 |
if ($resultat->numRows()>0) {
|
| - |
|
366 |
if ($ligne->pd_pere == 0) {
|
| - |
|
367 |
return;
|
| - |
|
368 |
}
|
| - |
|
369 |
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
|
| 351 |
}
|
370 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
|
| 352 |
return $tabl_resultat ;
|
371 |
}
|
| 353 |
} // end of member function getCheminIdRepertoire
|
372 |
return $chemin_rep_id_nom;
|
| 354 |
|
373 |
}
|
| 355 |
/**
|
374 |
/**
|
| 356 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
375 |
* Calcule le chemin vers le fichier ou le répertoire uploadé
|
| 357 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
376 |
* renvoie un chaine de la forme dir1/dir2/fichier.ext
|
| 358 |
* En prenant comme racine le répertoire du projet, exclu.
|
377 |
* En prenant comme racine le répertoire du projet, exclu.
|
| Line 359... |
Line 378... |
| 359 |
* @return string Le chemin
|
378 |
* @return string Le chemin
|
| 360 |
*/
|
- |
|
| 361 |
|
- |
|
| 362 |
function calculeCheminUploaded ($radical) {
|
- |
|
| 363 |
// On recherche le chemin vers le fichier, en fonction du répertoire
|
- |
|
| 364 |
// ici on renomme le fichier à partir du dernier ID de la table gen_voiraussi
|
- |
|
| 365 |
$requete_document = "select pd_id from projet_documents order by pd_id desc limit 1,1" ;
|
- |
|
| 366 |
$resultat_document = $this->_db->query($requete_document) ;
|
379 |
*/
|
| - |
|
380 |
|
| 367 |
$ligne_document = $resultat_document->fetchRow(DB_FETCHMODE_OBJECT) ;
|
381 |
function calculeCheminUploaded ($radical) {
|
| - |
|
382 |
|
| 368 |
$nouveau_nom = $ligne_document->pd_id + 1 ;
|
383 |
if (isset($_FILES['fichier']['name'])) {
|
| 369 |
|
- |
|
| 370 |
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
|
384 |
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
|
| 371 |
|
385 |
}
|
| 372 |
$nouveau_nom = $radical."_".$nouveau_nom.".".$extension ;
|
386 |
|
| 373 |
if ($this->_id_pere != '') {
|
387 |
if ($this->_id_pere != '') {
|
| 374 |
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
|
388 |
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
|
| - |
|
389 |
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
|
| - |
|
390 |
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
|
| 375 |
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
|
391 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
| - |
|
392 |
$doc_pere = new document ($this->_id_pere, $this->_db);
|
| 376 |
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
|
393 |
return $doc_pere->getChemin();
|
| 377 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
394 |
$tableau_navigation = $this->getPath($this->_id_pere) ;
|
| 378 |
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
|
395 |
|
| 379 |
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
396 |
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
| 380 |
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree.$nouveau_nom ;
|
397 |
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
|
| 381 |
} else {
|
398 |
} else {
|
| 382 |
// Si l'on est à la racine du projet, le chemin est le nom du fichier
|
399 |
// Si l'on est à la racine du projet, le chemin vide
|
| 383 |
return $nouveau_nom ;
|
400 |
return $radical ;
|
| Line 384... |
Line 401... |
| 384 |
}
|
401 |
}
|
| Line 421... |
Line 438... |
| 421 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
438 |
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
|
| 422 |
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
|
439 |
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
|
| 423 |
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
440 |
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
|
| 424 |
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
|
441 |
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
|
| 425 |
}
|
442 |
}
|
| - |
|
443 |
//$pd_lien .= SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
|
| 426 |
$pd_lien .= SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
|
444 |
$pd_lien = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
|
| 427 |
}
|
445 |
}
|
| 428 |
$id = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
|
446 |
$id = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
|
| Line 429... |
Line 447... |
| 429 |
|
447 |
|
| 430 |
$requete = "insert into projet_documents set pd_id=".$id ;
|
448 |
$requete = "insert into projet_documents set pd_id=".$id ;
|
| Line 439... |
Line 457... |
| 439 |
}
|
457 |
}
|
| 440 |
$this->_id = $id ;
|
458 |
$this->_id = $id ;
|
| 441 |
return $pd_lien;
|
459 |
return $pd_lien;
|
| 442 |
}
|
460 |
}
|
| Line -... |
Line 461... |
| - |
|
461 |
|
| - |
|
462 |
function genereNouveauNom ($radical, $ancien_nom, $id) {
|
| - |
|
463 |
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $ancien_nom) ;
|
| - |
|
464 |
$nouveau_nom = $radical."_".$id.".".$extension ;
|
| - |
|
465 |
return $nouveau_nom;
|
| Line 443... |
Line 466... |
| 443 |
|
466 |
}
|
| 444 |
|
467 |
|
| 445 |
/**
|
468 |
/**
|
| 446 |
* Met à jour une ligne dans la table projet_document
|
469 |
* Met à jour une ligne dans la table projet_document
|
| Line 483... |
Line 506... |
| 483 |
* @return bool
|
506 |
* @return bool
|
| 484 |
* @access public
|
507 |
* @access public
|
| 485 |
*/
|
508 |
*/
|
| 486 |
function deplace( $repertoire_destination, $repertoire_projet )
|
509 |
function deplace( $repertoire_destination, $repertoire_projet )
|
| 487 |
{
|
510 |
{
|
| - |
|
511 |
|
| 488 |
// On récupère les informations du répertoire cible
|
512 |
// On récupère les informations du répertoire cible
|
| 489 |
if ($repertoire_destination != 0) {
|
513 |
if ($repertoire_destination != 0) {
|
| 490 |
$repertoire_cible = new document ($repertoire_destination, $this->_db) ;
|
514 |
$repertoire_cible = new document ($repertoire_destination, $this->_db) ;
|
| 491 |
$rep = $repertoire_cible->_pd_lien ;
|
515 |
$chemin_rep_cible = $repertoire_cible->getChemin();
|
| 492 |
} else {
|
516 |
} else {
|
| - |
|
517 |
// Si le repertoire destination est la racine cad id =0
|
| - |
|
518 |
// on cree un document qui aura pour chemin le repertoire du projet
|
| - |
|
519 |
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
|
| - |
|
520 |
$projet = new projet ($this->_db, $this->_id_projet);
|
| 493 |
$rep = $repertoire_projet.'/' ;
|
521 |
$chemin_rep_cible = $projet->getNomRepertoire().'/';
|
| 494 |
}
|
522 |
}
|
| 495 |
|
523 |
|
| 496 |
// On récupère le nom du fichier
|
- |
|
| 497 |
$decoupe = explode ('/', $this->_pd_lien) ;
|
524 |
$nom_fichier = $this->_pd_lien ;
|
| 498 |
$nom_fichier = $decoupe[count($decoupe)-1] ;
|
- |
|
| 499 |
$requete = 'update projet_documents set pd_lien="'.$rep.$nom_fichier.'", pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
|
525 |
$requete = 'update projet_documents set pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
|
| 500 |
$resultat = $this->_db->query ($requete) ;
|
526 |
$resultat = $this->_db->query ($requete) ;
|
| 501 |
if (DB::isError($resultat)) {
|
527 |
if (DB::isError($resultat)) {
|
| 502 |
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
528 |
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 503 |
return false ;
|
529 |
return false ;
|
| 504 |
}
|
530 |
}
|
| - |
|
531 |
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
|
| 505 |
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$rep.$nom_fichier) ;
|
532 |
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
|
| Line 506... |
Line 533... |
| 506 |
|
533 |
|
| Line 507... |
Line 534... |
| 507 |
} // end of member function deplace
|
534 |
} // end of member function deplace
|
| Line 611... |
Line 638... |
| 611 |
$diviseur = 1000 ;
|
638 |
$diviseur = 1000 ;
|
| 612 |
$unite = 'Ko';
|
639 |
$unite = 'Ko';
|
| 613 |
}
|
640 |
}
|
| 614 |
return round ($taille / $diviseur, $precision).' '.$unite;
|
641 |
return round ($taille / $diviseur, $precision).' '.$unite;
|
| 615 |
}
|
642 |
}
|
| - |
|
643 |
|
| - |
|
644 |
/**
|
| - |
|
645 |
* Renvoie une liste de document, enfant du document courant
|
| - |
|
646 |
* qui doit etre un repertoire bien sur
|
| - |
|
647 |
*
|
| - |
|
648 |
* @return mixed un tableau de document
|
| - |
|
649 |
* @access public
|
| - |
|
650 |
*/
|
| - |
|
651 |
function getDocumentsEnfant() {
|
| - |
|
652 |
|
| - |
|
653 |
}
|
| Line 616... |
Line 654... |
| 616 |
|
654 |
|
| Line 617... |
Line 655... |
| 617 |
} // end of document
|
655 |
} // end of document
|