Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 137 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.0.3                                                                                    |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of eRibo.                                                                          |
// |                                                                                                      |
// | Foobar is free software; you can redistribute it and/or modify                                       |
// | it under the terms of the GNU General Public License as published by                                 |
// | the Free Software Foundation; either version 2 of the License, or                                    |
// | (at your option) any later version.                                                                  |
// |                                                                                                      |
// | Foobar is distributed in the hope that it will be useful,                                            |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
// | GNU General Public License for more details.                                                         |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public License                                    |
// | along with Foobar; if not, write to the Free Software                                                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: recherche_classif_xhtml.php,v 1.2 2005-02-14 18:11:43 jpm Exp $
/**
* Vue affichant la liste des taxons d'un projet.
*
* Permet de retourner le xhtml correspondant à une liste hiérarchisées des taxons d'un projet.
*
*@package eFlore
*@subpackage Vues
//Auteur original :
*@author        Frédéric LEGENS <flegens@free.fr>
//Autres auteurs :
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.2 $ $Date: 2005-02-14 18:11:43 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+
require_once EFSE_CHEMIN_FONCTION.'eribo_encodage.fonct.php';

// +------------------------------------------------------------------------------------------------------+
// |                                            CLASSE de la VUE                                          |
// +------------------------------------------------------------------------------------------------------+
class recherche_classif_xhtml implements iVue {
    
    protected $leBlock;
    
    function __construct($unBlock)
    {
        $this->leBlock = $unBlock;
    }
    
    function serialiser()
    {
        $retour = '<?xml version="1.0" encoding="iso-8859-15" ?>'."\n";
        $retour .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../../../commun/generique/dtd/xhtml1-strict.dtd">'."\n";
        $retour .= '<html xmlns="http://w ww.w3.org/1999/xhtml" lang="fr" >'."\n";
        
        $retour .= '<head>'."\n";
        $retour .= '<!-- BEGIN entete -->'."\n";
        $retour .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />'."\n";
        $retour .= '<meta http-equiv="Content-style-type" content="text/css" />'."\n";
        $retour .= '<meta http-equiv="Content-script-type" content="text/javascript />'."\n";
        $retour .= '<meta http-equiv="Content-language" content="fr" />'."\n";
        $retour .= '<title>Liste de taxons</title>'."\n";
        $retour .= '<!-- END entete -->'."\n";
        $retour .= '</head>'."\n";
        
        $retour .= '<body>'."\n";
        $retour .= '<!-- BEGIN corps -->'."\n";
        $retour .= '<h1>'.'Liste des taxons'.'</h1>'."\n";
        $retour .= '<!-- BEGIN liste -->'."\n";
        $retour .= $this->leBlock->afficherPatternRecursivement('afficherTaxon', 'TAXON_RECHERCHE_CLASSIFICATION');
        $retour .= '<!-- END liste -->'."\n";
        $retour .= '<!-- END corps -->'."\n";
        $retour .= '</body>'."\n";
        $retour .= '</html>'."\n";
        
        // Envoi au navigateur après encodage en entité des caractères posant problème
        echo remplaceEntiteHTLM($retour);
    }
}

// +------------------------------------------------------------------------------------------------------+
// |                                            LISTE des FONCTIONS                                       |
// +------------------------------------------------------------------------------------------------------+

function afficherTaxon($donnees, $parametre)
{
    //echo '<pre>'.print_r($donnees, true).'</pre>';
    if (isset($donnees['eni_intitule_nom'])) {
        if (!empty($donnees['eni_intitule_nom'])) {
            $retour .= '<a href="func_remplacerUrlClassif('.$donnees['etr_id_taxon_1'].')">';
            $retour .= '<img src="#" alt="+"/>';
            $retour .= '</a><a id="eflore_taxon_'.$donnees['etr_id_taxon_1'].'" href="{UrlFicheNom}'.$donnees['en_id_nom'].'">';
            $retour .= $donnees['eni_intitule_nom'];
            $retour .= '</a>'."\n";
            
            $retour_tax = '';
            $nbre_taxon = 0;
            foreach ($donnees as $cle => $valeur) {
                if (strstr($cle, $parametre)) {
                    $retour_tax .= afficherTaxon($valeur, $parametre);
                    $nbre_taxon++;
                }
            }
            if ($nbre_taxon > 0) {
                $retour .= '<ol>'."\n";
                $retour .= $retour_tax;
                $retour .= '</ol>'."\n";
            } else {
                $retour .= 'func_ajouterArboressenceClassif('.$donnees['etr_id_taxon_1'].')';
            }
            
            $retour .= '</li>'."\n";
        }
    } else {
        $retour .= '<ol>'."\n";
        foreach ($donnees as $cle0 => $valeur0) {
            if (strstr($cle0, $parametre)) {
                if (!empty($valeur0['eni_intitule_nom'])) {
                    $retour .= '<li>'."\n";
                    $retour .= '<a href="func_remplacerUrlClassif('.$valeur0['etr_id_taxon_1'].')">';
                    $retour .= '<img src="#" alt="+"/>';
                    $retour .= '</a><a id="eflore_taxon_'.$valeur0['etr_id_taxon_1'].'" href="{UrlFicheNom}'.$valeur0['en_id_nom'].'">';
                    $retour .= $valeur0['eni_intitule_nom'];
                    $retour .= '</a>'."\n";
                    
                    $retour_tax = '';
                    $nbre_taxon = 0;
                    foreach ($valeur0 as $cle1 => $valeur1) {
                        if (strstr($cle1, $parametre)) {
                            $retour_tax .= afficherTaxon($valeur1, $parametre);
                            $nbre_taxon++;
                        }
                    }
                    if ($nbre_taxon > 0) {
                        $retour .= '<ol>'."\n";
                        $retour .= $retour_tax;
                        $retour .= '</ol>'."\n";
                    } else {
                        $retour .= 'func_ajouterArboressenceClassif('.$valeur0['etr_id_taxon_1'].')';
                    }
                    
                    $retour .= '</li>'."\n";
                }
            }
        }
        $retour .= '</ol>'."\n";
    }
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// |                                            PIED du PROGRAMME                                         |
// +------------------------------------------------------------------------------------------------------+


/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1  2005/02/09 13:07:16  jpm
* Permet de voir la classification d'un taxon.
*
* Revision 1.1  2005/01/28 19:45:44  jpm
* Début recheche taxons.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>