[Mapbender-commits] r7329 - in trunk/mapbender/http: classes
geoportal php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Dec 17 07:01:51 EST 2010
Author: armin11
Date: 2010-12-17 04:01:51 -0800 (Fri, 17 Dec 2010)
New Revision: 7329
Added:
trunk/mapbender/http/geoportal/gaz.php
trunk/mapbender/http/geoportal/gaz_geom.php
trunk/mapbender/http/geoportal/gaz_wiki.php
trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php
trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php
Modified:
trunk/mapbender/http/classes/class_metadata_new.php
trunk/mapbender/http/php/mod_callMetadata.php
Log:
Some modules from the geoportal.rlp project
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2010-12-17 11:28:38 UTC (rev 7328)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -811,6 +811,7 @@
$isTextSearch = "false";
$e = new mb_exception("Number of used searchstrings: ".count($searchStringArray));
//textsearch
+
if ($this->searchText != NULL) {
for($i=0; $i < count($searchStringArray); $i++){
$isTextSearch = "true";
@@ -822,7 +823,7 @@
$e = new mb_notice("Part of string".$i.": ".$searchStringArray[$i]);
$e = new mb_notice("converted: ".$this->replaceChars_all($searchStringArray[$i]));
$va = "%".trim(strtoupper($this->replaceChars_all($searchStringArray[$i])))."%";
- $e = new mb_notice($this->searchResources." Searchtext in SQL: ".$va);
+ $e = new mb_exception($this->searchResources." Searchtext in SQL: ".$va);
array_push($v,$va);
array_push($t,"s");
}
@@ -1430,6 +1431,7 @@
private function generateSearchStringArray() {
//'wfs test array' -> ('wfs' 'test' 'array')
$asstr = array();
+
if ($this->searchText != "false"){
$asstr = split(",",$this->searchText);
//delete left and right whitespaces
@@ -1437,7 +1439,15 @@
$asstr[$i]=ltrim($asstr[$i]);
$asstr[$i]=rtrim($asstr[$i]);
}
+ } else {
+ $asstr[0]='%';
}
+ //check for single wildcard search
+ $e = new mb_exception('class_metadata_new: searchText: '.$this->searchText);
+ if ((count($asstr) == 1) && (($asstr[0]=='*') || ($asstr[0]==='false'))) {
+ $asstr[0]='%';
+ }
+ $e = new mb_exception('class_metadata_new: asstr[0]: '.$asstr[0]);
return $asstr;
}
Added: trunk/mapbender/http/geoportal/gaz.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz.php (rev 0)
+++ trunk/mapbender/http/geoportal/gaz.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -0,0 +1,145 @@
+<?php
+#
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#Function to wrap the search criteria from the portal search and distribute them to the different search moduls:
+#Gazetteer Modul: gaz_geom.php
+#wiki Modul: gaz_wiki.php
+#OpenSearch Modul: mod_readOpenSearchResults.php
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once("/data/mapbender/http/classes/class_mb_exception.php");
+$n = new mb_exception("-- gaz.php was invoked--");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$resdir = RESULT_DIR;
+//exception wrapper
+function throwE($t){
+ $e = new mb_exception("portal search: ".$t."!");
+}
+
+(isset($_SERVER["argv"][1]))? ($userId = $_SERVER["argv"][1]) : (throwE('userId lacks ...'));
+(isset($_SERVER["argv"][2]))? ($searchId = $_SERVER["argv"][2]) : (throwE('searchId lacks ...'));
+(isset($_SERVER["argv"][3]))? ($searchText = $_SERVER["argv"][3]) : (throwE('searchText lacks ...'));
+(isset($_SERVER["argv"][4]))? ($searchEPSG = $_SERVER["argv"][4]) : (throwE('searchEPSG lacks ...'));
+(isset($_SERVER["argv"][5]))? ($registratingDepartments = $_SERVER["argv"][5]) : (throwE('registratingDepartments lacks ...'));
+(isset($_SERVER["argv"][6]))? ($isoCategories = $_SERVER["argv"][6]) : (throwE('isoCategories lacks ...'));
+(isset($_SERVER["argv"][7]))? ($regTimeBegin = $_SERVER["argv"][7]) : (throwE('regTimeBegin lacks ...'));
+(isset($_SERVER["argv"][8]))? ($regTimeEnd = $_SERVER["argv"][8]) : (throwE('regTimeEnd lacks ...'));
+(isset($_SERVER["argv"][9]))? ($searchBbox = $_SERVER["argv"][9]) : (throwE('searchBbox lacks ...'));
+(isset($_SERVER["argv"][10]))? ($searchTypeBbox = $_SERVER["argv"][10]) : (throwE('searchTypeBbox lacks ...'));
+(isset($_SERVER["argv"][11]))? ($searchResources = $_SERVER["argv"][11]) : (throwE('searchResources lacks ...'));
+(isset($_SERVER["argv"][12]))? ($timeBegin= $_SERVER["argv"][12]) : (throwE('timeBegin lacks ...'));
+(isset($_SERVER["argv"][13]))? ($timeEnd = $_SERVER["argv"][13]) : (throwE('timeEnd lacks ...'));
+(isset($_SERVER["argv"][14]))? ($orderBy = $_SERVER["argv"][14]) : (throwE('orderBy lacks ...'));
+
+//define standard searchEPSG if the client has not yet been initialized - therefor the needed EPSG is not known
+if(!isset($searchEPSG) || $searchEPSG = '' || empty($searchEPSG)){$searchEPSG = "EPSG:31466";}
+else{$searchEPSG = $_SERVER["argv"][4];}
+
+//if the searchText has more than one element the commas has to be exchanged by plus -> opensearch!
+
+$searchTextOS = str_replace(",","+",$searchText);
+if ($searchTextOS ==='false' || $searchTextOS ==='*'){
+ $searchTextOS = '1';
+}
+
+$openSearchFilter = "";
+//generate portalu search filter:
+//needed filter criteria:
+//1. searchText - anyText Field
+//2. isoCategories
+//3. regTimeBegin
+//4. regTimeEnd
+//5. searchBbox
+//6. searchTypeBbox
+//7. timeBegin
+//8. timeEnd
+//9. orderBy
+//check if orderBy is set
+//
+if (isset($regTimeBegin) & ($regTimeBegin != 'false')){
+ $openSearchFilter .= "+t1:".$regTimeBegin;
+}
+if (isset($regTimeEnd) & ($regTimeEnd != 'false')){
+ $openSearchFilter .= "+t2:".$regTimeEnd;
+}
+if (isset($searchBbox) & ($searchBbox != 'false')){
+ //parse bbox
+ $spatialFilterCoords = explode(',',$searchBbox);
+ //definition of the spatial filter
+ $openSearchFilter .= "+x1:".$spatialFilterCoords[0];
+ $openSearchFilter .= "+x2:".$spatialFilterCoords[2];
+ $openSearchFilter .= "+y1:".$spatialFilterCoords[1];
+ $openSearchFilter .= "+y2:".$spatialFilterCoords[3];
+}
+if (isset($searchTypeBbox) & ($searchTypeBbox != 'false')){
+ #if ($searchTypeBbox == 'intersects') {
+ # $openSearchFilter .= "+coord:intersect";
+ #}
+ #if ($searchTypeBbox == 'outside') {
+ # $openSearchFilter .= "+coord:include";
+ #}
+ if ($searchTypeBbox == 'inside') {
+ $openSearchFilter .= "+coord:inside";
+ }
+
+}
+if (isset($orderBy) & ($orderBy != 'false')){
+ #if ($searchTypeBbox == 'intersects') {
+ # $openSearchFilter .= "+coord:intersect";
+ #}
+ #if ($searchTypeBbox == 'outside') {
+ # $openSearchFilter .= "+coord:include";
+ #}
+ if ($orderBy == 'rank') {
+ $openSearchFilter .= "+ranking:score";
+ }
+ if ($orderBy == 'date') {
+ $openSearchFilter .= "+ranking:date";
+ }
+
+} else {
+ $openSearchFilter .= "+ranking:score";
+}
+
+$searchTextOS .= $openSearchFilter;
+// check if some extended is requested - in the old version this is defined by one parameter. The new interface would not distinguish between this two kind of search cases. Every search is a also an extented search. See mod_callMetadata.php
+
+
+
+
+
+
+#Geometry search:
+$exec = "php5 /data/mapbender/http/geoportal/gaz_geom.php '".$userId."' '".$searchText."' '".$searchEPSG."' > ".$resdir."/".$searchId."_geom.xml &";
+exec($exec);
+
+#wiki search:
+$exec = "php5 /data/mapbender/http/geoportal/gaz_wiki.php '".$searchText."' > ".$resdir."/".$searchId."_wiki.xml &";
+exec($exec);
+
+#OpenSearch Search over distributed instances of Portal-U - configuration in mapbender database
+$exec = "php5 /data/mapbender/http/geoportal/mod_readOpenSearchResults.php '".$searchId."' '".$searchTextOS."' > ".$resdir."/request_".$id."_opensearch.xml &";
+//$exec = "php5 /data/mapbender/http/x_geoportal/mod_readOpenSearchResults.php '".$searchId."' '".$searchTextOS."' '+t1:2006-05-01+t2:2010-07-01' > ".$resdir."/request_".$id."_opensearch.xml &";
+
+exec($exec);
+
+?>
Added: trunk/mapbender/http/geoportal/gaz_geom.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_geom.php (rev 0)
+++ trunk/mapbender/http/geoportal/gaz_geom.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -0,0 +1,649 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/gaz_service.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+(isset($_SERVER["argv"][1]))? ($user_id = $_SERVER["argv"][1]) : ($e = new mb_exception("geom: user lacks!"));
+(isset($_SERVER["argv"][2]))? ($sstr = $_SERVER["argv"][2]) : ($e = new mb_exception("geom: string lacks!"));
+(isset($_SERVER["argv"][3]))? ($epsg = $_SERVER["argv"][3]) : ($e = new mb_exception("geom: epsg lacks!"));
+
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+
+$con = pg_connect("host=".GEOMDB_HOST." port=".GEOMDB_PORT." dbname=".GEOMDB_NAME." user=".GEOMDB_USER." password=".GEOMDB_PASSWORD)
+or die('Verbindungsaufbau fehlgeschlagen: ' . pg_last_error());
+
+function replaceChars($text){
+ $search = array( "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß","tr." );
+ $repwith = array("ae", "oe", "ue", "AE", "OE", "UE", "ss","tr");
+
+ if(CHARSET=="UTF-8")
+ $text = utf8_decode($text);
+
+ $ret = str_replace($search, $repwith, $text);
+
+ if(CHARSET=="UTF-8")
+ $ret = utf8_encode($ret);
+
+ return $ret;
+}
+/******* conf ***********************************/
+$factor = 1;
+if (intval($epsg) == 4326) $factor = 0.00001;
+/******* wohnplätze *******************/
+$bufferWP = 1000*$factor;
+$arrayWP = array();
+$arrayWPKey = array();
+
+/******* gemeinde *********************/
+$bufferG = 100*$factor;
+$arrayG = array();
+$toleranceG = 100*$factor;
+
+/******* kreis *********************/
+$bufferK = 100*$factor;
+$arrayK = array();
+$toleranceK = 1000*$factor;
+/******* verbandsgemeinde *********************/
+$bufferV = 100*$factor;
+$arrayV = array();
+$toleranceV = 1000*$factor;
+/******* strasse *********************/
+$bufferSTR = 100*$factor;
+$arraySTR = array();
+$toleranceSTR = 100*$factor;
+/******* Strasse / Hsnr ****************/
+$bufferSH = 100*$factor;
+$arraySH = array();
+$toleranceSH = 1000*$factor;
+
+/****** Workflow *********************************/
+/**/
+$astr = split(",",replaceChars($sstr));
+if(count($astr) == 1){
+ $astr[0] = trim($astr[0]);
+ $plz = getPlz($astr[0]);
+ $hsnr = getNr($astr[0]);
+ if($plz != false){
+ //checkSize($astr[0]);
+ checkWP($plz, strtoupper(getCity($astr[0])));
+ checkGfromWP();
+ }
+ else if($hsnr != false){
+
+ }
+ else if($hsnr == false && $plz == false){
+ checkWP(false,strtoupper($astr[0]));
+ checkG(strtoupper($astr[0]));
+ checkGfromWP();
+ checkK(strtoupper($astr[0]));
+ checkVg($astr[0]);
+ }
+}
+else if(count($astr) == 2){
+ $astr[0] = trim($astr[0]);
+ $astr[1] = trim($astr[1]);
+ $ckeys = array();
+ $cnames = array();
+ $cmissing = array();
+
+ $myplz = false;
+ $mycity = false;
+ $mystr = false;
+ $mynr = false;
+ $myzs = false;
+ $both = array();
+
+ // 1.
+ if(getPlz($astr[0])){
+ $myplz = getPlz($astr[0]);
+ if(getNr($astr[1])){
+ $mynr = getNr($astr[1]);
+ $myzs = getAppendix($astr[1]);
+ $mystr = getStrn($astr[1]);
+ }
+ else{
+ $mystr = trim($astr[1]);
+ }
+ }
+ else if(getNr($astr[0])){
+ $mynr = getNr($astr[0]);
+ $myzs = getAppendix($astr[0]);
+ $mystr = getStrn($astr[0]);
+ if(getPlz($astr[1])){
+ $myplz = getPlz($astr[1]);
+ }
+ else{
+ $mycity = trim($astr[1]);
+ }
+ }
+ else{
+ if(getPlz($astr[1])){
+ $myplz = getPlz($astr[1]);
+ }
+ if(getNr($astr[1])){
+ $mynr = getNr($astr[1]);
+ $myzs = getAppendix($astr[1]);
+ $mystr = getStrn($astr[1]);
+ $mycity = getCity($astr[0]);
+ }
+ else{
+ array_push($both,$astr[0]);
+ array_push($both,$astr[1]);
+ }
+ }
+ // workflow
+ if(count($both) == 2){
+ $a = "%".strtoupper(trim($both[0]))."%";
+ $b = "%".strtoupper(trim($both[1]))."%";
+ $v = array($a, $a);
+ $t = array('s', 's');
+ $sql = "SELECT DISTINCT * FROM (SELECT DISTINCT gem_schl_neu, gemeinde AS gem FROM gis.verwaltungseinheit ";
+ $sql .= "WHERE gemeinde_upper LIKE $1";
+ $sql .= "UNION SELECT DISTINCT gem_schl_neu, gemeinde_gem_teile AS gem FROM gis.wohnplatz ";
+ $sql .= "WHERE gemeinde_gem_teile_upper LIKE $2) AS str";
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($ckeys, $row['gem_schl_neu']);
+ array_push($cnames, encode($row['gem']));
+ array_push($cmissing, $b);
+ }
+ $v = array($b, $b);
+ $t = array('s', 's');
+ $sql = "SELECT DISTINCT * FROM (SELECT DISTINCT gem_schl_neu, gemeinde AS gem FROM gis.verwaltungseinheit ";
+ $sql .= "WHERE gemeinde_upper LIKE $1";
+ $sql .= "UNION SELECT DISTINCT gem_schl_neu, gemeinde_gem_teile AS gem FROM gis.wohnplatz ";
+ $sql .= "WHERE gemeinde_gem_teile_upper LIKE $2) AS str";
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($ckeys, $row['gem_schl_neu']);
+ array_push($cnames, encode($row['gem']));
+ array_push($cmissing, $a);
+ }
+
+ if(count($ckeys)>0){
+ for($i=0; $i<count($ckeys); $i++){
+
+ $v = array($ckeys[$i], $cmissing[$i]);
+ $t = array('i', 's');
+ $sql = "SELECT DISTINCT str_name_ewois, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(the_geom) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferSH.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferSH.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferSH.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferSH.") as maxy ";
+ $sql .= "FROM gis.strassenschluessel WHERE gem_schl = $1 ";
+ $sql .= " AND (str_name_ewois_upper LIKE $2)";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ $show = encode($row["str_name_ewois"])." ".$cnames[$i];
+ stack_it($arraySTR,"str",$show,"str",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+ }
+
+ }
+ }
+ else{
+// echo $myplz ."#";
+// echo $mycity ."#";
+// echo $mystr ."#";
+// echo $mynr ."#";
+// echo $myzs ."#";
+// print_r($both);
+ checkSH($mystr,$mynr,$myzs,$myplz,$mycity);
+ }
+}
+
+
+
+//$fillSH = checkSH("Akazienweg",30,false,56075,"Koblenz");
+
+xml_output();
+
+function checkMinLength($str) {
+ if (strlen($str) < 3) {
+ //errorOutput();
+ null_output();
+ die();
+ }
+}
+//Strasse Hausnummer
+function checkSH($s,$h,$z,$p,$o){
+ global $bufferSH, $arraySH, $epsg;
+
+ if ($o && $s) {
+ $str_schl = array();
+ $str_schl_gem = array();
+ $ckeys = array();
+ $cnames = array();
+ $a = "%".strtoupper(trim($o))."%";
+ $v = array($a, $a);
+ $t = array('s', 's');
+ $sql = "SELECT DISTINCT * FROM (SELECT DISTINCT gem_schl_neu, gemeinde AS gem FROM gis.verwaltungseinheit ";
+ $sql .= "WHERE gemeinde_upper LIKE $1";
+ $sql .= "UNION SELECT DISTINCT gem_schl_neu, gemeinde_gem_teile AS gem FROM gis.wohnplatz ";
+ $sql .= "WHERE gemeinde_gem_teile_upper LIKE $2) AS str";
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($ckeys, $row['gem_schl_neu']);
+ array_push($cnames, $row['gem']);
+ }
+
+ if(count($ckeys)>0){
+ for($i=0; $i<count($ckeys); $i++){
+
+ $v = array($ckeys[$i], "%". strtoupper(trim($s)). "%");
+ $t = array('i', 's');
+ $sql = "SELECT DISTINCT str_schl_alt ";
+ $sql .= "FROM gis.strassenschluessel WHERE gem_schl = $1 ";
+ $sql .= " AND str_name_ewois_upper ILIKE $2";
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($str_schl, $row['str_schl_alt']);
+ array_push($str_schl_gem, $cnames[$i]);
+ }
+ }
+ if (count($str_schl > 0)) {
+ $v = array($h);
+ $t = array('i');
+ $sql = "SELECT DISTINCT name, hausnummer, zusatz, plz, post_ortsname, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(the_geom) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferSH.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferSH.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferSH.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferSH.") as maxy ";
+ $sql .= "FROM gis.hauskoordinaten ";
+ $sql .= "WHERE hausnummer = $1 AND strschl IN (";
+
+ for($i=0; $i<count($str_schl); $i++){
+ if($i > 0){$sql .= ",";}
+ $sql .= "$".($i+2);
+ array_push($v,$str_schl[$i]);
+ array_push($t,'i');
+ }
+ $sql .= ")";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+
+
+#$show = $row["name"]." ".$row["hausnummer"];
+ if($row["zusatz"] != 'null'){
+ # $show .= $row["zusatz"];
+
+$show = $row["name"]." ".$row["hausnummer"].$row["zusatz"];
+}
+ else
+{$show = $row["name"]." ".$row["hausnummer"];}
+ $show .= ", " . $row["plz"]. " " . $row["post_ortsname"];
+
+
+ stack_it($arraySH,"haus",$show,"sh",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+ }
+ }
+
+ }
+ else {
+ //is this 'else' obsolete?
+ $sql = "SELECT DISTINCT name, hausnummer, zusatz, plz, post_ortsname, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(the_geom) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferSH.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferSH.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferSH.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferSH.") as maxy ";
+ $sql .= "FROM gis.hauskoordinaten ";
+ $sql .= "WHERE name ILIKE $1 AND hausnummer = $2 ";
+ $v = array("%".$s."%",$h);
+ $t = array('s','i');
+ if($z){
+ $sql .= "AND zusatz = $" . (count($v)+1);
+ array_push($v,$z);
+ array_push($t,'s');
+ }
+ if($p){
+ $sql .= "AND plz = $" . (count($v)+1);
+ array_push($v,$p);
+ array_push($t,'i');
+ }
+ if($o){
+ $sql .= "AND post_ortsname ILIKE $" . (count($v)+1);
+ array_push($v,"%".$o."%");
+ array_push($t,'s');
+ }
+ #$sql .= " GROUP BY the_geom, name, hausnummer, zusatz, plz, post_ortsname";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+
+ $show = $row["name"]." ".$row["hausnummer"];
+ if($row["zusatz"] != null){
+ $show .= $row["zusatz"];
+ }
+ $show .= ", " . $row["plz"]. " " . $row["post_ortsname"];
+ stack_it($arraySH,"haus",$show,"sh",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+ }
+ return true;
+}
+//Wohnplatz
+function checkWP($plz,$name){
+ global $bufferWP, $arrayWP, $arrayWPKey, $epsg;
+ $v = array();
+ $t = array();
+ checkMinLength($name);
+ $sql = "SELECT DISTINCT gemeinde_gem_teile, gem_schl_neu, postleitzahl,";
+ $sql .= "SRID(the_geom) AS srid, AsGML(the_geom) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferWP.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferWP.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferWP.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferWP.") as maxy ";
+ $sql .= "FROM gis.wohnplatz WHERE ";
+ if($plz == false){
+ $sql .= "gemeinde_gem_teile_upper ILIKE $1 ";
+ array_push($v,"%".$name."%");
+ array_push($t,'s');
+ }
+ else if($name == false){
+ $sql .= "postleitzahl = $1 ";
+ array_push($v,$plz);
+ array_push($t,'i');
+ }
+ else{
+ $sql .= "postleitzahl = $1 AND gemeinde_gem_teile_upper ILIKE $2 ";
+ array_push($v,$plz);
+ array_push($t,'i');
+ array_push($v,"%".$name."%");
+ array_push($t,'s');
+ }
+ $sql .= "GROUP BY the_geom, gemeinde_gem_teile, gem_schl_neu, postleitzahl";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ $show = encode($row["gemeinde_gem_teile"]);
+ $show.= " (Wohnplatz)";
+ if(intval($row['postleitzahl'])> 1){ $show .= " (".$row['postleitzahl'].")"; }
+ stack_it($arrayWP,"wohnplatz",$show,"wp",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ if(!in_array($row["gem_schl_neu"],$arrayWPKey)){
+ array_push($arrayWPKey,$row["gem_schl_neu"]);
+ }
+ }
+ return true;
+}
+function checkGfromWP(){
+ global $arrayWPKey, $bufferG, $arrayG, $toleranceG, $epsg;
+ if(count($arrayWPKey) == 0){
+ return false;
+ }
+ $v = array();
+ $t = array();
+ $sql = "SELECT DISTINCT gemeinde, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(Simplify(the_geom,$toleranceG)) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferG.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferG.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferG.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferG.") as maxy ";
+ $sql .= "FROM gis.verwaltungseinheit WHERE gem_schl_neu IN(";
+ for($i=0; $i<count($arrayWPKey); $i++){
+ if($i > 0){$sql .= ",";}
+ $sql .= "$".($i+1);
+ array_push($v,$arrayWPKey[$i]);
+ array_push($t,'i');
+ }
+ $sql .= ") GROUP BY the_geom, gemeinde";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ stack_it($arrayG,"gemeinde",encode($row["gemeinde"]." (Wohnplatz)"),"g",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+}
+function checkG($str){
+ global $bufferG, $arrayG, $toleranceG, $arrayWPKey, $epsg;
+ checkMinLength($str);
+ $tmp = array();
+ $sql = "SELECT DISTINCT gemeinde, gem_schl_neu, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(Simplify(the_geom,$toleranceG)) AS gml ,";
+ $sql .= "(xmin(the_geom) - ".$bufferG.") as minx, ";
+ $sql .= "(ymin(the_geom) - ".$bufferG.") as miny, ";
+ $sql .= "(xmax(the_geom) + ".$bufferG.") as maxx, ";
+ $sql .= "(ymax(the_geom) + ".$bufferG.") as maxy ";
+ $sql .= "FROM gis.verwaltungseinheit WHERE gemeinde_upper ILIKE $1 ";
+ #$sql .= "GROUP BY the_geom, gemeinde, gem_schl_neu";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $v = array("%".$str."%");
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ stack_it($arrayG,"gemeinde",encode($row["gemeinde"]." (Gemeinde)"),"g",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ $tmp[count($tmp)] = $row["gem_schl_neu"];
+ }
+ $arrayWPKey = array_diff($arrayWPKey,$tmp);
+}
+
+function checkK($str){
+ global $bufferK, $arrayK, $toleranceK, $epsg;
+ checkMinLength($str);
+ $sql = "SELECT DISTINCT kreis, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(Simplify(the_geom,".$toleranceK.")) AS gml ,";
+ $sql .= "(xmin(the_geom)-".$bufferK.") as minx, ";
+ $sql .= "(ymin(the_geom)-".$bufferK.") as miny, ";
+ $sql .= "(xmax(the_geom)+".$bufferK.") as maxx, ";
+ $sql .= "(ymax(the_geom)+".$bufferK.") as maxy ";
+ $sql .= "FROM gis.kreis_pl WHERE kreis_upper ILIKE $1 ";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $v = array("%".$str."%");
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ stack_it($arrayK,"kreis",encode($row["kreis"]." (Landkreis)"),"k",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+}
+function checkVg($str){
+ global $bufferV, $arrayV, $toleranceV, $epsg;
+ checkMinLength($str);
+ $sql = "SELECT DISTINCT vg, ";
+ $sql .= "SRID(the_geom) AS srid, AsGML(Simplify(the_geom,".$toleranceV.")) AS gml ,";
+ $sql .= "(xmin(the_geom)-".$bufferV.") as minx, ";
+ $sql .= "(ymin(the_geom)-".$bufferV.") as miny, ";
+ $sql .= "(xmax(the_geom)+".$bufferV.") as maxx, ";
+ $sql .= "(ymax(the_geom)+".$bufferV.") as maxy ";
+ $sql .= "FROM gis.vg_fl WHERE vg ILIKE $1 ";
+ if (isset($epsg) && is_numeric($epsg) && intval($epsg) != 31466) {
+ $sql = str_replace("the_geom", "transform(the_geom,".$epsg.")", $sql);
+ }
+ $v = array("%".$str."%");
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ stack_it($arrayV,"verbandsgemeinde",encode($row["vg"]." (Verbandsgemeinde)"),"vg",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
+ }
+}
+function stack_it(&$stack,$category,$showtitle,$prefix,$srid,$minx,$miny,$maxx,$maxy,$gml){
+ $doc = new DOMDocument();
+ $member = $doc->createElement("member");
+ $doc->appendChild($member);
+ $member->setAttribute('id',$prefix.count($stack));
+ $fc = $doc->createElement("FeatureCollection");
+ $member->appendChild($fc);
+ $fc->setAttribute("xmlns:gml","http://www.opengis.net/gml");
+ $bb = $doc->createElement("boundedBy");
+ $fc->appendChild($bb);
+ $box = $doc->createElement("Box");
+ $bb->appendChild($box);
+ $box->setAttribute('srsName',"EPSG:".$srid);
+ $c = $doc->createElement("coordinates");
+ $box->appendChild($c);
+ $coords = $doc->createTextNode($minx.",".$miny." ".$maxx.",".$maxy);
+ $c->appendChild($coords);
+ $fm = $doc->createElement("featureMember");
+ $fc->appendChild($fm);
+ $wp = $doc->createElement($category);
+ $fm->appendChild($wp);
+ $title = $doc->createElement("title");
+ $wp->appendChild($title);
+ $ttitle = $doc->createTextNode($showtitle);
+ $title->appendChild($ttitle);
+ $geom = $doc->createElement("the_geom");
+ $wp->appendChild($geom);
+ $myNode = @simplexml_load_string($gml);
+ $mySNode = dom_import_simplexml($myNode);
+ $domNode = $doc->importNode($mySNode, true);
+ $geom->appendChild($domNode);
+ array_push($stack,$member);
+}
+
+function null_output(){
+ global $sstr, $arrayWP, $arrayG, $arrayK, $arraySH, $arraySTR, $arrayV;
+ $doc = new DOMDocument('1.0');
+ $doc->encoding = CHARSET;
+ $result = $doc->createElement("result");
+ $doc->appendChild($result);
+ $ready = $doc->createElement('ready');
+ $result->appendChild($ready);
+ $tready = $doc->createTextNode("true");
+ $ready->appendChild($tready);
+ echo $doc->saveXML();
+}
+
+
+
+
+
+
+function xml_output(){
+ global $sstr, $arrayWP, $arrayG, $arrayK, $arraySH, $arraySTR, $arrayV;
+ $doc = new DOMDocument('1.0');
+ $doc->encoding = CHARSET;
+ $result = $doc->createElement("result");
+ $doc->appendChild($result);
+ for($i=0; $i<count($arrayWP); $i++){
+ $domNode = $doc->importNode($arrayWP[$i], true);
+ $result->appendChild($domNode);
+ }
+ for($i=0; $i<count($arrayG); $i++){
+ $domNode = $doc->importNode($arrayG[$i], true);
+ $result->appendChild($domNode);
+ }
+ for($i=0; $i<count($arrayK); $i++){
+ $domNode = $doc->importNode($arrayK[$i], true);
+ $result->appendChild($domNode);
+ }
+ for($i=0; $i<count($arraySH); $i++){
+ $domNode = $doc->importNode($arraySH[$i], true);
+ $result->appendChild($domNode);
+ }
+ for($i=0; $i<count($arraySTR); $i++){
+ $domNode = $doc->importNode($arraySTR[$i], true);
+ $result->appendChild($domNode);
+ }
+ for($i=0; $i<count($arrayV); $i++){
+ $domNode = $doc->importNode($arrayV[$i], true);
+ $result->appendChild($domNode);
+ }
+ $ready = $doc->createElement('ready');
+ $result->appendChild($ready);
+ $tready = $doc->createTextNode("true");
+ $ready->appendChild($tready);
+ echo $doc->saveXML();
+}
+function encode($s){
+# if(CHARSET == 'UTF-8'){
+# $s = utf8_encode($s);
+# }
+ return $s;
+}
+function getPlz($str){
+ $p = "/.*(\d{5}).*/";
+ $am = array();
+ if(preg_match($p, $str, $am)){
+ return $am[1];
+ }
+ else{
+ return false;
+ }
+}
+function getCity($str){
+ $p = "/(^\d{5}){0,1}(.*)/";
+ $am = array();
+ if(preg_match($p, $str, $am)){
+ return trim($am[2]);
+ }
+ else{
+ return false;
+ }
+}
+function getNr($str){
+ $p = "/.*[^0-9](\d{1,4})[^0-9]*/";
+ $am = array();
+ if(preg_match($p, $str, $am)){
+ return $am[(count($am)-1)];
+ }
+ else{
+ return false;
+ }
+}
+function getStrn($str){
+ $p = "/^(\D+)\d/";
+ $am = array();
+ if(preg_match($p, $str, $am)){
+ return trim($am[1]);
+ }
+ else{
+ return false;
+ }
+}
+function getAppendix($str){
+ $p = "/.*\d+.*(\D{1})/";
+ $am = array();
+ if(preg_match($p, $str, $am)){
+ return $am[1];
+ }
+ else{
+ return false;
+ }
+}
+function getCKeysByName($city){
+ global $ckeys;
+ $city = "%".strtoupper(trim($city))."%";
+ $sql = "SELECT gem_schl_neu FROM gis.wohnplatz ";
+ $sql .= "WHERE gemeinde_gem_teile_upper ILIKE $1 ";
+ $v = array($city);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($ckeys, $row['gem_schl_neu']);
+ }
+}
+?>
Added: trunk/mapbender/http/geoportal/gaz_wiki.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_wiki.php (rev 0)
+++ trunk/mapbender/http/geoportal/gaz_wiki.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -0,0 +1,102 @@
+<?php
+# $Id: gaz_wiki.php 468 2006-11-15 15:54:05Z rothstein $
+# http://www.mapbender.org/index.php/gaz_wiki.php
+# Copyright (C) 2002 Melchior Moos
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//disable warnings
+ini_set('display_errors', 0);
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+//Vars
+$url = WIKI_URL;
+$term = "";
+(isset($_SERVER["argv"][1]))? ($term = $_SERVER["argv"][1]) : ($e = new mb_exception("wiki_search: searchstring lacks!"));
+if (($term === 'false') || ($term === '*')) {
+ $term = 'e'; //use wiki search wildcard
+}
+
+
+$maxresults = WIKI_MAX_RESULTS;
+#http://www.gdi-rp-dienste3.rlp.de/mediawiki/api.php?action=query&list=allpages&apfrom=inspire&aplimit=500
+#http://www.gdi-rp-dienste3.rlp.de/mediawiki/api.php?action=query&list=search&srsearch=inspire&srwhat=text
+//get url for links
+$surl = "mediawiki/index.php/";
+//search mediawiki from localhost -> this will be much faster than over www
+$searchurl = $url;
+//$searchurl.="Special:Search?search=".urlencode($term)."&fulltext=Search&limit=".$maxresults."&offset=0";//OLD Version - now new mediwiki API is used
+$searchurl.="/api.php?action=query&list=search&srsearch=".urlencode($term)."&srwhat=text&format=xml";
+$e = new mb_notice("gaz_wiki: url to load: ".$searchurl);
+//load result by connector:
+$wikiConnectorObject = new connector($searchurl);
+$e = new mb_notice("gaz_wiki: read from connector".$wikiConnectorObject->file);
+//get results
+$wikiXmlString = $wikiConnectorObject->file;
+//load as xml object
+$wikiXmlObject = new SimpleXMLElement($wikiXmlString);
+$e = new mb_notice("gaz_wiki: xml after parsing with php simplexml: ".$wikiXmlObject->asXML());
+//get the list of results
+$lists = $wikiXmlObject->xpath('/api/query/search/p/@title');
+$e = new mb_exception("gaz_wiki: number of results: ".count($lists));
+//debug
+//while(list( , $node) = each($lists)) {
+// $e = new mb_exception('/api/query/search/p/@title: '.$node);
+//}
+//create output xml
+$xml = new DOMDocument('1.0');
+$xml->encoding = CHARSET;
+$resultnode = $xml->createElement("result");
+$xml->appendChild($resultnode);
+
+if(count($lists)==0) {//no results returned
+ $ready = $xml->createElement('ready');
+ $resultnode->appendChild($ready);
+ $tready = $xml->createTextNode("true");
+ $ready->appendChild($tready);
+ echo $xml->saveXML();
+} else {
+ //parse title matches
+ while(list( , $node) = each($lists)) {
+ $e = new mb_exception('/api/query/search/p/@title: '.$node);
+ $link = $surl.$node;
+ $title = $node;
+ $m = $xml->createElement('member');
+ $resultnode->appendChild($m);
+ //create title
+ $ntitle = $xml->createElement('title');
+ $m->appendChild($ntitle);
+ $ttitle = $xml->createTextNode($title);
+ $ntitle->appendChild($ttitle);
+ //abstract
+ $abst = $xml->createElement('abstract');
+ $m->appendChild($abst);
+ $tabst = $xml->createTextNode("");
+ $abst->appendChild($tabst);
+ //url
+ $nurl = $xml->createElement('url');
+ $m->appendChild($nurl);
+ $turl = $xml->createTextNode($link);
+ $nurl->appendChild($turl);
+ }
+ $ready = $xml->createElement('ready');
+ $resultnode->appendChild($ready);
+ $tready = $xml->createTextNode("true");
+ $ready->appendChild($tready);
+ echo $xml->saveXML();
+}
+
+?>
Added: trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php (rev 0)
+++ trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -0,0 +1,476 @@
+<?php
+
+#example for local request (aware of having configured curl or http connection in mapbender.conf):
+#http://localhost/mapbender/geoportal/mod_readOpenSearchResults.php?q=ah4
+
+
+#***things to be done first (globals, ...)
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+#require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+#require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+$resdir = RESULT_DIR;
+echo $resdir;
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+function logit($text){
+ if($h = fopen(dirname(__FILE__)."/../tmp/opensearch_log.txt","a")){
+ $content = $text .chr(13).chr(10);
+ if(!fwrite($h,$content)){
+ #exit;
+ }
+ fclose($h);
+ }
+ }
+#require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+#***
+#test if script was requested over http or from cli
+#if it came from cli, use output to tmp folder - > typo3 would find it and will show it in template, there should be an identifier from the gaz.php script which controls the different search moduls
+#if it came as http request it should generate its own html window
+#Maybe problematic: if requested from command-line, how would mapbender get the content? Should be tested.
+
+#check if requested as cli
+if (isset($argv[0])&isset($argv[1])){
+ echo "\nthe script was invoked from commandline\n";
+ $from_cli=true;
+ #do something with the searchstring if needed
+ #from cli no pagenumber will be given. Therefor everytime page number 1 will be requested
+ $request_p = 1;
+ $_REQUEST["q"] = $argv[2];//.$argv[3];//$searchPortaluFilter = $argv[3];
+ $cli_id = $argv[1];
+
+ echo "\nID: ".$argv[1]."\n";
+ echo "\nSearchstring: ".$argv[2]."\n";
+ }
+ else
+ {
+ echo "\n<br>no commandline args set!\n<br>";
+ $from_cli=false;
+ }
+
+#When script was not invoked from cli it should have been invoked per http - check the params
+if (!$from_cli){
+ #***Validation of GET Parameters
+ #handle errors
+ if(!isset($_REQUEST["q"]) ) {
+ echo "No search string found! Please send a query!<br>";
+ die();
+ }
+ if(!isset($_REQUEST["p"]) ) {
+ $request_p=1;
+ }
+ else
+ {
+ $request_p=$_REQUEST["p"];
+ }
+
+ if(!isset($_REQUEST["request_id"]) or $_REQUEST["request_id"]=='') {
+ echo "<br> request_id is not set <br>";
+ $requeststring="&request_id=from_http";
+ $cli_id="from_http";
+ }
+ else
+ {
+ echo "<br>request_id is set<br>";
+ $cli_id=$_REQUEST["request_id"];
+ }
+ echo "<br>Search string: <b>".$_REQUEST["q"]."</b> will be send<br>";
+}
+
+
+
+
+
+
+
+
+#***get the information out of the mapbender-db
+#get urls to search interfaces (opensearch):
+$sql_os = "SELECT * from gp_opensearch ORDER BY os_id";
+#do db select
+$res_os = db_query($sql_os);
+#initialize count of search interfaces
+$cnt_os = 0;
+#initialize result array
+$os_list=array(array());
+#fill result array
+while($row_os = db_fetch_array($res_os)){
+ $os_list[$cnt_os] ['id']= $row_os["os_id"];
+ $os_list[$cnt_os] ['name']= $row_os["os_name"];
+ $os_list[$cnt_os] ['url']= $row_os["os_url"];
+ $os_list[$cnt_os] ['h']= $row_os["os_h"];
+ $os_list[$cnt_os] ['standardfilter']= $row_os["os_standard_filter"];
+ $os_list[$cnt_os] ['version']= $row_os["os_version"];
+#os_standard_filter
+ $cnt_os++;
+}
+
+if (!$from_cli) {
+#give out count of interfaces to use
+ echo "\nCount of registrated OpenSearch Interfaces: ".count($os_list)."\n";
+ #***
+}
+
+#get command_line args
+#$cli_id="1234567-1234567-1234567-test";
+
+#+++++++++++++++++++++++++++
+
+
+#if the request came from http and the first request came from a commandline - add a get parameter to the following requests and change set the $cli_id
+#if(!isset($_REQUEST["request_id"]) ) {
+# $cli_id=$_REQUEST["request_id"];
+# $requeststring="&request_id=".$cli_id;
+ # }
+ #else
+ # {
+ # $requeststring="";
+ # }
+
+
+#+++++++++++++++++++++++++++++++++
+
+#string to add to further requests:
+$requeststring="&request_id=".$cli_id;
+#***write xml with list of opensearch catalogs
+#$from_cli=true;# for testing only
+#if ($from_cli) {
+ #write out xml 'is really no xml!' with opensearch-catalogs
+if ($from_cli) {
+echo "\nFolder to write to: ".$resdir."\n";
+echo "\nFile to open: ".$resdir."/".$cli_id."_os.xml\n";
+}
+ if($os_catalogs_file_handle = fopen($resdir."/".$cli_id."_os.xml","w")){
+ fwrite($os_catalogs_file_handle,"<interfaces>\n");
+ for ($i_c = 0; $i_c < count($os_list); $i_c++) {
+ $content = $os_list[$i_c] ['name'];
+ fwrite($os_catalogs_file_handle,"<opensearchinterface>");
+ fwrite($os_catalogs_file_handle,$content);
+ fwrite($os_catalogs_file_handle,"</opensearchinterface>\n");
+ }
+ fwrite($os_catalogs_file_handle,"</interfaces>\n");
+ fclose($os_catalogs_file_handle);
+ }
+ else
+ {
+ if ($from_cli) {
+ echo "\nCouldn't open file!\n";
+ }
+ }
+#}
+#$from_cli=false;# for testing only
+#***
+#***loop for things to do for each registrated search interface - only if the search should be done in all interfaces!
+#use only one catalogue if a further page is requested
+$start_cat=0;
+$end_cat=count($os_list);
+$cat=$_REQUEST["cat"];
+if (isset($cat)){
+$start_cat=(int)$cat;
+$end_cat=(int)$cat+1;
+}
+
+for ($i_si = $start_cat; $i_si < $end_cat ; $i_si++) {
+
+ $openSearchUrl[$i_si]=$os_list[$i_si] ['url'];
+ $openSearchWrapperDetail="mod_readOpenSearchResultsDetail.php";
+ #define opensearch search url and opensearch detail url
+ $openSearchUrlSearch[$i_si]=$openSearchUrl[$i_si]."query?";
+ $openSearchUrlDetail[$i_si]=$openSearchUrl[$i_si]."detail?";
+
+ #get resultlists
+ $url=$openSearchUrlSearch[$i_si]."q=".$_REQUEST["q"].$os_list[$i_si] ['standardfilter']."&h=".$os_list[$i_si] ['h']."&p=".$request_p;
+ if (!$from_cli) {
+ echo "<br> url: ".$url."<br>";
+ }
+ else
+ {
+ #echo "url: ".$url."\n";
+ }
+ #$e = new mb_exception("metadataurl= ".$url);
+ logit("metadataurl : ".$url);
+ //$e = new mb_exception("metadataurl= ".$url);
+ #create connector object
+ $openSearchObject = new connector($url);
+ #get results
+ $openSearchResult = $openSearchObject->file;
+
+ #save resultset in temporary folder identified by sessionid, katalog_id and page_id! Now there would be more tmp files than before!
+ #this has to be done in order to give the information to typo3
+ #**************to be done!************************************
+ #$e = new mb_exception('external xml : '.$openSearchResult);
+ #parse result to simplexml
+ $openSearchXml=simplexml_load_string($openSearchResult);
+ #read out array with docids and plugids
+ #read out number of results - there are two ways: with namespaces and without!:
+ $n_results=$openSearchXml->channel->totalResults;
+ if ($os_list[$i_si] ['version']=='2') {
+ $opensearchElements=$openSearchXml->channel->children('http://a9.com/-/spec/opensearch/1.1/');
+ $n_results=$opensearchElements->totalResults;
+
+ }
+ if (!isset($n_results)) {
+ $n_results = 0;
+ }
+ //$e = new mb_exception("n_results(".$i_si.")= ".$n_results);
+ if ($from_cli) {
+ logit( "Number of Results in Catalogue ".$i_si.": ".$n_results."\n");
+ }
+ #calculate number of needed pages to show all results:
+ $number_of_pages=ceil((real)$n_results/(real)$os_list[$i_si] ['h']);
+
+ #do some debugging output
+ #var_dump($openSearchXml);
+ #show total results
+
+
+#do a html output for showing results of the different opensearch catalogues
+if (!$from_cli) {
+ echo "<b>".$n_results."</b> Ergebnisse in Katalog <b>".$os_list[$i_si] ['name']."</b><br><br>";
+ #show Pagenumbers
+ if ((int)$request_p>1) {
+ echo "<a href=\"mod_readOpenSearchResults.php?q=".$_REQUEST['q']."&p=".(string)((int)$request_p-1)."&cat=".$i_si.$requeststring."\"> Vorige Seite </a> ";
+ }
+
+ echo "Seite: <b>".$request_p."</b> von <b>".$number_of_pages."</b>";
+
+ if ((int)$request_p < (int)$number_of_pages) {
+ echo " <a href=\"mod_readOpenSearchResults.php?q=".$_REQUEST['q']."&p=".(string)((int)$request_p+1)."&cat=".$i_si.$requeststring."\"> Nächste Seite </a>";
+ }
+
+ echo "<br><br>";
+}
+else
+{
+#echo "Keine Blättermöglichkeit in CLI\n";
+}
+
+
+$from_cli=true; //- do this everytime
+if ($from_cli) { #do these things if the request was done from the commandline - it is done by the central search function
+ #generate the output for each page! Like: xyz_os1_1_10.xml = this means: searchid_os#catalogid_#page_#totalpages.xml
+ #open the specific file for writing
+ #number of the actual catalog:
+ $catalog_number=(int)$i_si+1;
+ logit($resdir."/".$cli_id."_os".$catalog_number."_".$request_p.".xml");
+ if($os_catalogs_file_handle = fopen($resdir."/".$cli_id."_os".$catalog_number."_".$request_p.".xml","w")){
+ fwrite($os_catalogs_file_handle,"<resultlist>\n");
+ #logit("<resultlist>\n");
+ fwrite($os_catalogs_file_handle,"<querystring>".urlencode($_REQUEST["q"])."</querystring>\n");
+ #logit("<querystring>".urlencode($_REQUEST["q"])."</querystring>\n");
+ fwrite($os_catalogs_file_handle,"<totalresults>".$n_results."</totalresults>\n");
+ #logit("<totalresults>".$n_results."</totalresults>\n");
+ fwrite($os_catalogs_file_handle,"<npages>".$number_of_pages."</npages>\n");
+ #logit("<npages>".$number_of_pages."</npages>\n");
+ fwrite($os_catalogs_file_handle,"<nresults>".(int)$os_list[$i_si] ['h']."</nresults>\n");
+ //write rssurl only, if opensearch version not equal to 1
+ if ($os_list[$i_si] ['version']=='1') {
+ fwrite($os_catalogs_file_handle,"<rssurl></rssurl>\n");
+ }
+ else
+ {
+ fwrite($os_catalogs_file_handle,"<rssurl>".urlencode($openSearchXml->channel->link)."</rssurl>\n");
+ }
+ #logit("<nresults>".(int)$os_list[$i_si] ['h']."</nresults>\n");
+ #loop for single results in first list
+ #problematic: if less than 10 results are in the list, let the loop run only nresults times
+
+ if ($n_results < (int)$os_list[$i_si] ['h']) {
+ $upperLimit = $n_results;
+ }
+ else
+ {
+ $upperLimit = (int)$os_list[$i_si] ['h'];
+ }
+ for ($i=0; $i < $upperLimit; $i++) {
+
+ #filter nur dann, wenn docid und plugid gesetzt! Nur notwendig, wenn alle abgefragt werden!
+ #TODO: Get $plugid, $docid, $docuuid, $wms_url, $bbox out of result!!!
+ #if ($os_list[$i_si] ['version']=='2') {
+ # $opensearchElements=$openSearchXml->channel->children('http://a9.com/-/spec/opensearch/1.1/');
+ #}
+ unset($wms_url);
+
+ $link = $openSearchXml->channel->item[$i]->link;
+ if ($os_list[$i_si] ['version']=='1') {
+ $plugid = $openSearchXml->channel->item[$i]->plugid;
+ $docid = $openSearchXml->channel->item[$i]->docid;
+ #$link = urlencode($link);
+ if (isset($openSearchXml->channel->item[$i]->{'wms-url'})) {
+ $wms_url = $openSearchXml->channel->item[$i]->{'wms-url'};
+ #adopt wms url to 1.3.0 - REQUEST has no VERSION set - set this to 1.1.1
+ $wms_url = correctWmsUrl($wms_url);
+ $wms_url = urlencode($wms_url);
+ }
+ $source = $openSearchXml->channel->item[$i]->source;
+ }
+ else {
+ $ingridElements=$openSearchXml->channel->item[$i]->children('http://www.portalu.de/opensearch/extension/1.0');
+ $link = urlencode($link);
+ $plugid = $ingridElements->plugid;
+ $source = $ingridElements->source;
+ $docid = $ingridElements->docid;
+ if (isset($ingridElements->{'wms-url'})) {
+ $wms_url = $ingridElements->{'wms-url'};
+ #adopt wms url to 1.3.0 - REQUEST has no VERSION set - set this to 1.1.1
+ $wms_url = correctWmsUrl($wms_url);
+ $wms_url = urlencode($wms_url);
+ }
+ $georssElements=$openSearchXml->channel->item[$i]->children('http://www.georss.org/georss');
+ if (isset($georssElements->{'box'})) {
+ $bbox = $ingridElements->{'box'};
+ }
+ else
+ {
+ $bbox = null;
+ }
+ $docuuid = $ingridElements->docuuid;
+ }
+
+
+
+ if (isset($plugid)&isset($docid)){
+
+ #Do result XML output to file
+ fwrite($os_catalogs_file_handle,"<result>\n");
+ #Tags for catalogtitle and link to detailed information
+ fwrite($os_catalogs_file_handle,"<catalogtitle>");
+ fwrite($os_catalogs_file_handle,$source." (ID=".$docid.")");
+ fwrite($os_catalogs_file_handle,"</catalogtitle>\n");
+ fwrite($os_catalogs_file_handle,"<catalogtitlelink>");
+
+
+
+ fwrite($os_catalogs_file_handle,urlencode($openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=html"));
+
+ fwrite($os_catalogs_file_handle,"</catalogtitlelink>\n");
+ #Tags for objecttitle and abstract
+ fwrite($os_catalogs_file_handle,"<title>");
+ fwrite($os_catalogs_file_handle,$openSearchXml->channel->item[$i]->title);
+ fwrite($os_catalogs_file_handle,"</title>\n");
+ fwrite($os_catalogs_file_handle,"<abstract>");
+ fwrite($os_catalogs_file_handle,substr($openSearchXml->channel->item[$i]->description,0,250)."...");
+ fwrite($os_catalogs_file_handle,"</abstract>\n");
+ #Tag for link to original metadata view
+ fwrite($os_catalogs_file_handle,"<urlmdorig>");
+ if ($os_list[$i_si] ['version']=='1') {
+ fwrite($os_catalogs_file_handle,urlencode($link));
+ }
+ else
+ {
+ fwrite($os_catalogs_file_handle,$link);
+ }
+
+
+ #fwrite($os_catalogs_file_handle,$link);
+
+
+
+
+ fwrite($os_catalogs_file_handle,"</urlmdorig>\n");
+ #if a wms resource is found, the url will be in the list
+ if (isset($wms_url)){
+ fwrite($os_catalogs_file_handle,"<wmscapurl>");
+ fwrite($os_catalogs_file_handle,$wms_url);
+ fwrite($os_catalogs_file_handle,"</wmscapurl>\n");
+ fwrite($os_catalogs_file_handle,"<mbaddurl>");
+ fwrite($os_catalogs_file_handle,"testurl");
+ fwrite($os_catalogs_file_handle,"</mbaddurl>\n");
+ }
+ else #add empty tags
+ {
+ fwrite($os_catalogs_file_handle,"<wmscapurl></wmscapurl>\n<mbaddurl></mbaddurl>\n");
+
+ }
+ if (isset($bbox)){
+ fwrite($os_catalogs_file_handle,"<georssurl>");
+ $urlToId = $openSearchUrlSearch[$i_si]."q=t01_object.obj_id:".$docuuid.$os_list[$i_si] ['standardfilter']."&h=".$os_list[$i_si] ['h']."&p=".$request_p;
+ fwrite($os_catalogs_file_handle,urlencode($urlToId));
+ fwrite($os_catalogs_file_handle,"</georssurl>\n");
+ }
+ else
+ {
+ fwrite($os_catalogs_file_handle,"<georssurl>");
+ fwrite($os_catalogs_file_handle,"</georssurl>\n");
+ }
+ #fwrite($os_catalogs_file_handle,"");
+ fwrite($os_catalogs_file_handle,"<iso19139url>");
+ fwrite($os_catalogs_file_handle,urlencode($openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=iso19139"));
+ fwrite($os_catalogs_file_handle,"</iso19139url>\n");
+ fwrite($os_catalogs_file_handle,"<inspireurl>");
+ fwrite($os_catalogs_file_handle,urlencode($openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=inspire"));
+ fwrite($os_catalogs_file_handle,"</inspireurl>\n");
+ #end of resultlist
+ fwrite($os_catalogs_file_handle,"</result>\n");
+ }
+ }
+ fwrite($os_catalogs_file_handle,"</resultlist>\n");
+ #logit("</resultlist>\n");
+
+ fclose($os_catalogs_file_handle);
+}
+}
+
+#$from_cli=false;
+
+#do html version
+if (!$from_cli) {
+ for ($i=0; $i < (int)$os_list[$i_si] ['h']; $i++) {
+
+
+ #filter nur dann, wenn docid und plugid gesetzt! Nur notwendig, wenn alle abgefragt werden!
+ if (isset($plugid)&isset($docid)){
+ echo("<a href=\"".$openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=html\" target=\"_blank\" onclick='window.open(this.href,\"Details\",\"width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes\"); return false'><b> ".$openSearchXml->channel->item[$i]->title."</b></a>");
+ if (isset($wms_url)){
+ echo("<a href=\"\"><img border=\"0\" alt=\"In Karte übernehmen\" src=\"img/map.png\"></a><br>");
+ }
+ else
+ {
+ echo "<br>";
+ }
+ echo("<b><i>".$source." (ID=".$docid.")</b></i><br>");
+
+ echo("<i>".substr($openSearchXml->channel->item[$i]->description,0,250)." ...</i><br>");
+ echo("<a href=\"".$link."\">Originäre Metadaten<a><br>");
+ #if a wms resource is found, the url will be in the list
+ if (isset($wms_url)){
+ echo(" <a href=\"".urldecode($wms_url)."\">WMS GetCapabilities<a><br>");
+
+ }
+ echo("");
+ echo("<b>Alternative Formate:</b><br><a href=\"".$openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=iso19139\" onclick='window.open(this.href,\"Details ISO19139\",\"width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes\"); return false' target=\"_blank\"><img border=\"0\" src=\"img/iso19139.png\" alt=\"ISO19139\"></a><a href=\"".$openSearchWrapperDetail."?osid=".$os_list[$i_si] ['id']."&plugid=".$plugid."&docid=".$docid."&mdtype=inspire\" onclick='window.open(this.href,\"Details INSPIRE\",\"width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes\"); return false' target=\"_blank\"><img border=\"0\" alt=\"INSPIRE\" src=\"img/inspire_tr_36.png\"></a><br><br>");
+ }
+
+ #wenn AUSGABE IN DATEI ERWUENSCHT
+ #logit($openSearchResult);
+ #logit("test");
+ }
+
+}
+}
+function correctWmsUrl($wms_url) {
+ $findme1 = "VERSION=";
+ $findme2 = "version=";
+ $pos1 = strpos($wms_url, $findme1);
+ $pos2 = strpos($wms_url, $findme2);
+ if ($pos1 === false && $pos2 === false) {
+ $wms_url .= "&VERSION=1.1.1";
+ }
+ //exchange &? with & and &
+ $wms_url = str_replace('&?', '&', $wms_url);
+ $wms_url = str_replace('&?', '&', $wms_url);
+ $wms_url = str_replace('&', '&', $wms_url);
+return $wms_url;
+}
+
+
+
+
+
+
+
+
+
+
+?>
Added: trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php (rev 0)
+++ trunk/mapbender/http/geoportal/mod_readOpenSearchResultsDetail.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -0,0 +1,1279 @@
+<?php
+#session_start();
+#http://localhost/mapbender/geoportal/mod_readOpenSearchResultsDetail.php?osid=1&...
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+#function logit($text){
+ #if($h = fopen("/home/armin/Desktop/opensearch_log.txt","a")){
+ # $content = $text .chr(13).chr(10);
+ # if(!fwrite($h,$content)){
+ # #exit;
+ # }
+ # fclose($h);
+ #}
+ # }
+
+#require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+function display_text($string) {
+ $string = eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);
+ $string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);
+ $string = eregi_replace("\n", "<br>", $string);
+ return $string;
+}
+
+
+#***
+
+ $md_ident=array(
+ array( ibus => "object_node.fk_obj_uuid",
+ iso19139 => "MD_Metadata.parentIdentifier",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Identifikator des übergeordneten Objektes",
+ gdescription => ""),
+ array( ibus => "t01_object",
+ iso19139 => "MD_Metadata.fileIdentifier",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Objectidentifikator",
+ gdescription => ""),
+ array( ibus => "t01_object.obj_name",
+ iso19139 => "MD_Metadata.identificationInfo?",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Objektname",
+ gdescription => ""),
+ array( ibus => "t01_object.obj_class",
+ iso19139 => "",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "ID der Objektklasse",
+ gdescription => "Relevant sind 1 und 3"),
+ array( ibus => "t01_object.info_note",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.purpose",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Herstellungszweck",
+ gdescription => "Zusatzinformation"),
+ array( ibus => "t01_object.loc_descr",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.description",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Raumbezug:Erläuterung",
+ gdescription => "Raumbezug"),
+ array( ibus => "t01_object.time_from",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.....",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Zeitbezug des Dateninhalts von:",
+ gdescription => "Zeitbezug"),
+ array( ibus => "t01_object.time_to",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.....",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Zeitbezug des Dateninhalts bis:",
+ gdescription => "Zeitbezug"),
+ array( ibus => "t011_obj_literatur.base",
+ iso19139 => "MD_Metadata.identificationInfo.MD_Identification.descriptiveKeywords.MD_Keywords.keyword",
+ iso19139explode => "true" ,
+ inspire => "B 3.1 Keyword value",
+ inspiremandatory => "true",
+ iso_name => "descriptive Keywords",
+ html => "INSPIRE Thema",
+ gdescription => ""),
+
+
+
+ array( ibus => "t04_search.searchterm",
+ iso19139 => "MD_Metadata.identificationInfo.MD_Identification.descriptiveKeywords.MD_Keywords.keyword",
+ iso19139explode => "true" ,
+ inspire => "B 3.1 Keyword value",
+ inspiremandatory => "true",
+ iso_name => "descriptive Keywords",
+ html => "Suchbegriffe",
+ gdescription => ""),
+ array( ibus => "title",
+ iso19139 => "identificationInfo[1]/*/citation/*/title",
+ iso19139explode => "false" ,
+ inspire => "B 1.1 Resource title",
+ inspiremandatory => "true",
+ iso_name => "Title",
+ html => "Titel",
+ gdescription => ""),
+
+ array( ibus => "t0113_dataset_reference.reference_date",
+ iso19139 => "",
+ iso19139explode => "false" ,
+ inspire => "B 5.2 Date of publication",
+ inspiremandatory => "true",
+ iso_name => "Date of publication",
+ html => "Veröffentlichungsdatum",
+ gdescription => ""),
+
+ array( ibus => "t01_object.time_status",
+ iso19139 => "",
+ iso19139explode => "false" ,
+ inspire => "B 5.3 Date of revision",
+ inspiremandatory => "true",
+ iso_name => "Date of revision",
+ html => "Datum der letzten Ãberarbeitung",
+ gdescription => ""),
+
+ array( ibus => "txx", #to find
+ iso19139 => "",
+ iso19139explode => "false" ,
+ inspire => "B 5.4 Date of creation",
+ inspiremandatory => "true",
+ iso_name => "Date of creation",
+ html => "Erzeugungsdatum",
+ gdescription => ""),
+
+ array( ibus => "summary",
+ iso19139 => "identificationInfo[1]/*/abstract",
+ iso19139explode => "false" ,
+ inspire => "B 1.2 Resource abstract",
+ inspiremandatory => "true",
+ iso_name => "abstract",
+ html => "Zusammenfassung",
+ gdescription => ""),
+ array( ibus => "t011_obj_serv.type",
+ iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceType",
+ iso19139explode => "false" ,
+ inspire => "B 2.2 Spatial data service type",
+ inspiremandatory => "true",
+ iso_name => "ServiceType",
+ html => "Typ des Dienstes",
+ gdescription => ""),
+ array( ibus => "t011_obj_serv_version.version",
+ iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceTypeVersion",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "Service Type Version",
+ html => "Version des Dienstes",
+ gdescription => ""),
+ array( ibus => "x1",
+ //array( ibus => "spatial_ref_value.x1",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.WestBoundLongitude",
+ iso19139explode => "false" ,
+ inspire => "B 4.1 Geographic bounding box - western longitude",
+ inspiremandatory => "true",
+ iso_name => "WestBoundLongitude",
+ html => "Westliche Begrenzung (geographische Länge)",
+ gdescription => ""),
+ array( ibus => "y1",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.SouthBoundLatitude",
+ iso19139explode => "false" ,
+ inspire => "B 4.1 Geographic bounding box - southern latitude",
+ inspiremandatory => "true",
+ iso_name => "SouthBoundLatitude",
+ html => "Südliche Begrenzung (geographische Breite)",
+ gdescription => ""),
+ array( ibus => "x2",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.EastBoundLongitude",
+ iso19139explode => "false" ,
+ inspire => "B 4.1 Geographic bounding box - eastern longitude",
+ inspiremandatory => "true",
+ iso_name => "EastBoundLongitude",
+ html => "Ãstliche Begrenzung (geographische Länge)",
+ gdescription => ""),
+ array( ibus => "y2",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.NorthBoundLatitude",
+ iso19139explode => "false" ,
+ inspire => "B 4.1 Geographic bounding box - northern latitude",
+ inspiremandatory => "true",
+ iso_name => "NorthBoundLatitude",
+ html => "Nördliche Begrenzung (geographische Breite)",
+ gdescription => ""),
+ array( ibus => "t01_object.metadata_language",
+ iso19139 => "MD_Metadata.language",
+ iso19139explode => "false" ,
+ inspire => "B 10.3 Metadata language",
+ inspiremandatory => "true",
+ iso_name => "Metadata language",
+ html => "Sprache des Metadatensatzes",
+ gdescription => ""),
+ array( ibus => "summary",
+ iso19139 => "MD_Metadata.identificationInfo.MD_Identification.citation.CI_Citation.alternateTitle",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "Dataset alternate title",
+ html => "Kurzbezeichnung",
+ gdescription => ""),
+ array( ibus => "t011_object_geo.special_base",
+ iso19139 => "MD_Metadata.dataQualityInfo.lineage.LI_Lineage.statement",
+ iso19139explode => "false" ,
+ inspire => "B 6.1 Lineage",
+ inspiremandatory => "true",
+ iso_name => "B 1.6 Lineage",
+ html => "Informationen zum Herstellungsprozess",
+ gdescription => ""),
+ array( ibus => "t011_object_geo.rec_exact",
+ iso19139 => "MD_Metadata.dataQualityInfo.lineage.DQ_DataQuality.report.DQ_RelativeInternalPositionAccuracy.value",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Fachliche Grundlage",
+ gdescription => ""),
+ array( ibus => "t011_object_geo_scale.scale",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.equivalentScale.MD_RepresentativeFraction.denominator",
+ iso19139explode => "false" ,
+ inspire => "B 6.2 Spatial Resolution",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "ErstellungsmaÃstab->MaÃstab",
+ gdescription => ""),
+ array( ibus => "t011_object_geo_scale.resolution_ground",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance",
+ iso19139explode => "false" ,
+ inspire => "B 6.2 Spatial Resolution",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "ErstellungsmaÃstab->Bodenauflösung",
+ gdescription => ""),
+
+#The resolutions for services will be hold in different objects!
+ array( ibus => "t011_object_serv_scale.scale",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.equivalentScale.MD_RepresentativeFraction.denominator",
+ iso19139explode => "false" ,
+ inspire => "B 6.2 Spatial Resolution",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "ErstellungsmaÃstab->MaÃstab",
+ gdescription => "Auflösung bei Diensten"),
+ array( ibus => "t011_object_serv_scale.resolution_ground",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance",
+ iso19139explode => "false" ,
+ inspire => "B 6.2 Spatial Resolution",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "ErstellungsmaÃstab->Bodenauflösung",
+ gdescription => "Auflösung bei Diensten"),
+
+ array( ibus => "t011_obj_geo_spatial_rep",
+ iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialRepresentationType.MD_SpatialRepresentationTypeCode",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Digitale Repräsentation",
+ gdescription => ""),
+
+
+
+
+ array( ibus => "t011_obj_geo.hierarchy_level",
+ iso19139 => "MD_Metadata.hierachyLevelName",
+ iso19139explode => "true" ,
+ inspire => "B 1.3 Resource Type",
+ inspiremandatory => "true",
+ iso_name => "hierachyLevelName",
+ html => "Datensatz/Datenserie",
+ gdescription => ""),
+ array( ibus => "t012_obj_obj.object_from_id",
+ iso19139 => "MD_Metadata.parentIdentifier",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "Parent Identifier",
+ html => "Identifikator des übergeordneten Datensatzes",
+ gdescription => ""),
+
+ array( ibus => "t02_address.city",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Stadt",
+ gdescription => ""),
+ array( ibus => "t02_address.institution",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Organisation",
+ gdescription => ""),
+ array( ibus => "t02_address.firstname",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Vorname",
+ gdescription => ""),
+ array( ibus => "t02_address.lastname",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Nachname",
+ gdescription => ""),
+ array( ibus => "t02_address.postcode",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Postleitzahl",
+ gdescription => ""),
+ array( ibus => "t02_address.street",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "StraÃe",
+ gdescription => ""),
+
+ array( ibus => "t021_communication.comm_value",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 10.1 Metadata point of contact email",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Email - Verantwortlicher für Metadaten",
+ gdescription => ""),
+array( ibus => "t011_obj_literature.publisher",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 10.1 Metadata Contact Organisation",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Verantwortliche Organisation für Metadaten",
+ gdescription => ""),
+
+
+ array( ibus => "t011_obj_literature_publishing",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 9.1 Responsible party organisation",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Verantwortliche Organisation",
+ gdescription => ""),
+
+ array( ibus => "t012_obj_adr.special_name",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 9.2 Responsible party role",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Rolle der verantwortlichen Organisation",
+ gdescription => ""),
+
+
+
+
+ array( ibus => "t017_url_ref.content",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ iso_name => "",
+ html => "Art des Links",
+ gdescription => ""),
+ array( ibus => "t017_url_ref.url_link",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Link",
+ gdescription => ""),
+ array( ibus => "t01_object.obj_id",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Objektidentifikator",
+ gdescription => ""),
+ array( ibus => "t01_object.obj_uuid",
+ iso19139 => "?",
+ iso19139explode => "false" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "Eindeutiger Objektidentifikator",
+ gdescription => ""),
+ array( ibus => "t01_object.obj_id",
+ iso19139 => "",
+ iso19139explode => "false" ,
+ inspire => "B 1.5 Unique resource identifier",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Name des Objektes",
+ gdescription => ""),
+ array( ibus => "t01_object.mod_time",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 10.2 Metadata date",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Datum des Metadatensatzes",
+ gdescription => ""),
+ array( ibus => "t011_obj_serv_type.serv_type_key",
+ iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceTypeVersion",
+ iso19139explode => "" ,
+ inspire => "B 2.2 Spatial Data Service Type",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Version des Services",
+ gdescription => ""),
+
+
+
+ array( ibus => "t011_obj_serv_op_connpoint.connect_point",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "",
+ inspiremandatory => "false",
+ iso_name => "",
+ html => "URL zum Online Aufruf",
+ gdescription => ""),
+ array( ibus => "t01_object.avail_access_note",
+ iso19139 => "identificationInfo[1]/*/resourceConstraints/*/accessConstraints",
+ iso19139explode => "" ,
+ inspire => "B 8.1 Condition applying to access and use",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Zugriffsbeschränkungen",
+ gdescription => ""),
+ array( ibus => "t01_object.fees",
+ iso19139 => "identificationInfo[1]/*/resourceConstraints/*/useLimitation",
+ iso19139explode => "" ,
+ inspire => "B 8.2 Limitations on public access",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Kosten/Gebühren",
+ gdescription => ""),
+ array( ibus => "t01_object.data_language",
+ iso19139 => "",
+ iso19139explode => "" ,
+ inspire => "B 1.7 Resource Language",
+ inspiremandatory => "true",
+ iso_name => "",
+ html => "Sprache des Datensatzes",
+ gdescription => ""),
+
+ array( ibus => "t011_obj_geo_topic_cat.topic_category",
+ iso19139 => "identificationInfo[1]/*/topicCategory",
+ iso19139explode => "true" ,
+ inspire => "B 2.1 Topic Category",
+ inspiremandatory => "true",
+ iso_name => "Topic Category",
+ html => "Kategorie",
+ gdescription => "ISO Kategorie")
+
+ #array( ibus => "t011_obj_geo_topic_cat.topic.topic_category",
+ #iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.topicCategory",
+ #iso19139explode => "true" ,
+ #inspire => "",
+ #inspiremandatory => "false",
+ #iso_name => "Dataset topic category",
+ #html => "Kategorisierung",
+ #gdescription => "")
+ );
+
+if(!isset($_REQUEST["osid"]) )
+{
+ echo "no opensearch id set";
+ die();
+}
+else
+{
+ if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+ {
+ echo "opensearch interface no.: ".$_REQUEST["osid"]." will be requested<br>";
+ }
+}
+
+
+#***get the information out of the mapbender-db
+#get url to search interface (opensearch):
+$sql_os = "SELECT * from gp_opensearch where os_id = $1";
+#do db select
+$v_os = array($_REQUEST["osid"]);
+$t_os = array('i');
+$res_os = db_prep_query($sql_os,$v_os,$t_os);
+#initialize count of search interfaces
+$cnt_os = 0;
+#initialize result array
+$os_list=array(array());
+#fill result array
+while($row_os = db_fetch_array($res_os)){
+ $os_list[$cnt_os] ['id']= $row_os["os_id"];
+ $os_list[$cnt_os] ['name']= $row_os["os_name"];
+ $os_list[$cnt_os] ['url']= $row_os["os_url"];
+ $os_list[$cnt_os] ['h']= $row_os["os_h"];
+ $os_list[$cnt_os] ['standardfilter']= $row_os["os_standard_filter"];
+#os_standard_filter
+ $cnt_os++;
+}
+#give out count of interfaces to use
+#echo "\nCount of registrated OpenSearch Interfaces: ".count($os_list)."\n";
+#***
+
+
+
+
+ #define opensearch detail url
+
+ $openSearchUrlDetail=$os_list[0] ['url']."detail?";
+
+ #get resultlists
+ $url=$openSearchUrlDetail."plugid=".$_REQUEST['plugid']."&docid=".$_REQUEST['docid'];
+
+
+if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+{
+ echo "<br> REQUEST: ".$url."<br>";
+}
+ #create connector object
+ $openSearchObject = new connector($url);
+ #get results
+ $openSearchDetail = $openSearchObject->file;
+
+ #save resultset in temporary folder identified by sessionid, katalog_id and page_id! Now there would be more tmp files than before!
+ #this has to be done in order to give the information to typo3
+ #**************to be done!************************************
+
+ #parse result to simplexml
+ #$openSearchXml=simplexml_load_string($openSearchDetail);
+
+
+
+ #parse result to simplexml
+ $openSearchDetailXML=simplexml_load_string($openSearchDetail);
+ #*****************************bbox********************************************
+ #do things for getting the bbox of the object in crs of last defined mapbender
+
+ #read out the epsg from session
+
+ #read out the bbox if exists
+
+ #transform bbox from wgs84 to last epsg of mapbender
+
+ #*****************************bbox********************************************
+
+
+
+ #extract objects to iso19139 elements
+ #count unidentified elements
+ $i=0;
+
+
+
+
+
+ #get list for ibus variables - cause php is row major
+ $ibus_names = array();
+ for($a = 0; $a < count($md_ident); $a++) {
+ $ibus_names[$a] = $md_ident[$a]["ibus"];
+ if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+ {
+ echo "ibus_names[".$a."]=".$md_ident[$a]["ibus"]."<br>";
+ }
+
+ }
+
+
+
+
+
+ #define array of key-value pairs
+ $detail_array=array();
+ #read key-value pairs
+ $j=0;
+ foreach ( $openSearchDetailXML->channel->item->details->detail as $detail) {
+
+ $detail_key=(string)$detail->{'detail-key'}; #cast explicitly to string
+ $detail_value=(string)$detail->{'detail-value'};
+ $detail_array[$detail_key] = $detail_value;
+ $detail_keys[$j]=$detail_key;
+ # echo "Key: ".$detail->{'detail-key'}."<br>";
+ # echo "array: ".$detail_array[$detail_key]."<br>"; #gives values
+ #check if key is in array else count failures
+ if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+ {
+ if (in_array($detail_key, $ibus_names)) {
+ echo "Key <b>".$detail_key."</b> exists in lookup table!<br>";
+ $i++;
+ }
+ }
+ $j++;
+
+ }
+ if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+ {
+ echo "<br>".$i." elements have been identified!<br>";
+ }
+
+
+#$test1=in_array('t04_search.searchterm', $ibus_names);
+#$test2=array_search('t04_search.searchterm', $ibus_names);
+#if ($test1){echo "found at position: ".$test2."<br>";}
+#else
+#{echo "not found<br>";}
+if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
+ {
+ var_dump($detail_keys);
+
+}
+
+if ($_REQUEST['mdtype']=='debug'){
+ echo "DEBUG Metadatenanzeige<br>";
+ #define table
+ echo "<html><table border=\"1\"><br>";
+ echo "<tr>";
+ #loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
+ foreach ($detail_keys as $detailkey) {
+
+ #echo "<td>";
+
+ if (in_array($detailkey, $ibus_names)==false){
+
+ echo "<td >".$detailkey."</td>";
+
+ }
+ else {
+ echo "<td bgcolor=\"green\">".$md_ident[array_search($detailkey, $ibus_names)]['html']."(".$detailkey.")</td>";
+
+
+ }
+ #echo "</td>";
+ echo "<td>";
+
+ echo $detail_array[$detailkey];
+
+ echo "</tr>";
+ }
+ echo "</table></html>";
+}
+if ($_REQUEST['mdtype']=='html'){
+?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+ <head>
+ <title>GeoPortal Rheinland-Pfalz - Metadaten</title>
+ <meta name="description" content="Metadaten" xml:lang="de" />
+ <meta name="keywords" content="Metadaten" xml:lang="de" />
+ <meta http-equiv="cache-control" content="no-cache">
+ <meta http-equiv="pragma" content="no-cache">
+ <meta http-equiv="expires" content="0">
+ <meta http-equiv="content-language" content="de" />
+ <meta http-equiv="content-style-type" content="text/css" />
+<?php
+ echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/screen.css" media="screen" />
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/print.css" media="print" />
+ </head>
+ <body id="top" class="popup">
+
+
+ <div id="header_gray">
+ <a href="javascript:window.print()">Drucken <img src="../../../portal/fileadmin/design/images/icon_print.gif" width="14" height="14" alt="" /></a>
+ <a href="javascript:window.close()">Fenster schließen <img src="../../../portal/fileadmin/design/images/icon_close.gif" width="14" height="14" alt="" /></a>
+ </div>
+ <div id="header_redbottom"></div>
+ <div id="header_red"></div>
+
+ <div class="content">
+<?php
+
+
+
+ echo "<h1>Detailinformationen:</h1>";
+ #define table
+ echo "<html><table class='contenttable-0-wide'>";
+ echo "<tr>";
+ #loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
+ foreach ($detail_keys as $detailkey) {
+
+
+ if (in_array($detailkey, $ibus_names)==true){
+ echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['html']."</td>";
+ echo "<td>";
+ echo display_text($detail_array[$detailkey]);
+ echo "</td></tr>";
+ }
+ }
+ echo "</table></html>";
+}
+
+
+
+
+
+
+if ($_REQUEST['mdtype']=='iso19139') {
+//echo '<br><b>ISO19139 output comming soon!</b><br>';
+$iso19139 = new DOMDocument('1.0');
+$iso19139->encoding = 'UTF-8';
+#$iso19139->standalone = false;
+#Creating the "MD_Metadata" node
+$MD_Metadata = $iso19139->createElementNS('http://www.isotc211.org/2005/gmd', 'gmd:MD_Metadata');
+#$MD_Metadata=$iso19139->registerNamespace('srv','http://www.iso211.org/2005/srv');
+#$wmt_ms_capabilities->setAttribute("updateSequence", $wms_row["wms_timestamp"]);
+$MD_Metadata = $iso19139->appendChild($MD_Metadata);
+$MD_Metadata->setAttribute("xmlns:srv", "http://www.isotc211.org/2005/srv");
+$MD_Metadata->setAttribute("xmlns:gml", "http://www.opengis.net/gml");
+$MD_Metadata->setAttribute("xmlns:gco", "http://www.isotc211.org/2005/gco");
+$MD_Metadata->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
+$MD_Metadata->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+$MD_Metadata->setAttribute("xsi:schemaLocation", "http://www.isotc211.org/2005/gmd ./xsd/gmd/gmd.xsd://www.isotc211.org/2005/srv ./xsd/srv/srv.xsd");
+#generate language part B 10.3 (if available)
+$language = $iso19139->createElement("gmd:language");
+$languagecode = $iso19139->createElement("gmd:LanguageCode");
+if (isset($detail_array['t01_object.metadata_language'])) {
+$languageText = $iso19139->createTextNode($detail_array['t01_object.metadata_language']);
+}
+else {
+$languageText = $iso19139->createTextNode("not yet defined");
+}
+$languagecode->appendChild($languageText);
+$language ->appendChild($languagecode);
+$language=$MD_Metadata->appendChild($language);
+
+#generate MD_Scope part B 1.3 (if available)
+$hierarchyLevel = $iso19139->createElement("gmd:hierarchyLevel");
+$scopecode = $iso19139->createElement("gmd:MD_ScopeCode");
+if (isset($detail_array['t011_obj_geo.hierarchy_level'])) {
+$scopeText = $iso19139->createTextNode($detail_array['t011_obj_geo.hierarchy_level']);
+}
+else {
+$scopeText = $iso19139->createTextNode("not yet defined");
+}
+$scopecode->appendChild($scopeText);
+$hierarchyLevel->appendChild($scopecode);
+$hierarchyLevel=$MD_Metadata->appendChild($hierarchyLevel);
+#Part B 10.1
+$contact=$iso19139->createElement("gmd:contact");
+$CI_ResponsibleParty=$iso19139->createElement("gmd:CI_ResponsibleParty");
+$organisationName=$iso19139->createElement("gmd:organisationName");
+$organisationName_cs=$iso19139->createElement("gco:CharacterString");
+
+if (isset($detail_array['t011_obj_literatur.publisher'])) {
+$organisationNameText=$iso19139->createTextNode($detail_array['t011_obj_literatur.publisher']);
+}
+else
+{
+$organisationNameText=$iso19139->createTextNode('not given');
+}
+$contactInfo=$iso19139->createElement("gmd:contactInfo");
+$CI_Contact=$iso19139->createElement("gmd:CI_Contact");
+$address=$iso19139->createElement("gmd:address");
+$CI_Address=$iso19139->createElement("gmd:CI_Address");
+$electronicMailAddress=$iso19139->createElement("gmd:electronicMailAddress");
+$electronicMailAddress_cs=$iso19139->createElement("gco:CharacterString");
+
+if (isset($detail_array['t021_communication.comm_value'])) {
+$electronicMailAddressText=$iso19139->createTextNode($detail_array['t021_communication.comm_value']);
+}
+else
+{
+$electronicMailAddressText=$iso19139->createTextNode('not given');
+}
+
+#create xml tree
+$organisationName_cs->appendChild($organisationNameText);
+$organisationName->appendChild($organisationName_cs);
+$CI_ResponsibleParty->appendChild($organisationName);
+
+$electronicMailAddress_cs->appendChild($electronicMailAddressText);
+$electronicMailAddress->appendChild($electronicMailAddress_cs);
+$CI_Address->appendChild($electronicMailAddress);
+$address->appendChild($CI_Address);
+$CI_Contact->appendChild($address);
+$contactInfo->appendChild($CI_Contact);
+$CI_ResponsibleParty->appendChild($contactInfo);
+
+$contact->appendChild($CI_ResponsibleParty);
+$MD_Metadata->appendChild($contact);
+
+
+#generate dateStamp part B 10.2 (if available)
+$dateStamp = $iso19139->createElement("gmd:dateStamp");
+$mddate = $iso19139->createElement("gco:Date");
+if (isset($detail_array['t01_object.mod_time'])) {
+$mddateText = $iso19139->createTextNode($detail_array['t01_object.mod_time']);
+}
+else {
+$mddateText = $iso19139->createTextNode("not yet defined");
+}
+$mddate->appendChild($mddateText);
+$dateStamp->appendChild($mddate);
+$dateStamp=$MD_Metadata->appendChild($dateStamp);
+#do the things for identification
+#create nodes
+$identificationInfo=$iso19139->createElement("gmd:identificationInfo");
+$MD_DataIdentification=$iso19139->createElement("gmd:MD_DataIdentification");
+#add attribut
+$MD_DataIdentification->setAttribute("id", "dataId");
+$citation=$iso19139->createElement("gmd:citation");
+$CI_Citation=$iso19139->createElement("gmd:CI_Citation");
+#create nodes for things which are defined - howto do the multiplicities? Ask Martin!
+#Create Resource title element B 1.1
+$title=$iso19139->createElement("gmd:title");
+$title_cs=$iso19139->createElement("gco:CharacterString");
+if (isset($detail_array['title'])) {
+$titleText = $iso19139->createTextNode($detail_array['title']);
+}
+else {
+$titleText = $iso19139->createTextNode("not yet defined");
+}
+$title_cs->appendChild($titleText);
+$title->appendChild($title_cs);
+$CI_Citation->appendChild($title);
+
+#Create date elements B5.2-5.4
+
+#Do things for B 5.2 date of publication
+if (isset($detail_array['t0113_dataset_reference.reference_date'])) {
+$date1=$iso19139->createElement("gmd:date");
+$CI_Date=$iso19139->createElement("gmd:CI_Date");
+$date2=$iso19139->createElement("gmd:date");
+$gcoDate=$iso19139->createElement("gco:Date");
+$dateType=$iso19139->createElement("gmd:dateType");
+$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
+
+
+
+
+$dateTypeCodeText=$iso19139->createTextNode('publication');
+$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
+$dateTypeCode->appendChild($dateTypeCodeText);
+$dateType->appendChild($dateTypeCode);
+$gcoDate->appendChild($dateText);
+$date2->appendChild($gcoDate);
+$CI_Date->appendChild($date2);
+$CI_Date->appendChild($dateType);
+$date1->appendChild($CI_Date);
+$CI_Citation->appendChild($date1);
+}
+
+#Do things for B 5.3 date of revision
+if (isset($detail_array['t01_object.time_status'])) {
+$date1=$iso19139->createElement("gmd:date");
+$CI_Date=$iso19139->createElement("gmd:CI_Date");
+$date2=$iso19139->createElement("gmd:date");
+$gcoDate=$iso19139->createElement("gco:Date");
+$dateType=$iso19139->createElement("gmd:dateType");
+$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
+$dateTypeCodeText=$iso19139->createTextNode('revision');
+$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
+$dateTypeCode->appendChild($dateTypeCodeText);
+$dateType->appendChild($dateTypeCode);
+$gcoDate->appendChild($dateText);
+$date2->appendChild($gcoDate);
+$CI_Date->appendChild($date2);
+$CI_Date->appendChild($dateType);
+$date1->appendChild($CI_Date);
+$CI_Citation->appendChild($date1);
+}
+
+#Do things for B 5.4 date of creation
+if (isset($detail_array['txx'])) {
+$date1=$iso19139->createElement("gmd:date");
+$CI_Date=$iso19139->createElement("gmd:CI_Date");
+$date2=$iso19139->createElement("gmd:date");
+$gcoDate=$iso19139->createElement("gco:Date");
+$dateType=$iso19139->createElement("gmd:dateType");
+$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
+$dateTypeCodeText=$iso19139->createTextNode('creation');
+$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
+$dateTypeCode->appendChild($dateTypeCodeText);
+$dateType->appendChild($dateTypeCode);
+$gcoDate->appendChild($dateText);
+$date2->appendChild($gcoDate);
+$CI_Date->appendChild($date2);
+$CI_Date->appendChild($dateType);
+$date1->appendChild($CI_Date);
+$CI_Citation->appendChild($date1);
+}
+#Do things for B 1.5 Resource unique identifier
+$identifier=$iso19139->createElement("gmd:identifier");
+$rs_identifier=$iso19139->createElement("gmd:RS_Identifier");
+$code=$iso19139->createElement("gmd:code");
+$code_cs=$iso19139->createElement("gco:CharacterString");
+$codeText=$iso19139->createTextNode($detail_array['t01_object.obj_id']);
+$code_cs->appendChild($codeText);
+$code->appendChild($code_cs);
+$rs_identifier->appendChild($code);
+$identifier->appendChild($rs_identifier);
+$CI_Citation->appendChild($identifier);
+
+
+
+#create tree
+
+$citation->appendChild($CI_Citation);
+$MD_DataIdentification->appendChild($citation);
+
+#Create part for abstract B 1.2
+$abstract=$iso19139->createElement("gmd:abstract");
+$abstract_cs=$iso19139->createElement("gco:CharacterString");
+if (isset($detail_array['summary'])) {
+$abstractText = $iso19139->createTextNode($detail_array['summary']);
+}
+else {
+$abstractText = $iso19139->createTextNode("not yet defined");
+}
+$abstract_cs->appendChild($abstractText);
+$abstract->appendChild($abstract_cs);
+$MD_DataIdentification->appendChild($abstract);
+#End for abstract
+#Create part for point of contact
+#Define relevant objects
+$pointOfContact=$iso19139->createElement("gmd:pointOfContact");
+$CI_ResponsibleParty=$iso19139->createElement("gmd:CI_ResponsibleParty");
+$organisationName=$iso19139->createElement("gmd:organisationName");
+$orgaName_cs=$iso19139->createElement("gco:CharacterString");
+$contactInfo=$iso19139->createElement("gmd:contactInfo");
+$CI_Contact=$iso19139->createElement("gmd:CI_Contact");
+$address_1=$iso19139->createElement("gmd:adress");
+$CI_Address=$iso19139->createElement("gmd:CI_Address");
+$electronicMailAddress=$iso19139->createElement("gmd:electronicMailAddress");
+$email_cs=$iso19139->createElement("gco:CharacterString");
+$role=$iso19139->createElement("gmd:role");
+$CI_RoleCode=$iso19139->createElement("gmd:CI_RoleCode");
+
+
+if (isset($detail_array['t011_obj_literature_publishing'])) {
+$resOrgaText = $iso19139->createTextNode($detail_array['t011_obj_literature_publishing']);
+}
+else {
+$resOrgaText= $iso19139->createTextNode("not yet defined");
+}
+if (isset($detail_array['tmail'])) {
+$resMailText = $iso19139->createTextNode($detail_array['tmail']);
+}
+else {
+$resMailText = $iso19139->createTextNode("really wanted by INSPIRE?");
+}
+if (isset($detail_array['t012_obj_adr.special_name'])) {
+$resRoleText = $iso19139->createTextNode($detail_array['t012_obj_adr.special_name']);
+}
+else {
+$resRoleText = $iso19139->createTextNode("not yet defined");
+}
+#put them in xml
+$orgaName_cs->appendChild($resOrgaText);
+$CI_ResponsibleParty->appendChild($orgaName_cs);
+
+$email_cs->appendChild($resMailText);
+$electronicMailAddress->appendChild($email_cs);
+$CI_Address->appendChild($electronicMailAddress);
+$address_1->appendChild($CI_Address);
+$CI_Contact->appendChild($address_1);
+$contactInfo->appendChild($CI_Contact);
+$CI_ResponsibleParty->appendChild($contactInfo);
+
+$CI_RoleCode->appendChild($resRoleText);
+$role->appendChild($CI_RoleCode);
+$CI_ResponsibleParty->appendChild($role);
+
+$pointOfContact->appendChild($CI_ResponsibleParty);
+
+
+$MD_DataIdentification->appendChild($pointOfContact);
+#Part B 3 INSPIRE Category
+
+#do only if INSPIRE keyword (Annex I-III) is set
+if (isset($detail_array['t011_obj_literatur.base'])) {
+
+$descriptiveKeywords=$iso19139->createElement("gmd:descriptiveKeywords");
+$MD_Keywords=$iso19139->createElement("gmd:MD_Keywords");
+$keyword=$iso19139->createElement("gmd:keyword");
+$keyword_cs=$iso19139->createElement("gco:CharacterString");
+
+$keywordText = $iso19139->createTextNode($detail_array['t011_obj_literatur.base']);
+
+$thesaurusName=$iso19139->createElement("gmd:thesaurusName");
+$CI_Citation=$iso19139->createElement("gmd:CI_Citation");
+$title=$iso19139->createElement("gmd:title");
+$title_cs=$iso19139->createElement("gco:CharacterString");
+$titleText=$iso19139->createTextNode('GEMET Thesaurus version 1.0.0'); # to be adopted to get dynamically
+$date_1=$iso19139->createElement("gmd:date");
+
+$CI_Date=$iso19139->createElement("gmd:CI_Date");
+$date_2=$iso19139->createElement("gmd:date");
+$date_date=$iso19139->createElement("gco:Date");
+$dateText=$iso19139->createTextNode('2008-12-08');
+$dateType=$iso19139->createElement("gmd:dateType");
+$CI_DateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
+$CI_DateTypeCodeText=$iso19139->createTextNode('publication'); #to be adopted to get dynamically
+
+#write to xml tree
+$keyword_cs->appendChild($keywordText);
+$keyword->appendChild($keyword_cs);
+$MD_Keywords->appendChild($keyword);
+
+$title_cs->appendChild($titleText);
+$title->appendChild($title_cs);
+
+$CI_DateTypeCode->appendChild($CI_DateTypeCodeText);
+$dateType->appendChild($CI_DateTypeCode);
+
+
+$date_date->appendChild($dateText);
+$date_2->appendChild($date_date);
+
+$CI_Date->appendChild($date_2);
+$CI_Date->appendChild($dateType);
+
+$date_1->appendChild($CI_Date);
+
+$CI_Citation->appendChild($title);
+$CI_Citation->appendChild($date_1);
+
+$thesaurusName->appendChild($CI_Citation);
+$MD_Keywords->appendChild($thesaurusName);
+
+$descriptiveKeywords->appendChild($MD_Keywords);
+
+$MD_DataIdentification->appendChild($descriptiveKeywords);
+}
+#Resource Constraints B 8
+if (isset($detail_array['t01_object.avail_access_note'])){
+
+$resourceConstraints1=$iso19139->createElement("gmd:resourceConstraints");
+$MD_LegalConstraints1=$iso19139->createElement("gmd:MD_LegalConstraints");
+$accessConstraints=$iso19139->createElement("gmd:accessConstraints");
+$MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
+$MD_RestrictionCodeText=$iso19139->createTextNode($detail_array['t01_object.avail_access_note']);
+
+$MD_RestrictionCode->appendChild($MD_RestrictionCodeText);
+$accessConstraints->appendChild($MD_RestrictionCode);
+$MD_LegalConstraints1->appendChild($accessConstraints);
+$resourceConstraints1->appendChild($MD_LegalConstraints1);
+
+$MD_DataIdentification->appendChild($resourceConstraints1);
+}
+
+if(isset($detail_array['t01_object.fees'])){
+$resourceConstraints2=$iso19139->createElement("gmd:resourceConstraints");
+$MD_LegalConstraints2=$iso19139->createElement("gmd:MD_LegalConstraints");
+$useLimitation=$iso19139->createElement("gmd:useLimitation");
+$useLimitation_cs=$iso19139->createElement("gco:CharacterString");
+$useLimitationText=$iso19139->createTextNode($detail_array['t01_object.fees']);
+
+$useLimitation_cs->appendChild($useLimitationText);
+$useLimitation->appendChild($useLimitation_cs);
+$MD_LegalConstraints2->appendChild($useLimitation);
+$resourceConstraints2->appendChild($MD_LegalConstraints2);
+
+$MD_DataIdentification->appendChild($resourceConstraints2);
+}
+# Part B 1.7 Dataset Language
+if(isset($detail_array['t01_object.data_language'])){
+$language=$iso19139->createElement("gmd:language");
+$LanguageCode=$iso19139->createElement("gmd:LanguageCode");
+
+$LanguageCodeText=$iso19139->createTextNode($detail_array['t01_object.data_language']);
+
+
+$LanguageCode->appendChild($LanguageCodeText);
+$language->appendChild($LanguageCode);
+
+
+
+$MD_DataIdentification->appendChild($language);
+}
+
+
+
+#Topic Category B 2.1
+if(isset($detail_array['t011_obj_geo_topic_cat.topic_category'])){
+$topicCategory=$iso19139->createElement("gmd:topicCategory");
+$MD_TopicCategoryCode=$iso19139->createElement("gmd:MD_TopicCategoryCode");
+
+$MD_TopicCategoryText=$iso19139->createTextNode($detail_array['t011_obj_geo_topic_cat.topic_category']);
+
+
+$MD_TopicCategoryCode->appendChild($MD_TopicCategoryText);
+$topicCategory->appendChild($MD_TopicCategoryCode);
+
+
+
+$MD_DataIdentification->appendChild($topicCategory);
+}
+#Topic Category B 2.1
+if(isset($detail_array['x1']) and isset($detail_array['x2']) and isset($detail_array['y1']) and isset($detail_array['y2'])){
+
+$extent=$iso19139->createElement("gmd:extent");
+$EX_Extent=$iso19139->createElement("gmd:EX_Extent");
+$geographicElement=$iso19139->createElement("gmd:geographicElement");
+$EX_GeographicBoundingBox=$iso19139->createElement("gmd:EX_GeographicBoundingBox");
+
+$westBoundLongitude=$iso19139->createElement("gmd:westBoundLongitude");
+$wb_dec=$iso19139->createElement("gco:Decimal");
+$wb_text=$iso19139->createTextNode($detail_array['x1']);
+
+$eastBoundLongitude=$iso19139->createElement("gmd:eastBoundLongitude");
+$eb_dec=$iso19139->createElement("gco:Decimal");
+$eb_text=$iso19139->createTextNode($detail_array['x2']);
+
+$southBoundLatitude=$iso19139->createElement("gmd:southBoundLatitude");
+$sb_dec=$iso19139->createElement("gco:Decimal");
+$sb_text=$iso19139->createTextNode($detail_array['y1']);
+
+$northBoundLatitude=$iso19139->createElement("gmd:northBoundLatitude");
+$nb_dec=$iso19139->createElement("gco:Decimal");
+$nb_text=$iso19139->createTextNode($detail_array['y2']);
+
+
+$wb_dec->appendChild($wb_text);
+$westBoundLongitude->appendChild($wb_dec);
+$EX_GeographicBoundingBox->appendChild($westBoundLongitude);
+
+$eb_dec->appendChild($eb_text);
+$eastBoundLongitude->appendChild($eb_dec);
+$EX_GeographicBoundingBox->appendChild($eastBoundLongitude);
+
+$sb_dec->appendChild($sb_text);
+$southBoundLatitude->appendChild($sb_dec);
+$EX_GeographicBoundingBox->appendChild($southBoundLatitude);
+
+$nb_dec->appendChild($nb_text);
+$northBoundLatitude->appendChild($nb_dec);
+$EX_GeographicBoundingBox->appendChild($northBoundLatitude);
+
+$geographicElement->appendChild($EX_GeographicBoundingBox);
+$EX_Extent->appendChild($geographicElement);
+$extent->appendChild($EX_Extent);
+
+
+$MD_DataIdentification->appendChild($extent);
+}
+
+
+
+
+
+
+$identificationInfo->appendChild($MD_DataIdentification);
+$MD_Metadata->appendChild($identificationInfo);
+
+
+
+
+
+header("Content-type: application/xhtml+xml; charset=UTF-8");
+
+
+echo $iso19139->saveXml();
+
+
+
+
+
+
+
+
+
+
+
+}
+if ($_REQUEST['mdtype']=='inspire') {
+?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+ <head>
+ <title>GeoPortal Rheinland-Pfalz - Metadaten</title>
+ <meta name="description" content="Metadaten" xml:lang="de" />
+ <meta name="keywords" content="Metadaten" xml:lang="de" />
+ <meta http-equiv="cache-control" content="no-cache">
+ <meta http-equiv="pragma" content="no-cache">
+ <meta http-equiv="expires" content="0">
+ <meta http-equiv="content-language" content="de" />
+ <meta http-equiv="content-style-type" content="text/css" />
+<?php
+ echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/screen.css" media="screen" />
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/print.css" media="print" />
+ </head>
+ <body id="top" class="popup">
+
+
+ <div id="header_gray">
+ <a href="javascript:window.print()">Drucken <img src="../../../portal/fileadmin/design/images/icon_print.gif" width="14" height="14" alt="" /></a>
+ <a href="javascript:window.close()">Fenster schließen <img src="../../../portal/fileadmin/design/images/icon_close.gif" width="14" height="14" alt="" /></a>
+ </div>
+ <div id="header_redbottom"></div>
+ <div id="header_red"></div>
+
+ <div class="content">
+<?php
+
+
+
+ echo "<img border=\"0\" src=\"img/inspire_tr_100.png\" alt=\"INSPIRE Logo\"><h1>INSPIRE Metadaten:</h1>";
+ #define table
+ echo "<html><table class='contenttable-0-wide'>";
+ echo "<tr>";
+ #loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
+ foreach ($detail_keys as $detailkey) {
+
+
+ if (in_array($detailkey, $ibus_names)==true){
+ if ($md_ident[array_search($detailkey, $ibus_names)]['inspiremandatory']=='true') {
+ echo "<td>".$md_ident[array_search($detailkey, $ibus_names)]['inspire']."</td>";
+ echo "<td>";
+ echo display_text($detail_array[$detailkey]);
+ echo "</td></tr>";
+ }
+ }
+ }
+ echo "</table></html>";
+
+
+
+
+
+
+
+
+echo '<br><b>INSPIRE output not completly implemented!<b><br>';
+}
+
+
+
+#phpinfo();
+#$xmltest = new DOMDocument;
+#$xmltest=simplexml_load_file('/home/armin/Desktop/GDI-RP/metadaten/detail_portalu.xml');
+#$xsl = new DOMDocument;
+#var_dump($xmltest);
+//$xsl->load('simplesearch_overview.xsl');
+#$xsl=simplexml_load_file('/home/workspace/mapbender_rp/http/geoportal/opensearch2html.xsl');
+// Configure the transformer
+#var_dump($xsl);
+#$proc = new XSLTProcessor;
+#$proc->importStyleSheet($xsl); // attach the xsl rules
+#var_dump($proc);
+#$trans = $proc->transformToXML($xmltest);
+#var_dump($trans);
+
+?>
Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php 2010-12-17 11:28:38 UTC (rev 7328)
+++ trunk/mapbender/http/php/mod_callMetadata.php 2010-12-17 12:01:51 UTC (rev 7329)
@@ -20,7 +20,7 @@
session_start();
//initialize request parameters:
$searchId = "dummysearch";
-$searchText = "e";
+$searchText = "*";
#$registratingDepartments = "33,29,30,31,35,40,61,101,87,44";
$registratingDepartments = NULL;
#$isoCategories = "1,2,3";
@@ -80,6 +80,9 @@
}
$searchText = $testMatch;
$testMatch = NULL;
+ if ($searchText ==='false') {
+ $searchText ='*';
+ }
}
if (isset($_REQUEST["registratingDepartments"]) & $_REQUEST["registratingDepartments"] != "") {
//validate to csv integer list
More information about the Mapbender_commits
mailing list