Subversion Repositories Applications.bazar

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/**
* PHP Version 5 
* 
* @category  PHP
* @package   bazar_bp
* @author    aurelien <aurelien@tela-botanica.org>
* @copyright 2009 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL  
* @version   SVN: <svn_id> 
* @link      /doc/bazar_bp/ 
*/

include_once PAP_CHEMIN_API_PEAR.'PEAR.php';


class Bazar_radio extends PEAR {
    
    var $option = array();
    
    function Bazar_radio($options) {
        $this->options = $options;
    }
    
    function toHTML($valeur) {
        
        $html = '';
        $val = $this->options['nom_bdd'];
        //pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id                
        $requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.
                    $GLOBALS['_BAZAR_']['id_fiche'].' AND  bfvl_ce_liste='.$this->options['nom_bdd'].
                    ' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$this->options['nom_bdd'].
                    ' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
                    
        $resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
        if (DB::isError ($resultat)) {
            return ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
        }
        $val='';$nb=0;
        while ($tab = $resultat->fetchRow()) {
            if ($nb>0) $val .= ', ';
            $val .= $tab[0];
            $nb++;
        }               
        if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
            $html .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.
            "\n".'<span class="BAZ_label" id="rubrique_'.$this->options['nom_bdd'].'">'.$this->options['label'].' : </span>'."\n";
            $html .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="description_'.$this->options['nom_bdd'].
                    '"> '.$val.'</span>'."\n".'</div>'."\n";
        }
        return $html;
    }
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2  2008-09-17 14:18:12  alexandre_tb
* fusion avec aha
*
* Revision 1.1.2.1  2008-04-16 12:35:25  alexandre_tb
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>

?>