Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1589 Rev 2289
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);
43
		
45
		$chercheur_infos_taxon = new RechercheInfosTaxonBeta($this->config, $referentiel_taxo);
44
		$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
		}
45
		$nt = $chercheur_infos_taxon->rechercherNumTaxSurNumNom($nn);
50
		
46
		
51
		switch($referentiel_taxo) {
47
		switch($referentiel_taxo) {
52
			case 'bdtfx':
48
			case 'bdtfx':
53
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
49
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
54
				$url_service_chorologie = str_replace('{referentiel_choro}','chorodep',$url_service_chorologie);
50
				$url_service_chorologie = str_replace('{referentiel_choro}','chorodep',$url_service_chorologie);
55
				$file = $url_service_chorologie.'/nn%3A'.implode(',',$nns).'?retour.format=587&retour=image%2Fpng';
51
				$file = $url_service_chorologie.'/nt%3A'.$nt.'?retour.format=587&retour=image%2Fpng';
56
				$retour = array($file);
52
				$retour = array($file);
57
			break;
53
			break;
58
			case 'bdtxa':
54
			case 'bdtxa':
59
				// En attendant mieux
55
				// En attendant mieux
60
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
56
				$url_service_chorologie = $this->config['eflore']['url_service_chorologie_carte'];
61
				$url_service_chorologie = str_replace('{referentiel_choro}','bdtxa',$url_service_chorologie);
57
				$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';
58
				$file = $url_service_chorologie.'/nt%3A'.$nt.'?retour.format=587&retour=image%2Fpng';
63
				$retour = array($file);
59
				$retour = array($file);
64
			break;
60
			break;
65
			
61
			
66
			default:
62
			default:
67
			break;
63
			break;
68
		}
64
		}
69
		return $retour;	
65
		return $retour;	
70
	}
66
	}
71
}
67
}
72
/* +--Fin du code ---------------------------------------------------------------------------------------+
68
/* +--Fin du code ---------------------------------------------------------------------------------------+
73
* $Log$
69
* $Log$
74
* Revision 1.1  2008-01-30 08:57:28  ddelon
70
* Revision 1.1  2008-01-30 08:57:28  ddelon
75
* fin mise en place mygwt
71
* fin mise en place mygwt
76
*
72
*
77
* Revision 1.1  2007-06-06 13:31:16  ddelon
73
* Revision 1.1  2007-06-06 13:31:16  ddelon
78
* v0.09
74
* v0.09
79
*/
75
*/
80
?>
76
?>