Subversion Repositories Applications.bazar

Rev

Rev 409 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 409 Rev 468
Line 1... Line 1...
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | 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                                  |
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: checkbox.php,v 1.3 2008-11-19 09:28:46 aperonnet Exp $
22
// CVS : $Id: checkbox.php,v 1.2 2008-09-17 14:18:12 alexandre_tb Exp $
23
/**
23
/**
24
* 
24
* 
25
*@package bazar
25
*@package bazar
26
//Auteur original :
26
//Auteur original :
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
28
//Autres auteurs :
28
//Autres auteurs :
29
*@copyright     Tela-Botanica 2000-2008
29
*@copyright     Tela-Botanica 2000-2008
30
*@version       $Revision: 1.3 $
30
*@version       $Revision: 1.2 $
31
// +------------------------------------------------------------------------------------------------------+
31
// +------------------------------------------------------------------------------------------------------+
32
*/
32
*/
33
 
33
 
34
include_once PAP_CHEMIN_API_PEAR.'PEAR.php';
34
include_once PAP_CHEMIN_API_PEAR.'PEAR.php';
35
 
35
 
36
 
36
 
37
class Bazar_checkbox extends PEAR {
37
class Bazar_checkbox extends PEAR {
38
	
38
	
39
	var $option = array();
39
	var $option = array();
40
	
40
	
41
	function Bazar_checkbox($options) {
41
	function Bazar_checkbox($options) {
42
		$this->options = $options;
42
		$this->options = $options;
43
	}
43
	}
44
	
44
	
45
	function toHTML($valeur) {
45
	function toHTML($valeur) {
46
		$html = '';
46
		$html = '';
47
		$val = $this->options['nom_bdd'];
47
		$val = $this->options['nom_bdd'];
48
		//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
48
		//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
49
		$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.
49
		$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.
50
					$GLOBALS['_BAZAR_']['id_fiche'].' AND  bfvl_ce_liste='.$this->options['nom_bdd'].
50
					$GLOBALS['_BAZAR_']['id_fiche'].' AND  bfvl_ce_liste='.$this->options['nom_bdd'].
51
					' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$this->options['nom_bdd'].
51
					' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$this->options['nom_bdd'].
52
					' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
52
					' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
53
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
53
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
54
		if (DB::isError ($resultat)) {
54
		if (DB::isError ($resultat)) {
55
			return ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
55
			return ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
56
		}
56
		}
57
		$val='';$nb=0;
57
		$val='';$nb=0;
58
		while ($tab = $resultat->fetchRow()) {
58
		while ($tab = $resultat->fetchRow()) {
59
			if ($nb>0) $val .= ', ';
59
			if ($nb>0) $val .= ', ';
60
			$val .= $tab[0];
60
			$val .= $tab[0];
61
			$nb++;
61
			$nb++;
62
		}				
62
		}				
63
		if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
63
		if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
64
			$html .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.
64
			$html .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.
65
			"\n".'<span class="BAZ_label" id="rubrique_'.$this->options['nom_bdd'].'">'.$this->options['label'].' : </span>'."\n";
65
			"\n".'<span class="BAZ_label" id="rubrique_'.$this->options['nom_bdd'].'">'.$this->options['label'].' : </span>'."\n";
66
			$html .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="description_'.$this->options['nom_bdd'].
66
			$html .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="description_'.$this->options['nom_bdd'].
67
					'"> '.$val.'</span>'."\n".'</div>'."\n";
67
					'"> '.$val.'</span>'."\n".'</div>'."\n";
68
		}
68
		}
69
		return $html;
69
		return $html;
70
	}
70
	}
71
}
71
}
72
 
72
 
73
/* +--Fin du code ----------------------------------------------------------------------------------------+
73
/* +--Fin du code ----------------------------------------------------------------------------------------+
74
*
74
*
75
* $Log: not supported by cvs2svn $
75
* $Log: checkbox.php,v $
76
* Revision 1.2  2008-09-17 14:18:12  alexandre_tb
76
* Revision 1.2  2008-09-17 14:18:12  alexandre_tb
77
* fusion avec aha
77
* fusion avec aha
78
*
78
*
79
* Revision 1.1.2.1  2008-04-16 12:35:25  alexandre_tb
79
* Revision 1.1.2.1  2008-04-16 12:35:25  alexandre_tb
80
* version initiale
80
* version initiale
81
*
81
*
82
*
82
*
83
* +-- Fin du code ----------------------------------------------------------------------------------------+
83
* +-- Fin du code ----------------------------------------------------------------------------------------+
84
*/
84
*/
85
?>
85
?>
86
86