Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1527 Rev 1589
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 référentiell et un numero nomenclatural
23
* 1: Le service recoit un référentiell et un numero nomenclatural
24
* 2: Le service recherche une carte disponible
24
* 2: Le service recherche une carte disponible
25
*/
25
*/
26
 
26
 
27
class NameMap extends Cel  {
27
class NameMap extends Cel  {
28
 
28
 
29
	function getElement($uid){
29
	function getElement($uid){
30
		$retour = array('');
30
		$retour = array('');
31
		if(isset($uid[0]) && isset($uid[1])) {
31
		if(isset($uid[0]) && isset($uid[1])) {
32
			$uid[0] = $uid[0] != '' ? $uid[0] : 'bdtfx';
32
			$uid[0] = $uid[0] != '' ? $uid[0] : 'bdtfx';
33
			$retour = $this->obtenirCarteChorologie($uid[0], $uid[1]);
33
			$retour = $this->obtenirCarteChorologie($uid[0], $uid[1]);
34
		}  	    
34
		}  	    
35
 
35
 
36
		$this->envoyerJson($retour);			
36
		$this->envoyerJson($retour);			
37
		return true;	
37
		return true;	
38
	}
38
	}
39
	
39
	
40
	function obtenirCarteChorologie($referentiel_taxo, $nn) {
40
	function obtenirCarteChorologie($referentiel_taxo, $nn) {
41
		// TODO: gérer ici les cartes d'autres référentiels si celles si sont disponibles
41
		// TODO: gérer ici les cartes d'autres référentiels si celles si sont disponibles
42
		$retour = array('');
42
		$retour = array('');
-
 
43
		
-
 
44
		$nns = array($nn);
-
 
45
		$chercheur_infos_taxon = new RechercheInfosTaxonBeta($this->config, $referentiel_taxo);
-
 
46
		$syns = $chercheur_infos_taxon->rechercherSynonymesSurNumNom($nn);
-
 
47
		foreach($syns as $nn => $syn) {
-
 
48
			$nns[] = $nn;
-
 
49
		}
-
 
50
		
43
		switch($referentiel_taxo) {
51
		switch($referentiel_taxo) {
44
			case 'bdtfx':
52
			case 'bdtfx':
45
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
53
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
-
 
54
				$url_service_chorologie = str_replace('{referentiel_choro}','chorodep',$url_service_chorologie);
46
				$file = $url_service_chorologie.'/nn%3A'.$nn.'?retour.format=587&retour=image%2Fpng';
55
				$file = $url_service_chorologie.'/nn%3A'.implode(',',$nns).'?retour.format=587&retour=image%2Fpng';
-
 
56
				$retour = array($file);
-
 
57
			break;
-
 
58
			case 'bdtxa':
-
 
59
				// En attendant mieux
-
 
60
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
-
 
61
				$url_service_chorologie = str_replace('{referentiel_choro}','bdtxa',$url_service_chorologie);
-
 
62
				$file = $url_service_chorologie.'/nn%3A'.implode(',',$nns).'?retour.format=587&retour=image%2Fpng';
47
				$retour = array($file);
63
				$retour = array($file);
48
			break;
64
			break;
49
			
65
			
50
			default:
66
			default:
51
			break;
67
			break;
52
		}
68
		}
53
		return $retour;	
69
		return $retour;	
54
	}
70
	}
55
}
71
}
56
/* +--Fin du code ---------------------------------------------------------------------------------------+
72
/* +--Fin du code ---------------------------------------------------------------------------------------+
57
* $Log$
73
* $Log$
58
* Revision 1.1  2008-01-30 08:57:28  ddelon
74
* Revision 1.1  2008-01-30 08:57:28  ddelon
59
* fin mise en place mygwt
75
* fin mise en place mygwt
60
*
76
*
61
* Revision 1.1  2007-06-06 13:31:16  ddelon
77
* Revision 1.1  2007-06-06 13:31:16  ddelon
62
* v0.09
78
* v0.09
63
*/
79
*/
64
?>
80
?>