Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1014 Rev 1299
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
 
-
 
39
	// TODO: voir avec David quoi faire de cette variable inutilisée
-
 
40
	private $extendMapProductor;
-
 
41
 
38
 
42
	function getElement($uid){
39
	function getElement($uid){
43
 
40
 
44
		$nt = null;
41
		$nt = null;
45
 
42
 
46
		if(isset($uid[0])) {
43
		if(isset($uid[0])) {
47
			$recherche_infos_taxon = new RechercheInfosTaxon($this->config);
44
			$recherche_infos_taxon = new RechercheInfosTaxon($this->config);
48
			$nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
45
			$nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
49
		}
46
		}
50
        
47
        
51
        $retour = array('');
48
        $retour = array('');
52
        
49
        
53
        // si le taxon cherché existe 
50
        // si le taxon cherché existe 
54
        if ($nt) {           
51
        if ($nt) {           
55
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
52
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
56
			$file_headers = @get_headers($file);
53
			$file_headers = @get_headers($file);
57
			
54
			
58
			if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
55
			if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
59
			}
56
			}
60
			else {
57
			else {
61
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
58
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
62
				@get_headers($service);
59
				@get_headers($service);
63
			}
60
			}
64
			
61
			
65
			$retour = array($file);
62
			$retour = array($file);
66
        }    	    
63
        }    	    
67
 
64
 
68
		$this->envoyerJson($retour);			
65
		$this->envoyerJson($retour);			
69
		return true;	
66
		return true;	
70
	}
67
	}
71
}
68
}
72
/* +--Fin du code ---------------------------------------------------------------------------------------+
69
/* +--Fin du code ---------------------------------------------------------------------------------------+
73
* $Log$
70
* $Log$
74
* Revision 1.1  2008-01-30 08:57:28  ddelon
71
* Revision 1.1  2008-01-30 08:57:28  ddelon
75
* fin mise en place mygwt
72
* fin mise en place mygwt
76
*
73
*
77
* Revision 1.1  2007-06-06 13:31:16  ddelon
74
* Revision 1.1  2007-06-06 13:31:16  ddelon
78
* v0.09
75
* v0.09
79
*/
76
*/
80
?>
77
?>