Subversion Repositories eFlore/Applications.cel

Rev

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

<?php
/**
* PHP Version 5
*
* @category  PHP
* @package   jrest
* @author    David Delon <david.delon@clapas.net>
* @copyright 2010 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version   SVN: <svn_id>
* @link      /doc/jrest/
*/

/**
* NameMap.php 
* 
* in utf8
* out utf8 
* 
* Cas d'utilisation :
* Service recherche d'image a partir d'un numero nomenclatural
* 
* 1: Le service recoit un numero nomenclatural
* 2: Le service calcul le numero taxonomique associe
* 3: Le service recherche une carte disponible
*               A: Pas de carte disponible, generation de l'image
*/

// TODO: externaliser ceci dans le fichier de config
/** Constante stockant l'URL o. sont accessible les cartes. Le %s correspond au nom du fichier.*/
define('EF_URL_CARTO', 'http://www.tela-botanica.org/sites/eflore/generique/images/cartes/');
// france_BDNFF_4.02_nt8523.png
/** Constante stockant l'URL d'appel du module chorologie*/
define('EF_URL_CHORO', 'http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/');
// 182/chorologie

class NameMap extends Cel  {

        function getElement($uid){

                $nt = null;

                if(isset($uid[0])) {
                        $recherche_infos_taxon = new RechercheInfosTaxon($this->config);
                        $nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
                }
        
        $retour = array('');
        
        // si le taxon cherché existe 
        if ($nt) {           
                        $file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
                        $file_headers = @get_headers($file);
                        
                        if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
                        }
                        else {
                                $service=EF_URL_CHORO.$uid[0].'/chorologie';
                                @get_headers($service);
                        }
                        
                        $retour = array($file);
        }           

                $this->envoyerJson($retour);                    
                return true;    
        }
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.1  2008-01-30 08:57:28  ddelon
* fin mise en place mygwt
*
* Revision 1.1  2007-06-06 13:31:16  ddelon
* v0.09
*/
?>