Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 416 Rev 423
Line 130... Line 130...
130
				
130
				
131
			      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
131
			      	$url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);;
Line 132... Line 132...
132
			      	$url_max = $illustration['about'];
132
			      	$url_max = $illustration['about'];
-
 
133
			      	
133
			      	
134
					$value=array($url_miniature,$url_max);
134
					$value=array($url_miniature,$url_max);
135
					
135
				// Priorite aux images en png
136
					// Priorite aux images en png
136
					if (strstr($fichier, '.png')) {
137
					if (strstr($fichier, '.png')) {
137
						break;
138
						break;
Line 138... Line 139...
138
					}
139
					}
Line 139... Line -...
139
			}
-
 
140
	
140
			}
141
		}
141
	
142
		
142
		}
Line 143... Line 143...
143
		$json = new Services_JSON();
143
		
Line 152... Line 152...
152
		return  analyserFichierRdf($url);
152
		return  analyserFichierRdf($url);
153
}
153
}
Line 154... Line 154...
154
	
154
	
155
function analyserFichierRdf($chemin)
155
function analyserFichierRdf($chemin)
-
 
156
{
-
 
157
	$aso_info = array();
-
 
158
	$dom = new DOMDocument();
-
 
159
	$dom->validateOnParse = true;
-
 
160
	if (preg_match('/^http:\/\//', $chemin)) {
-
 
161
		@$dom->loadXML(file_get_contents($chemin));
-
 
162
	} else {
-
 
163
		@$dom->load($chemin);
Line 156... Line -...
156
{
-
 
Line 157... Line 164...
157
	
164
	}
-
 
165
	
158
	//print $chemin;
166
	
159
	
167
	$tab_infos = array();
-
 
168
	foreach ($dom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description') as $rdf_description) {
160
		$aso_info = array();
169
		$aso_info['about'] = $rdf_description->getAttribute('about');
-
 
170
		$aso_info['dc:identifier'] = $rdf_description->getAttribute('identifier');
-
 
171
		$aso_info['dc:title'] = utf8_decode($rdf_description->getAttribute('title'));
161
		$dom = new DOMDocument();
172
		$aso_info['dc:creator'] = utf8_decode($rdf_description->getAttribute('creator'));
-
 
173
		$aso_info['dc:contributor'] = utf8_decode($rdf_description->getAttribute('contributor'));
162
		$dom->validateOnParse = true;
174
		$aso_info['dc:publisher'] = utf8_decode($rdf_description->getAttribute('publisher'));
163
		if (preg_match('/^http:\/\//', $chemin)) {
175
		$aso_info['dc:type'] = utf8_decode($rdf_description->getAttribute('type'));
164
			@$dom->loadXML(file_get_contents($chemin));
176
		$aso_info['dc:format'] = utf8_decode($rdf_description->getAttribute('format'));
165
		} else {
-
 
166
			@$dom->load($chemin);
-
 
167
		}
-
 
168
		
-
 
169
		
-
 
170
		$tab_infos = array();
-
 
171
		foreach ($dom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description') as $rdf_description) {
-
 
172
			$aso_info['about'] = $rdf_description->getAttribute('about');
-
 
173
			$aso_info['dc:identifier'] = $rdf_description->getAttribute('identifier');
-
 
174
			$aso_info['dc:title'] = utf8_decode($rdf_description->getAttribute('title'));
-
 
175
			$aso_info['dc:creator'] = utf8_decode($rdf_description->getAttribute('creator'));
-
 
176
			$aso_info['dc:contributor'] = utf8_decode($rdf_description->getAttribute('contributor'));
-
 
177
			$aso_info['dc:publisher'] = utf8_decode($rdf_description->getAttribute('publisher'));
-
 
178
			$aso_info['dc:type'] = utf8_decode($rdf_description->getAttribute('type'));
-
 
179
			$aso_info['dc:format'] = utf8_decode($rdf_description->getAttribute('format'));
-
 
180
			if (function_exists('date_default_timezone_set')) {
177
		if (function_exists('date_default_timezone_set')) {
181
				date_default_timezone_set('Europe/Paris');
178
			date_default_timezone_set('Europe/Paris');
182
			}
179
		}
183
			if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $rdf_description->getAttribute('created'))) {
180
		if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $rdf_description->getAttribute('created'))) {
184
				$aso_info['dcterms:created'] = date('j-m-Y � H:i:s', strtotime($rdf_description->getAttribute('created')));				
-
 
185
			} else {
-
 
186
				$aso_info['dcterms:created'] = $rdf_description->getAttribute('created');
-
 
187
			}
-
 
188
			$aso_info['dcterms:dateSubmitted'] = utf8_decode($rdf_description->getAttribute('dateSubmitted'));
-
 
189
			$aso_info['dcterms:spatial'] = utf8_decode($rdf_description->getAttribute('spatial'));
181
			$aso_info['dcterms:created'] = date('j-m-Y � H:i:s', strtotime($rdf_description->getAttribute('created')));				
-
 
182
		} else {
-
 
183
			$aso_info['dcterms:created'] = $rdf_description->getAttribute('created');
-
 
184
		}
190
			$aso_info['dcterms:licence'] = utf8_decode($rdf_description->getAttribute('licence'));
185
		$aso_info['dcterms:dateSubmitted'] = utf8_decode($rdf_description->getAttribute('dateSubmitted'));
191
			$tab_infos[$rdf_description->getAttribute('identifier')] = $aso_info; 
186
		$aso_info['dcterms:spatial'] = utf8_decode($rdf_description->getAttribute('spatial'));
Line 192... Line -...
192
		}
-
 
193
		//echo '<pre>'.$chemin.print_r($tab_infos, true).'</pre>';
187
		$aso_info['dcterms:licence'] = utf8_decode($rdf_description->getAttribute('licence'));
194
 
188
		$tab_infos[$rdf_description->getAttribute('identifier')] = $aso_info; 
Line 195... Line 189...
195
		
189
	}
196
		//print_r($tab_infos);
190