[Mapbender-commits] r4329 - branches/mifan_dev/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jul 9 09:11:58 EDT 2009


Author: mifan
Date: 2009-07-09 09:11:57 -0400 (Thu, 09 Jul 2009)
New Revision: 4329

Modified:
   branches/mifan_dev/mapbender/http/classes/class_csw.php
Log:
database entry

Modified: branches/mifan_dev/mapbender/http/classes/class_csw.php
===================================================================
--- branches/mifan_dev/mapbender/http/classes/class_csw.php	2009-07-09 09:01:56 UTC (rev 4328)
+++ branches/mifan_dev/mapbender/http/classes/class_csw.php	2009-07-09 13:11:57 UTC (rev 4329)
@@ -63,6 +63,9 @@
 	
 	var $catowner;
 	var $cattimestamp;
+	var $providername;
+	var $providersite;
+	var $delivery='';
 	
 	//store catalog retrieval status
 	var $cat_status;
@@ -106,7 +109,6 @@
 		//operational vars
 		$op_type=null; //get-capabilities, getrecords ...
 		
-		
 		$this->cat_getcapabilities_doc = $data;
 		$this->cat_upload_url = $url;
 		$this->cat_id="";//Auto-assing catalog id
@@ -131,9 +133,10 @@
 		foreach($value_array as $element){
 			//Version
 			
+			/*			
 			echo "Print:";
-			print_r($element);
-			/*
+			//print_r($element);
+			
 			print_r ($element);
 			echo "\n";
 			*/
@@ -201,8 +204,6 @@
 			}
 			
 			//Handle operational elements
-			
-			
 			//Open operational element
 			if((mb_strtoupper($element[tag]) == "OWS:OPERATION" OR mb_strtoupper($element[tag]) == "OPERATION") && $element[type] == "open"){
 				$op_type = $element[attributes][name];
@@ -233,9 +234,6 @@
 				$op_type = null;
 			}
 			
-			
-		
-			
 		}
 		
 		//Success/Failure
