[Mapbender-commits] r4518 - branches/mifan_dev/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Aug 13 17:56:12 EDT 2009


Author: mifan
Date: 2009-08-13 17:56:11 -0400 (Thu, 13 Aug 2009)
New Revision: 4518

Removed:
   branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php
Log:


Deleted: branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php
===================================================================
--- branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2009-08-13 21:40:20 UTC (rev 4517)
+++ branches/mifan_dev/mapbender/http/php/mod_searchCatQueryBuilder_server.php	2009-08-13 21:56:11 UTC (rev 4518)
@@ -1,237 +0,0 @@
-<?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_csw.php"); 
-require_once(dirname(__FILE__)."/../classes/class_cswrecord.php"); 
-require_once(dirname(__FILE__)."/../classes/class_administration.php"); 
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-
-/*
- * get catalogs for gui
- * get get/post url for catalog
- * construct query on url via get/xml
- * make queries sequentially
- * parse responses
- * show responses with cat-name in results	
- */
-
-$DEBUG_ = true;
-
-//Init Variables
-$userId = $_SESSION["mb_user_id"];
-$command = $_REQUEST["command"];
-$guiId = $_REQUEST["guiId"];
-$simplesearch = $_REQUEST['search'];
-$getrecords_type = $_REQUEST['getrecordsmedia'];
-$getrecords_query = $_REQUEST['getrecordsquery'];
-
-$admin = new administration();
-$guiIdArray = $admin->getGuisByPermission($userId, false);
-
-$resultObj = array();
-$resultObj['cats'] = array();
-
-if($DEBUG_)
-array_push($resultObj['cats'],array("id"=>'id',"title"=>'test'));
-
-if ($command == "getrecordssimple") {
-	//$resultObj["cats"] = array();
-	if($DEBUG_)
-	array_push($resultObj['cats'],array("id"=>'id2',"title"=>$getrecords_type));	
-	$catalogIDs = array();
-	
-	switch(mb_strtolower($getrecords_type)){
-		case 'get':
-			$catalogIDs = get_catalogs_by_supported_type(get_catalogs_for_gui($guiId),'getrecords','get');		
-			break;
-		case 'post':
-			$catalogIDs = get_catalogs_by_supported_type(get_catalogs_for_gui($guiId),'getrecords','post');
-			break;
-		case 'soap':
-			$catalogIDs = get_catalogs_by_supported_type(get_catalogs_for_gui($guiId),'getrecords','soap');
-			break;
-		default:
-			$catalogIDs = get_catalogs_by_supported_type(get_catalogs_for_gui($guiId),'getrecords','get');
-	}
-	
-	//main controller
-	foreach($catalogIDs as $catalog_id=>$url){
-		array_push($resultObj['cats'],array("id"=>$catalog_id,"title"=>$getrecords_type));
-		//$cat_obj = new csw();
-		//$cat_obj->createCatObjFromDB($catalogs);
-		list($getrecordsurl,$getrecordsxml) = getrecords_get_build_query($url,$simplesearch);
-		
-		//Create Record Objects
-		$RecordObj = new cswrecord();
-		$RecordObj->createCSWRecordFromXML($getrecordsurl,$getrecordsxml);
-		
-		//Populate JSON for each summary record for each catalog
-		foreach ($RecordObj->SummaryRecordsArray as $SummaryRecordObj){
-			$title = $SummaryRecordObj;
-			array_push($resultObj['cats'],array("id"=>$catalog_id,"title"=>$getrecords_type));
-		}
-		
-	}
-}
-
-/**
- * Build Query
- * @param $getrecords_url
- * @return array URL and XML
- */
-function getrecords_build_query($getrecords_url){
-	
-	//CHECK FOR COMMAND, GET POST. HANDLE THINGS HERE
-	return array('url'=>$url,'xml'=>$xml);
-}
-
-/**
- * 
- * @param $gui_id
- * @param $getrecords_type
- * @return array list of cats
- */
-function get_catalogs_for_gui($gui_id){
-	$sql = "select fkey_cat_id from gui_cat where fkey_gui_id = $1";
-	$v = array($gui_id);
-	$t = array('s');
-	$res = db_prep_query($sql,$v,$t);
-	$list_of_cat = array();
-	while($row = db_fetch_array($res)){
-		array_push($list_of_cat,$row['fkey_cat_id']);
-	}
-	return $list_of_cat;
-}
-
-function get_url_for_operation($catalog_id,$operation_type,$fetch_mode){
-	
-}
-
-function do_getrecords_get($catalog_id_array){
-	
-}
-
-/**
- * http://geomatics.nlr.nl/excat/csw?request=GetRecords&service=CSW&version=2.0.2&ResultType=results&TypeName=csw:Record&TYPENAMES=csw:dataset
- * @param $url
- * @param $search
- * @return unknown_type
- */
-function getrecords_get_build_query($url,$search){
-
-	$request = 'GetRecords';
-	$version = '2.0.2';
-	$resulttype = 'results';
-	$typename = 'csw:Record';
-	$service='CSW';
-
-	$url_encode = $url.'?request='.$request.'&service='.$service.'&ResultType='.$resulttype.'&TypeNames='.$typename;
-	$url_encode = urlencode($url_encode);
-	
-	return $url_encode;
-}
-
-/**
- * Get catalog URL which support fetch mode for operation type
- * @param $cat_array array of catalogs for guis
- * @param $operation_type getrecords,describerecords..
- * @param $fetch_mode get|post|soap
- * @return array of supported catalog ids
- */
-function get_catalogs_by_supported_type($cat_array,$operation_type,$fetch_mode){
-	$cat_supported = array();
-	$sql = "select fk_cat_id,param_value from cat_op_conf where param_name=$1 and param_type=$2";
-	$v = array($fetch_mode,$operation_type);	
-	$t = array('s','s');
-	$res = db_prep_query($sql,$v,$t);
-	
-	while($row = db_fetch_array($res)){
-		//array_push($list_of_cat,$row['fkey_cat_id']);
-		if(in_array($row['fk_cat_id'],$cat_array)){
-			//array_push($cat_supported,$row['fk_cat_id']);
-			$cat_supported[$row['fk_cat_id']] = $row['param_value'];
-		}
-	}
-	return $cat_supported;
-}
-
-/**
- * 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 build_simple_query_get()
-{
-		
-}
-
-
-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