[Mapbender-commits] r8591 - trunk/mapbender/http/geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Mar 27 04:26:48 PDT 2013


Author: armin11
Date: 2013-03-27 04:26:48 -0700 (Wed, 27 Mar 2013)
New Revision: 8591

Modified:
   trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
Log:
Bugfix for INSPIRE Monitoring

Modified: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2013-03-26 15:07:44 UTC (rev 8590)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2013-03-27 11:26:48 UTC (rev 8591)
@@ -178,7 +178,9 @@
 		$serviceIndex = 0;	
 		$orgaIndex = 0;
 		$alreadyBuildDls = array();
+		$alreadBuildVs = array();
 		$alreadyReadOrgas = array();
+		$alreadBuildVs = array();
 		$currentUuid = "";
 		$inspireMonitoring = array(
 			"datasets" => array(),
@@ -223,57 +225,61 @@
 				if ($metadataIndex > -1) { //prohibit indexes which are not real - otherwise the json array will become an object
 					//build view service
 					$e = new mb_exception("resource type: ".$sqlTable['resource_type'][$i]." - uuid: ".$sqlTable['uuid'][$i]);
+					//build view services - but only once for each view service uuid (layer uuid)
 					if ($sqlTable['resource_type'][$i] == "layer") {
-						//addview view service
-						$inspireMonitoring['services'][$serviceIndex]->id = $sqlTable['resource_uuid'][$i];
-						//name
-						$inspireMonitoring['services'][$serviceIndex]->name = $sqlTable['service_title'][$i];
-						//typ
-						$inspireMonitoring['services'][$serviceIndex]->type = "Darstellungsdienst";
-						//url
-						$inspireMonitoring['services'][$serviceIndex]->url = MAPBENDER_PATH."/php/wms.php?layer_id=".$sqlTable['resource_id'][$i]."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&INSPIRE=1";
-						//orga
-						$inspireMonitoring['services'][$serviceIndex]->organization = $sqlTable['organization'][$i];
-						//orga email
-						$inspireMonitoring['services'][$serviceIndex]->orgaEmail = $sqlTable['orgaEmail'][$i];
-						//metadata exists
-						$inspireMonitoring['services'][$serviceIndex]->metadataExists = "[X]";
-						//service uuid - view/download difference
-						$inspireMonitoring['services'][$serviceIndex]->serviceUuid = $sqlTable['resource_uuid'][$i];
-						//metadata conform
-						$inspireMonitoring['services'][$serviceIndex]->metadataConform = "[X]";
-						//metadata available
-						$inspireMonitoring['services'][$serviceIndex]->metadataAvailable = "[X]";
-						//service conform
-						$inspireMonitoring['services'][$serviceIndex]->serviceConform = "[X]";
-						//requests per day
-						$inspireMonitoring['services'][$serviceIndex]->requestsPerDay = 0;
-						//comment
-						$inspireMonitoring['services'][$serviceIndex]->report = "";
-						//report
-						$inspireMonitoring['services'][$serviceIndex]->comment = "";
-						//get inspire categories					
-						$catString = $sqlTable['inspire_cat_monitoring'][$i];
-						$insCat .= $sqlTable['inspire_cat_monitoring'][$i];
-						if ($insCat != '') {
-							$insCat .= ",";
+						if (!in_array($sqlTable['resource_uuid'][$i],$alreadyBuildVs)) {
+							//addview view service
+							$inspireMonitoring['services'][$serviceIndex]->id = $sqlTable['resource_uuid'][$i];
+							//name
+							$inspireMonitoring['services'][$serviceIndex]->name = $sqlTable['service_title'][$i];
+							//typ
+							$inspireMonitoring['services'][$serviceIndex]->type = "Darstellungsdienst";
+							//url
+							$inspireMonitoring['services'][$serviceIndex]->url = MAPBENDER_PATH."/php/wms.php?layer_id=".$sqlTable['resource_id'][$i]."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&INSPIRE=1";
+							//orga
+							$inspireMonitoring['services'][$serviceIndex]->organization = $sqlTable['organization'][$i];
+							//orga email
+							$inspireMonitoring['services'][$serviceIndex]->orgaEmail = $sqlTable['orgaEmail'][$i];
+							//metadata exists
+							$inspireMonitoring['services'][$serviceIndex]->metadataExists = "[X]";
+							//service uuid - view/download difference
+							$inspireMonitoring['services'][$serviceIndex]->serviceUuid = $sqlTable['resource_uuid'][$i];
+							//metadata conform
+							$inspireMonitoring['services'][$serviceIndex]->metadataConform = "[X]";
+							//metadata available
+							$inspireMonitoring['services'][$serviceIndex]->metadataAvailable = "[X]";
+							//service conform
+							$inspireMonitoring['services'][$serviceIndex]->serviceConform = "[X]";
+							//requests per day
+							$inspireMonitoring['services'][$serviceIndex]->requestsPerDay = 0;
+							//comment
+							$inspireMonitoring['services'][$serviceIndex]->report = "";
+							//report
+							$inspireMonitoring['services'][$serviceIndex]->comment = "";
+							//get inspire categories					
+							$catString = $sqlTable['inspire_cat_monitoring'][$i];
+							$insCat .= $sqlTable['inspire_cat_monitoring'][$i];
+							if ($insCat != '') {
+								$insCat .= ",";
+							}
+							//increment amount of view services
+					
+							/*if ($sqlTable['inspire_download'][$i] == 1) {
+								//add further inspire_download service element for this layer
+								//increment amount of view services
+								$output['aaData'][$metadataIndex]->numberDownloadServices++;
+							}*/
+							$inspireMonitoring['datasets'][$metadataIndex]->numberViewServices++;
+							$serviceIndex++;
+							//Add view service to dataset list
+							$inspireMonitoring['datasets'][$metadataIndex]->viewServiceId = $sqlTable['resource_uuid'][$i];
+							$alreadyBuildVs[] = $sqlTable['resource_uuid'][$i];
 						}
-						//increment amount of view services
-					
-						/*if ($sqlTable['inspire_download'][$i] == 1) {
-							//add further inspire_download service element for this layer
-							//increment amount of view services
-							$output['aaData'][$metadataIndex]->numberDownloadServices++;
-						}*/
-						$inspireMonitoring['datasets'][$metadataIndex]->numberViewServices++;
-						$serviceIndex++;
-						//Add view service to dataset list
-						$inspireMonitoring['datasets'][$metadataIndex]->viewServiceId = $sqlTable['resource_uuid'][$i];
 						
 						
 					}
 					$e = new mb_exception("generate downloadservice");
-					if (!in_array($sqlTable['uuid'][$i],$alreadyBuildDls)) {
+					//if (!in_array($sqlTable['uuid'][$i],$alreadyBuildDls)) {
 						//initialize array of uuids which are already tested for downloadservices!
 						//the options are all the same for one single metadata uuid - therefor this has only to be done once for a uuid!
 						//the service information is pulled from the first organization - TODO - maybe change this?
@@ -291,7 +297,7 @@
 						}
 						if ($downloadOptions != null) {
 							$mdUuid = $sqlTable['uuid'][$i];
-							$alreadyBuildDls[] = $mdUuid;
+							//$alreadyBuildDls[] = $mdUuid;
 							foreach ($downloadOptions->{$mdUuid}->option as $option) {
 								//create download service entries
 								//create ids for download services on the fly
@@ -338,11 +344,12 @@
 								} else {
 									$dlsFileIdentifier = "no id found - please check if services have uuids or generate new ones!";
 								}
+								if (!in_array($dlsFileIdentifier,$alreadyBuildDls)) {
 								//generate the rest of the service element
 								//addview view service
 								$inspireMonitoring['services'][$serviceIndex]->id = $dlsFileIdentifier;
 								//name
-								$inspireMonitoring['services'][$serviceIndex]->name = $sqlTable['service_title'][$i];
+								$inspireMonitoring['services'][$serviceIndex]->name = "Downloadservice für ".$sqlTable['title'][$i];
 								//typ
 								$inspireMonitoring['services'][$serviceIndex]->type = "Download-Dienst";
 								//url
@@ -371,10 +378,12 @@
 								$serviceIndex++;
 								//add download service to dataset list
 								$inspireMonitoring['datasets'][$metadataIndex]->downloadServiceId = $dlsFileIdentifier; 
+								$alreadyBuildDls[] = $dlsFileIdentifier;
+								}
 
 							}
 						}
-					}
+					//}
 					$e = new mb_exception("generate organization entry");
 					if (!in_array($sqlTable['organization'][$i],$alreadyReadOrgas)) {
 						$alreadyReadOrgas[] = $sqlTable['organization'][$i];
@@ -466,7 +475,7 @@
 						$html .= $row;
 					}
 					header('Content-type: application/octetstream');
-					//header('Content-Length: ' . filesize($html));
+					header('Content-Length: ' . filesize($html));
 					header('Content-Disposition: attachment; filename="datasets.csv"'); 
 					echo $html;
 				break;
@@ -492,7 +501,7 @@
 						$html .= $row;
 					}
 					header('Content-type: application/octetstream');
-					//header('Content-Length: ' . filesize($html));
+					header('Content-Length: ' . filesize($html));
 					header('Content-Disposition: attachment; filename="services.csv"'); 
 					echo $html;
 				break;
@@ -507,7 +516,7 @@
 						$html .= $row;
 					}
 					header('Content-type: application/octetstream');
-					//header('Content-Length: ' . filesize($html));
+					header('Content-Length: ' . filesize($html));
 					header('Content-Disposition: attachment; filename="organizations.csv"'); 
 					echo $html;
 				break;



More information about the Mapbender_commits mailing list