Subversion Repositories Applications.projet

Rev

Rev 157 | Rev 249 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 157 Rev 201
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.6 2007-01-04 17:03:04 alexandre_tb Exp $
22
// CVS : $Id: document.class.php,v 1.7 2007-04-19 09:22:29 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.6 $
34
*@version       $Revision: 1.7 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 363... Line 363...
363
        // On recherche le chemin vers le fichier, en fonction du répertoire
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
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" ;
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) ;
366
        $resultat_document = $this->_db->query($requete_document) ;
367
        $ligne_document = $resultat_document->fetchRow(DB_FETCHMODE_OBJECT) ;
367
        $ligne_document = $resultat_document->fetchRow(DB_FETCHMODE_OBJECT) ;
368
        $nouveau_nom = $ligne_document->pd_id+ 1 ;
368
        $nouveau_nom = $ligne_document->pd_id + 1 ;
Line 369... Line 369...
369
        
369
        
Line 370... Line 370...
370
        $extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
370
        $extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
371
        
371
        
Line 560... Line 560...
560
     * @static
560
     * @static
561
     * @access public
561
     * @access public
562
     */
562
     */
563
    function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
563
    function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
564
    {
564
    {
565
        // on recherche les documents, hors répertoire
565
        // on recherche les documents, hors repertoire
566
        $requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
566
        $requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
567
        if ($id_projet != '') $requete .= ' and pd_ce_projet='.$id_projet.' ';
567
        if ($id_projet != '') $requete .= ' and pd_ce_projet='.$id_projet.' ';
568
        if (!$visible) $requete .= ' and pd_visibilite="public" ';
568
        if (!$visible) $requete .= ' and pd_visibilite="public" ';
569
        $requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
569
        $requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
570
        $resultat = $objetDB->query ($requete) ;
570
        $resultat = $objetDB->query ($requete) ;
Line 577... Line 577...
577
            array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
577
            array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
578
        }
578
        }
579
        return $tableau_document ;
579
        return $tableau_document ;
580
    } // end of member function getDocumentsRecents
580
    } // end of member function getDocumentsRecents
Line -... Line 581...
-
 
581
 
-
 
582
    /**
-
 
583
     * Renvoie les documents du projet passe en parametre sous forme d arbre d objet document
-
 
584
     *
-
 
585
     * @param int l identifiant du projet
-
 
586
     * @return Array
-
 
587
     * @static
-
 
588
     * @access public
-
 
589
     */
-
 
590
	function getArbreDocument($id_projet, $objetDB = '') {
-
 
591
		$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$id_projet;
-
 
592
		$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
-
 
593
		if (DB::isError ($resultat)) {
-
 
594
            return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
-
 
595
        }
-
 
596
	
-
 
597
      	return $resultat;
-
 
598
	}
-
 
599
	 /**
-
 
600
     * Renvoie la taille du document formatee avec une unite adapte
-
 
601
     *
-
 
602
     * @return string La taille formate
-
 
603
     * @access public
-
 
604
     */
-
 
605
	function getTailleFormatee($precision = 1) {
-
 
606
		$taille = $this->getTaille();
-
 
607
		if ($taille > 1000000) {
-
 
608
			$diviseur = 1000000;
-
 
609
			$unite = 'Mo';
-
 
610
		} else {
-
 
611
			$diviseur = 1000 ;
-
 
612
			$unite = 'Ko';
-
 
613
		}
-
 
614
		return round ($taille / $diviseur, $precision).'&nbsp;'.$unite;
581
 
615
	}
582
 
616
 
Line 583... Line 617...
583
} // end of document
617
} // end of document