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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 11 12:15:02 EDT 2010


Author: christoph
Date: 2010-05-11 12:15:00 -0400 (Tue, 11 May 2010)
New Revision: 6182

Modified:
   trunk/mapbender/http/classes/class_wms.php
Log:


Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2010-05-11 16:00:58 UTC (rev 6181)
+++ trunk/mapbender/http/classes/class_wms.php	2010-05-11 16:15:00 UTC (rev 6182)
@@ -37,6 +37,7 @@
 	var $wms_getlegendurl;
 	var $wms_upload_url;
 	var $wms_srs = array();
+	var $wms_termsofuse;
 	  
 	var $fees;
 	var $accessconstraints;
@@ -1632,6 +1633,7 @@
 			$this->insertLayerStyle($i);
 			if($this->overwrite == true){
 				$this->insertLayerKeyword($i);
+				$this->insertLayerCategories($i);
 			}
 		}
 	}
@@ -1689,6 +1691,20 @@
 			}
 		}	
 	}
+	function insertTermsOfUse ($myWMS) {
+		if (!is_numeric($this->wms_termsofuse)) {
+			return;
+		}
+		$sql ="INSERT INTO wms_termsofuse (fkey_wms_id, fkey_termsofuse_id) ";
+		$sql .= " VALUES($1,$2)";
+		$v = array($myWMS,$this->wms_termsofuse);
+		$t = array('i','i');
+		$res = db_prep_query($sql,$v,$t);
+		if(!$res){
+			db_rollback();	
+		}
+		
+	}
 	function insertFormat($myWMS){
 		for($i=0; $i<count($this->data_type);$i++){
 			$sql ="INSERT INTO wms_format (fkey_wms_id, data_type, data_format) ";
@@ -1739,6 +1755,34 @@
 			}
 		}
 	}
+	
+	function insertLayerCategories($i){
+		global $con;
+
+		$types = array("md_topic", "inspire", "custom");
+		foreach ($types as $cat) {
+			$sql = "DELETE FROM layer_{$cat}_category WHERE fkey_layer_id = $1";
+			$v = array($this->objLayer[$i]->db_id);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			$attr = "layer_{$cat}_category_id";
+			$k = $this->objLayer[$i]->$attr;
+			
+			for ($j = 0; $j < count($k); $j++) {
+				
+				$sql = "INSERT INTO layer_{$cat}_category (fkey_layer_id, fkey_{$cat}_category_id) VALUES ($1, $2)";
+				$v = array($this->objLayer[$i]->db_id, $k[$j]);
+				$t = array('i', 'i');
+				$res = db_prep_query($sql,$v,$t);
+				if(!$res){
+					db_rollback();	
+					return;
+				}
+			}
+		}
+	}	
+	
 	function insertLayerKeyword($i){
 		global $con;
 		$sql = "DELETE FROM layer_keyword WHERE fkey_layer_id = $1";
@@ -1854,6 +1898,16 @@
 			}
 		}
 		
+		# delete and refill wms_termsofuse
+		$sql = "DELETE FROM wms_termsofuse WHERE fkey_wms_id = $1 ";
+		$v = array($myWMS);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		if(!$res){
+			db_rollback();	
+		}
+		$this->insertTermsOfUse($myWMS);
+		
 		# delete and refill srs and formats
 		$sql = "DELETE FROM wms_srs WHERE fkey_wms_id = $1 ";
 		$v = array($myWMS);
@@ -2638,6 +2692,9 @@
     var $layer_keyword = array();
 	var $layer_epsg = array();
 	var $layer_style = array();
+	var $layer_md_topic_category_id = array();
+	var $layer_inspire_category_id = array();
+	var $layer_custom_category_id = array();
 	
 	var $gui_layer_wms_id;
 	var $gui_layer_status = 1;



More information about the Mapbender_commits mailing list