Subversion Repositories eFlore/Applications.cel

Rev

Rev 876 | Rev 1014 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 876 Rev 892
Line 1... Line 1...
1
<?php
1
<?php
2
/**
2
/**
3
 
-
 
4
 David Delon david.delon@clapas.net 2007
3
* PHP Version 5
5
 
4
*
6
 Ce logiciel est r�gi par la licence CeCILL soumise au droit fran�ais et
-
 
7
 respectant les principes de diffusion des logiciels libres. Vous pouvez
-
 
8
 utiliser, modifier et/ou redistribuer ce programme sous les conditions
-
 
9
 de la licence CeCILL telle que diffus�e par le CEA, le CNRS et l'INRIA 
-
 
10
 sur le site "http://www.cecill.info".
5
* @category  PHP
11
 En contrepartie de l'accessibilit� au code source et des droits de copie,
6
* @package   jrest
12
 de modification et de redistribution accord�s par cette licence, il n'est
7
* @author    David Delon <david.delon@clapas.net>
13
 offert aux utilisateurs qu'une garantie limit�e.  Pour les m�mes raisons,
-
 
14
 seule une responsabilit� restreinte p�se sur l'auteur du programme,  le
-
 
15
 titulaire des droits patrimoniaux et les conc�dants successifs.
8
* @copyright 2010 Tela-Botanica
16
 
-
 
17
 A cet �gard  l'attention de l'utilisateur est attir�e sur les risques
-
 
18
 associ�s au chargement,  � l'utilisation,  � la modification et/ou au
-
 
19
 d�veloppement et � la reproduction du logiciel par l'utilisateur �tant 
-
 
20
 donn� sa sp�cificit� de logiciel libre, qui peut le rendre complexe � 
-
 
21
 manipuler et qui le r�serve donc � des d�veloppeurs et des professionnels
-
 
22
 avertis poss�dant  des  connaissances  informatiques approfondies.  Les
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
23
 utilisateurs sont donc invit�s � charger  et  tester  l'ad�quation  du
-
 
24
 logiciel � leurs besoins dans des conditions permettant d'assurer la
10
* @version   SVN: <svn_id>
25
 s�curit� de leurs syst�mes et ou de leurs donn�es et, plus g�n�ralement, 
-
 
26
 � l'utiliser et l'exploiter dans les m�mes conditions de s�curit�. 
-
 
27
                                                                                                      
-
 
28
 Le fait que vous puissiez acc�der � cet en-t�te signifie que vous avez 
-
 
29
 pris connaissance de la licence CeCILL, et que vous en avez accept� les
-
 
30
 termes.
11
* @link      /doc/jrest/
31
 
-
 
32
 */
12
*/
Line 33... Line -...
33
 
-
 
34
// in : utf8
-
 
35
// out : 8859
13
 
