| 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.3 2005-09-27 16:38:11 alexandre_tb Exp $
|
22 |
// CVS : $Id: document.class.php,v 1.4 2005-09-28 16:29:39 ddelon 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.3 $
|
34 |
*@version $Revision: 1.4 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| Line 133... |
Line 133... |
| 133 |
$resultat = $this->_db->query ($requete) ;
|
133 |
$resultat = $this->_db->query ($requete) ;
|
| 134 |
if (DB::isError($resultat)) {
|
134 |
if (DB::isError($resultat)) {
|
| 135 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
135 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 136 |
}
|
136 |
}
|
| 137 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
137 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| 138 |
|
- |
|
| - |
|
138 |
if ($resultat->numRows()>0) {
|
| 139 |
fichier::fichier($chemin.$ligne->pd_lien, $this->_db) ;
|
139 |
fichier::fichier($chemin.$ligne->pd_lien, $this->_db) ;
|
| 140 |
$this->_id = $ligne->pd_id ;
|
140 |
$this->_id = $ligne->pd_id ;
|
| 141 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
141 |
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
|
| 142 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
142 |
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
|
| 143 |
$this->_nom_long = $ligne->pd_nom ;
|
143 |
$this->_nom_long = $ligne->pd_nom ;
|
| 144 |
$this->_visibilite = $ligne->pd_visibilite ;
|
144 |
$this->_visibilite = $ligne->pd_visibilite ;
|
| 145 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
145 |
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
|
| 146 |
$this->_description = $ligne->pd_description ;
|
146 |
$this->_description = $ligne->pd_description ;
|
| 147 |
$this->_pd_lien = $ligne->pd_lien;
|
147 |
$this->_pd_lien = $ligne->pd_lien;
|
| 148 |
if ($this->_isRacine($ligne->pd_pere)) {
|
148 |
if ($this->_isRacine($ligne->pd_pere)) {
|
| 149 |
$this->_id_pere = 0 ;
|
149 |
$this->_id_pere = 0 ;
|
| 150 |
} else {
|
150 |
} else {
|
| 151 |
$this->_id_pere = $ligne->pd_pere ;
|
151 |
$this->_id_pere = $ligne->pd_pere ;
|
| 152 |
}
|
152 |
}
|
| - |
|
153 |
}
|
| 153 |
}
|
154 |
}
|
| Line 154... |
Line 155... |
| 154 |
|
155 |
|
| Line 155... |
Line 156... |
| 155 |
} // end of member function document
|
156 |
} // end of member function document
|
| Line 160... |
Line 161... |
| 160 |
* @param int id_document L'identifiant du document dans la base.
|
161 |
* @param int id_document L'identifiant du document dans la base.
|
| 161 |
* @param int objetDB Un objet PEAR:DB
|
162 |
* @param int objetDB Un objet PEAR:DB
|
| 162 |
* @return document
|
163 |
* @return document
|
| 163 |
* @access public
|
164 |
* @access public
|
| 164 |
*/
|
165 |
*/
|
| 165 |
function __construct( $id_document, &$objetDB )
|
166 |
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
|
| 166 |
{
|
167 |
{
|
| - |
|
168 |
|
| - |
|
169 |
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
|
| Line 167... |
Line 170... |
| 167 |
|
170 |
|
| Line 168... |
Line 171... |
| 168 |
} // end of member function __construct
|
171 |
} // end of member function __construct
|
| Line 267... |
Line 270... |
| 267 |
* @return bool
|
270 |
* @return bool
|
| 268 |
* @access public
|
271 |
* @access public
|
| 269 |
*/
|
272 |
*/
|
| 270 |
function _isRacine( $id_document )
|
273 |
function _isRacine( $id_document )
|
| 271 |
{
|
274 |
{
|
| - |
|
275 |
if ($id_document) {
|
| 272 |
$requete = "select pd_pere from projet_documents where pd_id=$id_document" ;
|
276 |
$requete = "select pd_pere from projet_documents where pd_id=".$id_document ;
|
| 273 |
$resultat = $this->_db->query ($requete) ;
|
277 |
$resultat = $this->_db->query ($requete) ;
|
| 274 |
if (DB::isError($resultat)) {
|
278 |
if (DB::isError($resultat)) {
|
| 275 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
279 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 276 |
}
|
280 |
}
|
| 277 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
|
281 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
|
| - |
|
282 |
if ($resultat->numRows() >0) {
|
| 278 |
if ($ligne->pd_pere == null){
|
283 |
if ($ligne->pd_pere == null){
|
| 279 |
return true ;
|
284 |
return true ;
|
| - |
|
285 |
}
|
| 280 |
}
|
286 |
}
|
| - |
|
287 |
}
|
| 281 |
return false ;
|
288 |
return false ;
|
| 282 |
} // end of member function _isRacine
|
289 |
} // end of member function _isRacine
|
| Line 283... |
Line 290... |
| 283 |
|
290 |
|
| 284 |
/**
|
291 |
/**
|
| Line 317... |
Line 324... |
| 317 |
if (DB::isError($resultat)) {
|
324 |
if (DB::isError($resultat)) {
|
| 318 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
325 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
| 319 |
}
|
326 |
}
|
| 320 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
327 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| 321 |
$chemin_rep_id_nom = array() ;
|
328 |
$chemin_rep_id_nom = array() ;
|
| - |
|
329 |
if ($resultat->numRows()>0) {
|
| 322 |
if ($ligne->pd_pere == 0) {
|
330 |
if ($ligne->pd_pere == 0) {
|
| 323 |
$tab = array ($ligne->pd_id, $ligne->pd_nom) ;
|
331 |
$tab = array ($ligne->pd_id, $ligne->pd_nom) ;
|
| 324 |
return $tab ;
|
332 |
return $tab ;
|
| - |
|
333 |
}
|
| 325 |
} else {
|
334 |
else {
|
| 326 |
$requete_pere = "select pd_id, pd_nom from projet_documents where pd_id=$ligne->pd_pere" ;
|
335 |
$requete_pere = "select pd_id, pd_nom from projet_documents where pd_id=$ligne->pd_pere" ;
|
| 327 |
$resultat_pere = $objetDB->query ($requete_pere) ;
|
336 |
$resultat_pere = $objetDB->query ($requete_pere) ;
|
| 328 |
if (DB::isError($resultat_pere)) {
|
337 |
if (DB::isError($resultat_pere)) {
|
| 329 |
die ("Echec de la requete<br />".$resultat_pere->getMessage()."<br />".$resultat_pere->getDebugInfo()) ;
|
338 |
die ("Echec de la requete<br />".$resultat_pere->getMessage()."<br />".$resultat_pere->getDebugInfo()) ;
|
| 330 |
}
|
339 |
}
|
| 331 |
$ligne_pere = $resultat_pere->fetchRow (DB_FETCHMODE_OBJECT) ;
|
340 |
$ligne_pere = $resultat_pere->fetchRow (DB_FETCHMODE_OBJECT) ;
|
| 332 |
array_push ($chemin_rep_id_nom, $ligne->pd_id,$ligne->pd_nom) ;
|
341 |
array_push ($chemin_rep_id_nom, $ligne->pd_id,$ligne->pd_nom) ;
|
| 333 |
$tab = document::getCheminIdRepertoire($ligne_pere->pd_id, $objetDB) ;
|
342 |
$tab = document::getCheminIdRepertoire($ligne_pere->pd_id, $objetDB) ;
|
| 334 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, $tab) ;
|
343 |
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, $tab) ;
|
| - |
|
344 |
}
|
| 335 |
}
|
345 |
}
|
| 336 |
$tabl_resultat = array() ;
|
346 |
$tabl_resultat = array() ;
|
| 337 |
for ($i = 0; $i < count ($chemin_rep_id_nom); $i++) {
|
347 |
for ($i = 0; $i < count ($chemin_rep_id_nom); $i++) {
|
| 338 |
$val1 = array_pop ($chemin_rep_id_nom) ;
|
348 |
$val1 = array_pop ($chemin_rep_id_nom) ;
|
| 339 |
$val2 = array_pop ($chemin_rep_id_nom) ;
|
349 |
$val2 = array_pop ($chemin_rep_id_nom) ;
|