Subversion Repositories Sites.tela-botanica.org

Rev

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

Rev 101 Rev 409
Line 1... Line 1...
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
-
 
3
// +------------------------------------------------------------------------------------------------------+
2
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
3
// | PHP version 4.1																					  |
5
// +------------------------------------------------------------------------------------------------------+
4
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)							   	          |
7
// +------------------------------------------------------------------------------------------------------+
6
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
7
// | This library is free software; you can redistribute it and/or										  |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
8
// | modify it under the terms of the GNU Lesser General Public										      |
10
// | License as published by the Free Software Foundation; either                                         |
9
// | License as published by the Free Software Foundation; either										  |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
10
// | version 2.1 of the License, or (at your option) any later version.								      |
12
// |                                                                                                      |
11
// |																									  |
13
// | This library is distributed in the hope that it will be useful,                                      |
12
// | This library is distributed in the hope that it will be useful,									  |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of									      |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU									  |
16
// | Lesser General Public License for more details.                                                      |
15
// | Lesser General Public License for more details.													  |
17
// |                                                                                                      |
16
// |																									  |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
17
// | You should have received a copy of the GNU Lesser General Public									  |
19
// | License along with this library; if not, write to the Free Software                                  |
18
// | 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                            |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA							  |
21
// +------------------------------------------------------------------------------------------------------+
20
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: inscription.class.php,v 1.3 2005/05/13 13:48:38 alex Exp $
-
 
23
// CVS : $Id: inscription.class.php,v 1.3 2005/05/13 13:48:38 alex Exp $
-
 
24
/**
21
/**
25
* Fonctions du module inscription
22
* Fonctions du module inscription
26
*
23
*
27
* Fonctions du module inscription
24
* Fonctions du module inscription
28
*
25
*
29
*@package inscription
26
*@package inscription
30
//Auteur original :
27
//Auteur original :
31
*@author        Alexandre Granier <alexandre@tela-botanica.org>
28
*@author		Alexandre Granier <alexandre@tela-botanica.org>
32
//Autres auteurs :
29
//Autres auteurs :
33
*@author        Aucun
30
*@author	   	Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
*@copyright     Tela-Botanica 2000-2004
31
*@copyright		Tela-Botanica 2000-2004
35
*@version       $Revision: 1.3 $ $Date: 2005/05/13 13:48:38 $
-
 
36
*@version       $Revision: 1.3 $ $Date: 2005/05/13 13:48:38 $
32
*@version	   	$Id: inscription.class.php,v 1.3 2005/05/13 13:48:38 alex Exp $
37
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
38
*/
34
*/
Line 39... Line 35...
39
 
35
 
40
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
37
// |											ENTETE du PROGRAMME									   |
Line 42... Line -...
42
// +------------------------------------------------------------------------------------------------------+
-
 
43
 
-
 
44
require_once 'HTML/QuickForm.php' ;
-
 
Line 45... Line 38...
45
require_once 'HTML/QuickForm/checkbox.php' ;
38
// +------------------------------------------------------------------------------------------------------+
46
require_once 'HTML/QuickForm/password.php' ;
39
 
47
 
40
 
Line 48... Line 41...
48
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
289
    } // end of member function toHTML
268
	function toHTML( ) {
Line 290... Line 269...
290
 
269
		$res = HTML_QuickForm::toHTML() ;
Line 291... Line 270...
291
 
270
		return $res ;
292
 
271
	} // end of member function toHTML
293
}
272
}
294
 
273
 
295
class ListeDePays extends PEAR{
274
class ListeDePays extends PEAR{
296
 
275
 
297
    var $_db ;
276
	var $_db ;
298
    /** Constructeur
-
 
299
     *  Vérifie l'existance de la table gen_pays_traduction
277
	/** Constructeur
300
     *
278
	 *  Vérifie l'existance de la table gen_pays_traduction
301
     *  @param  DB  Un objet PEAR::DB
279
	 *
302
     * @return
280
	 * @param  DB  Un objet PEAR::DB
303
     */
281
	 * @return
304
    
282
	 */
305
    function ListeDePays (&$objetDB) {
283
	function ListeDePays (&$objetDB) {
306
        $this->_db = $objetDB ;
284
		$this->_db = $objetDB ;
307
        $requete = "show tables" ;
285
		$requete = 'SHOW TABLES';
308
        $resultat = $objetDB->query ($requete) ;
286
		$resultat = $objetDB->query($requete) ;
309
        if (DB::isError ($resultat)) {
287
		if (DB::isError ($resultat)) {
310
            die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
288
			die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
311
        }
289
		}
312
        while ($ligne = $resultat->fetchRow()) {
290
		while ($ligne = $resultat->fetchRow()) {
313
            if ($ligne[0] == 'gen_COUNTRY') {
291
			if ($ligne[0] == INS_TABLE_PAYS) {
314
                return ;
292
				return ;
315
            }
293
			}
316
        }
294
		}
317
        return $this->raiseError ('La table gen_COUNTRY n\'est pas présente dans la base de donnée !') ;
295
		return $this->raiseError('La table '.INS_TABLE_PAYS.' n\'est pas présente dans la base de donnée !') ;
318
    }
296
	}
319
    
-
 
320
    /** Renvoie la liste des pays traduite
297
	
321
     *
298
	/** Renvoie la liste des pays traduite
322
     *  @param  string  une chaine de type i18n ou une chaine code iso langue (fr_FR ou fr ou FR)
299
	 *
323
     * @return  un tableau contenant en clé, le code iso du pays, en majuscule et en valeur le nom du pays traduit
300
	 * @param  string  une chaine de type i18n ou une chaine code iso langue (fr_FR ou fr ou FR)
324
     */
301
	 * @return  un tableau contenant en clé, le code iso du pays, en majuscule et en valeur le nom du pays traduit
-
 
302
	 */
-
 
303
	function getListePays ($i18n) {
-
 
304
		if (strlen($i18n) == 2) {
325
    
305
			$i18n = strtolower($i18n).'-'.strtoupper($i18n) ;
326
    function getListePays ($i18n) {
306
		}
327
        if (strlen($i18n) == 2) {
307
		$requete = 	'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' '.
328
            $i18n = strtolower($i18n)."-".strtoupper($i18n) ;
308
					'FROM '.INS_TABLE_PAYS.' '.
329
        }
309
					'WHERE '.INS_CHAMPS_PAYS_LG.' = "fr" '.
330
        $requete = "select GC_ID, GC_NAME from gen_COUNTRY where GC_LOCALE='fr' order by GC_NAME" ;
310
					'ORDER BY '.INS_CHAMPS_LABEL_PAYS.' ';
331
        $resultat = $this->_db->query ($requete) ;
311
		$resultat = $this->_db->query($requete);
332
        if (DB::isError ($resultat)) {
312
		if (DB::isError($resultat)) {
333
            die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
313
			die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
334
        }
314
		}
335
        if ($resultat->numRows() == 0) {
315
		if ($resultat->numRows() == 0) {
336
            return $this->raiseError('Le code fourni ne correspond à aucun pays ou n\'est pas dans la table!') ;
316
			return $this->raiseError('Le code fourni ne correspond à aucun pays ou n\'est pas dans la table!') ;
337
        }
317
		}
338
        $retour = array() ;
318
		$retour = array() ;
Line 339... Line 319...
339
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
319
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {