Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 876 Rev 892
Line 1... Line 1...
1
<?php
1
<?php
2
/**
2
/**
-
 
3
* PHP Version 5
3
 
4
*
-
 
5
* @category  PHP
-
 
6
* @package   jrest
4
 David Delon david.delon@clapas.net 2007
7
* @author    David Delon <david.delon@clapas.net>
-
 
8
* @copyright 2010 Tela-Botanica
-
 
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
-
 
10
* @version   SVN: <svn_id>
-
 
11
* @link      /doc/jrest/
-
 
12
*/
Line 5... Line -...
5
 
-
 
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".
-
 
11
 En contrepartie de l'accessibilit� au code source et des droits de copie,
-
 
12
 de modification et de redistribution accord�s par cette licence, il n'est
-
 
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.
13
 
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
-
 
23
 utilisateurs sont donc invit�s � charger  et  tester  l'ad�quation  du
-
 
24
 logiciel � leurs besoins dans des conditions permettant d'assurer la
-
 
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
14
/**
30
 termes.
-
 
31
 
-
 
32
 */
15
* NameImage.php  
33
 
16
* 
34
// in : utf8
17
* in : utf8
35
// out : 8859
-
 
36
/*
-
 
37
 * NameImage.php  
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
43
 * 2: Le service calcul le numero taxonomique associe
24
* 2: Le service calcul le numero taxonomique associe
44
 * 3: Le service recherche une image disponible pour ce numero taxonomique
25
* 3: Le service recherche une image disponible pour ce numero taxonomique
45
 * 4: Le service redimensionne l'image et la renvoie
26
* 4: Le service redimensionne l'image et la renvoie
Line 46... Line 27...
46
 */
27
*/
47
 
28
 
48
/** Constante stockant l'URL de la page d'accueil de Photoflora.*/
29
/** Constante stockant l'URL de la page d'accueil de Photoflora.*/
49
define('EF_URL_PHOTOFLORA', 'http://photoflora.free.fr/');
30
define('EF_URL_PHOTOFLORA', 'http://photoflora.free.fr/');
Line 59... Line 40...
59
 
40
 
Line 60... Line 41...
60
class NameImage extends Cel  {
41
class NameImage extends Cel  {
Line 61... Line 42...
61
 
42
 
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 ";
43
	function getElement($uid){
75
	     
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
 
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');
89
		foreach ($tab_retour[$projet_photo] as $cle => $illustration) {
57
		
Line 99... Line 67...
99
						$abreviation = $match[1];
67
						$abreviation = $match[1];
100
						 $fichier = $match[2];
68
						 $fichier = $match[2];
101
				}
69
				}
102
			}
70
			}
Line 103... Line 71...
103
			
71
			
-
 
72
			if (isset($abreviation)) {			
-
 
73
		      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
-
 
74
		      	$url_max = $illustration['about'];
-
 
75
		      	
Line 104... Line -...
104
			if (isset($abreviation)) {
-
 
105
				
-
 
106
			      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
-
 
107
			      	$url_max = $illustration['about'];
-
 
108
			      	
-
 
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;
80
					break;
114
					}
-
 
115
			}
81
				}
Line 116... Line 82...
116
	
82
			}
-
 
83
		}
117
		}
84
		
-
 
85
		$output = json_encode($value);
118
		
86
		header("content-type: application/json");
Line 119... Line 87...
119
		$output = json_encode($value);
87
		print($output);
Line 120... Line 88...
120
		print($output);
88
		return true;
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