Subversion Repositories Applications.projet

Rev

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

Rev 11 Rev 295
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: type_fichier_mime.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
22
// CVS : $Id: type_fichier_mime.class.php,v 1.3 2008-08-25 15:03:52 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe type_fichier_mime
26
* La classe type_fichier_mime
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.2 $
34
*@version       $Revision: 1.3 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 124... Line 124...
124
     * @param DB objetDB un objet PEAR:DB
124
     * @param DB objetDB un objet PEAR:DB
125
     * @param int id_type 
125
     * @param int id_type 
126
     * @return void
126
     * @return void
127
     * @access public
127
     * @access public
128
     */
128
     */
129
    function type_fichier_mime( &$objetDB,  $id_type = '', $chemin_icones = "icones/" )
129
    function type_fichier_mime(  $id_type = '', $chemin_icones = "icones/" )
130
    {
130
    {
131
        $this->_db = $objetDB ;
-
 
-
 
131
        
132
        $requete = 'select * from gen_type_de_fichier where ' ;
132
        $requete = 'select * from gen_type_de_fichier where ' ;
133
        if (is_numeric ($id_type)) {
133
        if (is_numeric ($id_type)) {
134
            $requete .= 'gtf_id_type='.$id_type ;
134
            $requete .= 'gtf_id_type='.$id_type ;
135
        } else {
135
        } else {
136
            $requete .= 'gtf_type_mime="'.$id_type.'"' ; 
136
            $requete .= 'gtf_type_mime="'.$id_type.'"' ; 
137
        }
137
        }
138
        $resultat = $this->_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
        $ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
142
        $ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
143
        $this->_chemin_icone = $chemin_icones ;
143
        $this->_chemin_icone = $chemin_icones ;
Line 153... Line 153...
153
     * @param DB objetDB un objet PEAR:DB
153
     * @param DB objetDB un objet PEAR:DB
154
     * @return type_fichier_mime
154
     * @return type_fichier_mime
155
     * @static
155
     * @static
156
     * @access public
156
     * @access public
157
     */
157
     */
158
    function factory( $extension, &$objetDB )
158
    function factory( $extension, $objetDB = '')
159
    {
159
    {
-
 
160
        if (is_object($objetDB)) {
-
 
161
        	$GLOBALS['projet_db'] = $objetDB;
-
 
162
        }
160
        $requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
163
        $requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
161
        $resultat = $objetDB->query ($requete) ;
164
        $resultat = $GLOBALS['projet_db']->query ($requete) ;
162
        if (DB::isError($resultat)) {
165
        if (DB::isError($resultat)) {
163
            die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
166
            die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
164
        }
167
        }
165
        if ($resultat->numRows() != 0) {
168
        if ($resultat->numRows() != 0) {
166
            $ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
169
            $ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
167
            return new type_fichier_mime ($objetDB, $ligne->gtf_id_type) ;
170
            return new type_fichier_mime ( $ligne->gtf_id_type) ;
168
        } else {
171
        } else {
169
            // si il n'y a pas de résultat, on renvoie inconnue
172
            // si il n'y a pas de résultat, on renvoie inconnue
170
            return new type_fichier_mime ($objetDB, 12) ;
173
            return new type_fichier_mime (12) ;
171
        }
174
        }
172
    } // end of member function factory
175
    } // end of member function factory
Line 173... Line 176...
173
 
176
 
174
    /**
177
    /**