[Mapbender-commits] r9455 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu May 12 03:21:44 PDT 2016


Author: armin11
Date: 2016-05-12 03:21:44 -0700 (Thu, 12 May 2016)
New Revision: 9455

Modified:
   trunk/mapbender/http/classes/class_metadata_new.php
Log:
fix for dataset search

Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php	2016-05-12 10:20:19 UTC (rev 9454)
+++ trunk/mapbender/http/classes/class_metadata_new.php	2016-05-12 10:21:44 UTC (rev 9455)
@@ -480,26 +480,31 @@
 				//}
 				#if (isset($wfsMatrix[$i]['custom_categories'])) {
 				#}
-				//if modul hasn't been created - do it
-				if (!isset($this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul)) {	
-					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul = array();
+				//check if module is given
+				if (isset($wfsMatrix[$i]['wfs_conf_id']) && $wfsMatrix[$i]['wfs_conf_id'] != "") {
+				
+					//if modul hasn't been created - do it
+				
+					if (!isset($this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul)) {	
+						$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul = array();
+					}
+					//fill in modul infos
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->id = $wfsMatrix[$i]['wfs_conf_id'];	
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->title = $wfsMatrix[$i]['wfs_conf_description'];	
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->abstract = $wfsMatrix[$i]['wfs_conf_abstract'];
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->type = $wfsMatrix[$i]['modultype'];
+					$equalEPSG = $wfsMatrix[$i]['featuretype_srs'];
+                       			$isEqual = true;
+					//control if EPSG is supported by Client
+		        		if ($equalEPSG == $this->searchEPSG){
+						$isEqual = false;		
+		        		}	
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->srsProblem = $isEqual;
+					//generate Link to show metadata
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?resource=featuretype&id=".$wfsMatrix[$i]['featuretype_id'];
+					$perText = $this->getPermissionValueForWFS($wfsMatrix[$i]['wfs_id'], $wfsMatrix[$i]['wfs_conf_id']);
+					$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->permission = $perText;
 				}
-				//fill in modul infos
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->id = $wfsMatrix[$i]['wfs_conf_id'];	
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->title = $wfsMatrix[$i]['wfs_conf_description'];	
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->abstract = $wfsMatrix[$i]['wfs_conf_abstract'];
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->type = $wfsMatrix[$i]['modultype'];
-				$equalEPSG = $wfsMatrix[$i]['featuretype_srs'];
-                       		$isEqual = true;
-				//control if EPSG is supported by Client
-		        	if ($equalEPSG == $this->searchEPSG){
-					$isEqual = false;		
-		        	}	
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->srsProblem = $isEqual;
-				//generate Link to show metadata
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?resource=featuretype&id=".$wfsMatrix[$i]['featuretype_id'];
-				$perText = $this->getPermissionValueForWFS($wfsMatrix[$i]['wfs_id'], $wfsMatrix[$i]['wfs_conf_id']);
-				$this->wfsJSON->wfs->srv[$i-$j]->ftype[$l-$m]->modul[$m]->permission = $perText;
 				if ($wfsMatrix[$i]['wfs_id'] == $wfsMatrix[$i+1]['wfs_id']){
 					$j++; //next record is the same service
 					$l++;	
@@ -694,7 +699,16 @@
 				$featuretypeCount = 0;
 				foreach ($this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype as $ft) {
 					//$e = new mb_exception($ft->id ." in service:  ". $featuretypeSearchArray[$ft->id]);
-					$this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->srv = json_decode($coupledFeaturetypes->internalResult)->wfs->srv[$featuretypeSearchArray[$featuretype->id]];
+					$this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->srv = json_decode($coupledFeaturetypes->internalResult)->wfs->srv[$featuretypeSearchArray[$ft->id]];
+					//delete all featuretypes that have not same id as ft->id
+					$cntFtype = 0;
+					foreach($this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->srv->ftype as $ftype) {
+						//$e = new mb_exception("classes/class_metadata_new.php: compare featuretype ids: ".$ftype->id." - ".$ft->id);
+						if ($ftype->id !== $ft->id) {
+							$this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->srv->ftype[$cntFtype] = null;	
+						}
+						$cntFtype++;
+					}
 					$featuretypeCount++;
 				}
 				//check for atom feed entry



More information about the Mapbender_commits mailing list