@@ -270,55 +268,57 @@
 	public function setCatObjToDB($gui)
 	{
 		global $con;
-		//db_begin();
-		$sql = "INSERT INTO cat ()";
-		echo "HELLO THERE";
+		
+		$admin = new administration();//to char_encode XML
+		db_begin();
+		
+		# INSERT INTO TABLE cat - auto insert cat_id
+		$sql = "INSERT INTO cat( ";
+        $sql .= "cat_version, cat_title, cat_abstract, cat_op_getcapabilities, "; 
+        $sql .= "cat_op_describerecord, cat_op_getrecords, cat_op_getrecordbyid, "; 
+        $sql .= "cat_upload_url, fees, accessconstraints, providername, providersite, "; 
+        $sql .= "individualname, positionname, voice, facsimile, deliverypoint, "; 
+        $sql .= "city, administrativearea, postalcode, country, electronicmailaddress, "; 
+        $sql .= "cat_getcapabilities_doc, cat_owner, cat_timestamp) ";
+    	$sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25)";
+    	
+		$v = array($this->cat_version,$this->cat_title,$this->cat_abstract,$this->cat_op_getcapabilities,
+			$this->cat_op_describerecord,$this->cat_op_getrecords,$this->cat_op_getrecordbyid,
+			$this->cat_upload_url,$this->fees,$this->accessconstraints,$this->providername,$this->providersite,
+			$this->contactperson, $this->contactposition, $this->contactvoicetelephone,$this->contactfacsimiletelephone,$this->delivery,
+			$this->city,$this->address,$this->postcode,$this->country,$this->contactelectronicmailaddress,
+			$admin->char_encode($this->cat_getcapabilities_doc),
+			$_SESSION['mb_user_id'],strtotime("now"));
+			
+		$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i');
+		
+		$res = db_prep_query($sql,$v,$t);
+		if(!$res){
+			db_rollback();
+		}
+		
+		echo $sql;
+		$cat_insert_id = db_insert_id($con,'cat', 'cat_id');
+		
+		//Commit Changes
+		db_commit();
+		
+		$this->cat_id = $cat_insert_id;
 	}
 	
 	public function displayCatalog(){
-		echo "<br>id: " . $this->wms_id . " <br>";
-		echo "version: " . $this->cat_version . " <br>";
-		echo "title: " . $this->cat_title . " <br>";
-		echo "abstract: " . $this->cat_abstract . " <br>";
-		echo "maprequest: " . $this->wms_getmap . " <br>";
-		echo "capabilitiesrequest: " . $this->wms_getcapabilities . " <br>";
-		echo "featureinforequest: " . $this->wms_getfeatureinfo . " <br>";
-		echo "gui_wms_mapformat: " . $this->gui_wms_mapformat . " <br>";
-		echo "gui_wms_featureinfoformat: " . $this->gui_wms_featureinfoformat . " <br>";
-		echo "gui_wms_exceptionformat: " . $this->gui_wms_exceptionformat . " <br>";	
-		echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
-		echo "wms_srs: " . $this->objLayer[0]->wms_srs1 . " <br>";		
-		echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
-		echo "gui_wms_opacity: " . $this->gui_wms_opacity . " <br>";
-		echo "support_sld: " . $this->wms_supportsld . " <br>";
+		echo "Catalog Details";
+		echo "<br>id: " . $this->cat_id . " <br>";
+		echo "Version: " . $this->cat_version . " <br>";
+		echo "Title: " . $this->cat_title . " <br>";
+		echo "Abstract: " . $this->cat_abstract . " <br>";
+		echo "Capabilitiesrequest: " . $this->cat_op_getcapabilities . " <br>";
+		echo "Getrecordsrequest: " . $this->cat_op_getrecords . " <br>";
+		echo "Getrecordbyidrequest: " . $this->cat_op_getrecordbyid . " <br>";
+		echo "Describerecord: " . $this->cat_op_describerecord . " <br>";
+
+		echo "<hr>";
 		
-		for($i=0; $i<count($this->data_type);$i++){
-			echo $this->data_type[$i]. " -> ".$this->data_format[$i]. "<br>";
-		}
-		for($i=0; $i<count($this->objLayer); $i++){
-			echo "<hr>";
-			echo "id: <b>".$this->objLayer[$i]->layer_id ."</b> parent: <b>".$this->objLayer[$i]->layer_parent."</b> name: <b>".$this->objLayer[$i]->layer_name;
-			echo "</b> title: <b>".$this->objLayer[$i]->layer_title. "</b> queryable: <b>".$this->objLayer[$i]->layer_queryable."</b> minScale: <b>". $this->objLayer[$i]->layer_minscale."</b> maxScale: <b>".$this->objLayer[$i]->layer_maxscale."</b>";
-			echo "<br>dataurl: <b>".$this->objLayer[$i]->layer_dataurl_href. "</b>";
-			echo "<br>metadataurl: <b>".$this->objLayer[$i]->layer_metadataurl. "</b>";
-			echo "<table border='1'>";
-			for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
-				echo "<tr><td>".$this->objLayer[$i]->layer_epsg[$j][epsg]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][minx]."</td>";
-				echo "<td>".$this->objLayer[$i]->layer_epsg[$j][miny]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][maxx]."</td>";
-				echo "<td>".$this->objLayer[$i]->layer_epsg[$j][maxy]."</td></tr>";
-			}
-			echo "</table>";
-			echo "layerstyle:";
-			echo "<table border='1'>";
-			echo "<tr><td>name</td><td>title</td><td>legendurl</td><td>legendurlformat</td></tr>";
-			for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
-				echo "<tr><td>".$this->objLayer[$i]->layer_style[$j][name]."</td><td>".$this->objLayer[$i]->layer_style[$j][title]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurl]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurlformat]."</td></tr>";
-			}
-			echo "</table>";
-	        echo "<hr>";
-	        echo "<hr>";
-		}
-		
 	} 
 	
 	/**



More information about the Mapbender_commits mailing list