[Mapbender-commits] r4423 - branches/mifan_dev/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jul 27 08:28:06 EDT 2009
Author: mifan
Date: 2009-07-27 08:28:06 -0400 (Mon, 27 Jul 2009)
New Revision: 4423
Added:
branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php
Log:
getrecords xml builder
Added: branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php
===================================================================
--- branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php (rev 0)
+++ branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php 2009-07-27 12:28:06 UTC (rev 4423)
@@ -0,0 +1,107 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wms
+# 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.
+
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$userId = $_SESSION["mb_user_id"];
+$command = $_GET["command"];
+$guiId = $_GET["guiId"];
+$simplesearch = $_REQUEST['search'];
+
+
+$admin = new administration();
+$guiIdArray = $admin->getGuisByPermission($userId, false);
+
+$resultObj = array();
+
+?>
+<script type='text/javascript'>alert('hello');</script>
+<?php
+
+echo "text";
+
+if ($command == "getrecordssimple") {
+ $resultObj["cats"] = array();
+ $xml_req = build_getrecords_xml();
+
+ $url = urlencode('http://gdi-de.sdisuite.de/soapServices/CSWStartup');
+ $data = getrecords_post($url,$xml_req);
+ array_push($resultObj['cats'],$data);
+ array_push($resultObj['cats'],'something');
+ //echo $data;
+}
+
+
+/**
+ * Build XML query for getrecords
+ * @return string xml file
+ * @todo: get values dynamically
+ */
+function build_getrecords_xml() {
+ $xml = '<?xml version="1.0" encoding="UTF-8"?>';
+ $xml .= '<GetRecords';
+ $xml .= 'service="CSW"';
+ $xml .= 'version="2.0.2"';
+ $xml .= 'maxRecords="5"';
+ $xml .= 'startPosition="1"';
+ $xml .= 'resultType="results"';
+ $xml .= 'outputFormat="application/xml"';
+ $xml .= 'outputSchema="http://www.opengis.net/cat/csw/2.0.2"';
+ $xml .= 'xmlns="http://www.opengis.net/cat/csw/2.0.2"';
+ $xml .= 'xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"';
+ $xml .= 'xmlns:ogc="http://www.opengis.net/ogc"';
+ $xml .= 'xmlns:ows="http://www.opengis.net/ows"';
+ $xml .= 'xmlns:dc="http://purl.org/dc/elements/1.1/"';
+ $xml .= 'xmlns:dct="http://purl.org/dc/terms/"';
+ $xml .= 'xmlns:gml="http://www.opengis.net/gml"';
+ $xml .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
+ $xml .= 'xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2/CSW-discovery.xsd">';
+ $xml .= '<Query typeNames="csw:Record">';
+ $xml .= '</Query>';
+ $xml .= '</GetRecords>';
+
+ return $xml;
+
+}
+
+
+function getrecords_post ($url, $postData) {
+ $connection = new connector();
+ $connection->set("httpType", "post");
+ $connection->set("httpContentType", "xml");
+ $connection->set("httpPostData", $postData);
+
+ $e = new mb_notice("CAT REQUEST: " . $url . "\n\n" . $postData);
+ $data = $connection->load($url);
+ if (!$data) {
+ $e = new mb_exception("CAT getrecords returned no result: " . $url . "\n" . $postData);
+ return null;
+ }
+ return $data;
+}
+
+$json = new Mapbender_JSON();
+$output = $json->encode($resultObj);
+echo $output;
+
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list