36
/*
14
/**
37
 * NameImage.php  
15
* NameImage.php  
-
 
16
* 
-
 
17
* in : utf8
-
 
18
* out : 8859
38
 * 
19
* 
39
 * Cas d'utilisation :
20
* Cas d'utilisation :
40
 * Service recherche d'image a partir d'un numero nomenclatural
21
* Service recherche d'image a partir d'un numero nomenclatural
41
 * 
22
* 
42
 * 1: Le service recoit un numero nomenclatural
23
* 1: Le service recoit un numero nomenclatural
Line 59... Line 40...
59
 
40
 
Line 60... Line 41...
60
class NameImage extends Cel  {
41
class NameImage extends Cel  {
Line 61... Line -...
61
 
-
 
62
	function getElement($uid){
-
 
63
 
-
 
64
		// Num nomenclatural 
-
 
65
		$requete_num_nom = "SELECT DISTINCT b.esn_id_taxon FROM eflore_nom, eflore_nom_rang," .
-
 
66
		" eflore_selection_nom a, eflore_selection_nom b".
-
 
67
		" WHERE a.esn_id_nom= ".$this->proteger($uid[0]). 
-
 
68
		" AND a.esn_id_version_projet_taxon = 25 ".
-
 
69
		" AND a.esn_id_taxon=b.esn_id_taxon ".
-
 
70
		" AND b.esn_ce_statut=3 ".
-
 
71
		" AND a.esn_id_version_projet_taxon=b.esn_id_version_projet_taxon" .
-
 
72
		" AND en_ce_rang = enrg_id_rang" .
-
 
73
		" AND en_id_nom = b.esn_id_nom" .
-
 
74
		" AND a.esn_id_version_projet_taxon=en_id_version_projet_nom ";
-
 
75
	     
42
 
-
 
43
	function getElement($uid){
-
 
44
 
76
	    $res_num_nom = $this->requeter($requete_num_nom);
45
		$nt = null;
77
		
46
 
78
		$nt = null;	    
47
		if(isset($uid[0])) {
Line 79... Line 48...
79
		if(is_array($res_num_nom) && count($res_num_nom) > 0) {
48
			$recherche_infos_taxon = new RechercheInfosTaxon($this->config);
Line 80... Line 49...
80
			$nt=$res_num_nom[0]['esn_id_taxon'];
49
			$nt = $recherche_infos_taxon->rechercherNumTaxSurNumNom($uid[0]);
Line 81... Line 50...
81
		}
50
		}
Line 82... Line 51...
82
 
51
 
Line 83... Line -...
83
		$projet_photo = 'photoflora';
-
 
84
		
52
		$projet_photo = 'photoflora';
85
		$tab_retour[$projet_photo]=chercherIllustrationsServiceXml(sprintf(EF_URL_PHOTOFLORA_SERVICE, $nt));
53
		
86
		
54
		$tab_retour[$projet_photo]=chercherIllustrationsServiceXml(sprintf(EF_URL_PHOTOFLORA_SERVICE, $nt));
87
		$value=array('null','null');
55
		
88
		
56
		$value=array('null','null');
Line 100... Line 68...
100
						 $fichier = $match[2];
68
						 $fichier = $match[2];
101
				}
69
				}
102
			}
70
			}
Line 103... Line 71...
103
			
71
			
104
			if (isset($abreviation)) {
-
 
105
				
72
			if (isset($abreviation)) {			
106
			      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
73
		      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
Line 107... Line 74...
107
			      	$url_max = $illustration['about'];
74
		      	$url_max = $illustration['about'];
Line 108... Line 75...
108
			      	
75
		      	
109
					$value=array($url_miniature,$url_max);
76
				$value=array($url_miniature,$url_max);
110
					
77
				
111
					// Priorite aux images en png
78
				// Priorite aux images en png
112
					if (strstr($fichier, '.png')) {
79
				if (strstr($fichier, '.png')) {
113
						break;
-
 
114
					}
80
					break;
Line 115... Line 81...
115
			}
81
				}
-
 
82
			}
116
	
83
		}
-
 
84
		
117
		}
85
		$output = json_encode($value);
Line 118... Line 86...
118
		
86
		header("content-type: application/json");
Line 119... Line 87...
119
		$output = json_encode($value);
87
		print($output);
Line 136... Line 104...
136
		@$dom->loadXML(file_get_contents($chemin));
104
		@$dom->loadXML(file_get_contents($chemin));
137
	} else {
105
	} else {
138
		@$dom->load($chemin);
106
		@$dom->load($chemin);
139
	}
107
	}
Line 140... Line -...
140
	
-
 
141
	
108
	
142
	$tab_infos = array();
109
	$tab_infos = array();
143
	foreach ($dom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description') as $rdf_description) {
110
	foreach ($dom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description') as $rdf_description) {
144
		$aso_info['about'] = $rdf_description->getAttribute('about');
111
		$aso_info['about'] = $rdf_description->getAttribute('about');
145
		$aso_info['dc:identifier'] = $rdf_description->getAttribute('identifier');
112
		$aso_info['dc:identifier'] = $rdf_description->getAttribute('identifier');
Line 163... Line 130...
163
		$tab_infos[$rdf_description->getAttribute('identifier')] = $aso_info; 
130
		$tab_infos[$rdf_description->getAttribute('identifier')] = $aso_info; 
164
	}
131
	}
Line 165... Line 132...
165
		
132
		
166
	return $tab_infos;
133
	return $tab_infos;
167
}
-
 
168
 
-
 
169
 
134
}
170
/* +--Fin du code ---------------------------------------------------------------------------------------+
135
/* +--Fin du code ---------------------------------------------------------------------------------------+
171
* $Log$
136
* $Log$
172
* Revision 1.4  2008-11-13 11:29:12  ddelon
137
* Revision 1.4  2008-11-13 11:29:12  ddelon
173
* Reecriture gwt-ext
138
* Reecriture gwt-ext