Subversion Repositories eFlore/Applications.cel

Rev

Rev 892 | Rev 1299 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 892 Rev 1014
1
<?php
1
<?php
2
/**
2
/**
3
* PHP Version 5
3
* PHP Version 5
4
*
4
*
5
* @category  PHP
5
* @category  PHP
6
* @package   jrest
6
* @package   jrest
7
* @author    David Delon <david.delon@clapas.net>
7
* @author    David Delon <david.delon@clapas.net>
8
* @copyright 2010 Tela-Botanica
8
* @copyright 2010 Tela-Botanica
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
11
* @link      /doc/jrest/
11
* @link      /doc/jrest/
12
*/
12
*/
13
 
13
 
14
/**
14
/**
15
* NameMap.php 
15
* NameMap.php 
16
* 
16
* 
17
* in utf8
17
* in utf8
18
* out utf8 
18
* out utf8 
19
* 
19
* 
20
* Cas d'utilisation :
20
* Cas d'utilisation :
21
* Service recherche d'image a partir d'un numero nomenclatural
21
* Service recherche d'image a partir d'un numero nomenclatural
22
* 
22
* 
23
* 1: Le service recoit un numero nomenclatural
23
* 1: Le service recoit un numero nomenclatural
24
* 2: Le service calcul le numero taxonomique associe
24
* 2: Le service calcul le numero taxonomique associe
25
* 3: Le service recherche une carte disponible
25
* 3: Le service recherche une carte disponible
26
* 		A: Pas de carte disponible, generation de l'image
26
* 		A: Pas de carte disponible, generation de l'image
27
*/
27
*/
28
 
28
 
29
// TODO: externaliser ceci dans le fichier de config
29
// TODO: externaliser ceci dans le fichier de config
30
/** Constante stockant l'URL o. sont accessible les cartes. Le %s correspond au nom du fichier.*/
30
/** Constante stockant l'URL o. sont accessible les cartes. Le %s correspond au nom du fichier.*/
31
define('EF_URL_CARTO', 'http://www.tela-botanica.org/sites/eflore/generique/images/cartes/');
31
define('EF_URL_CARTO', 'http://www.tela-botanica.org/sites/eflore/generique/images/cartes/');
32
// france_BDNFF_4.02_nt8523.png
32
// france_BDNFF_4.02_nt8523.png
33
/** Constante stockant l'URL d'appel du module chorologie*/
33
/** Constante stockant l'URL d'appel du module chorologie*/
34
define('EF_URL_CHORO', 'http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/');
34
define('EF_URL_CHORO', 'http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/');
35
// 182/chorologie
35
// 182/chorologie
36
 
36
 
37
class NameMap extends Cel  {
37
class NameMap extends Cel  {
38
 
38
 
39
	// TODO: voir avec David quoi faire de cette variable inutilisée
39
	// TODO: voir avec David quoi faire de cette variable inutilisée
40
	private $extendMapProductor;
40
	private $extendMapProductor;
41
 
41
 
42
	function getElement($uid){
42
	function getElement($uid){
43
 
43
 
44
		$nt = null;
44
		$nt = null;
45
 
45
 
46
		if(isset($uid[0])) {
46
		if(isset($uid[0])) {
47
			$recherche_infos_taxon = new RechercheInfosTaxon($this->config);
47
			$recherche_infos_taxon = new RechercheInfosTaxon($this->config);
48
			$nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
48
			$nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
49
		}
49
		}
50
        
50
        
51
        $retour = array('');
51
        $retour = array('');
52
        
52
        
53
        // si le taxon cherché existe 
53
        // si le taxon cherché existe 
54
        if ($nt) {           
54
        if ($nt) {           
55
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
55
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
56
			$file_headers = @get_headers($file);
56
			$file_headers = @get_headers($file);
57
			
57
			
58
			if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
58
			if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
59
			}
59
			}
60
			else {
60
			else {
61
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
61
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
62
				@get_headers($service);
62
				@get_headers($service);
63
			}
63
			}
64
			
64
			
65
			$retour = array($file);
65
			$retour = array($file);
66
        }    	    
66
        }    	    
67
 
67
 
68
		$output = json_encode($retour);
-
 
69
		header("content-type: application/json");
68
		$this->envoyerJson($retour);			
70
		print($output);			
69
		return true;	
71
	}
70
	}
72
}
71
}
73
/* +--Fin du code ---------------------------------------------------------------------------------------+
72
/* +--Fin du code ---------------------------------------------------------------------------------------+
74
* $Log$
73
* $Log$
75
* Revision 1.1  2008-01-30 08:57:28  ddelon
74
* Revision 1.1  2008-01-30 08:57:28  ddelon
76
* fin mise en place mygwt
75
* fin mise en place mygwt
77
*
76
*
78
* Revision 1.1  2007-06-06 13:31:16  ddelon
77
* Revision 1.1  2007-06-06 13:31:16  ddelon
79
* v0.09
78
* v0.09
80
*/
79
*/
81
?>
80
?>