[Mapbender-commits] r1811 - branches/mapbender_sld/http/sld/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 15 11:04:19 EST 2007


Author: mschulz
Date: 2007-11-15 11:04:19 -0500 (Thu, 15 Nov 2007)
New Revision: 1811

Modified:
   branches/mapbender_sld/http/sld/classes/FeatureTypeStyle.php
Log:
added elements attribute array, e.g. coming from wfs-conf

Modified: branches/mapbender_sld/http/sld/classes/FeatureTypeStyle.php
===================================================================
--- branches/mapbender_sld/http/sld/classes/FeatureTypeStyle.php	2007-11-15 16:02:23 UTC (rev 1810)
+++ branches/mapbender_sld/http/sld/classes/FeatureTypeStyle.php	2007-11-15 16:04:19 UTC (rev 1811)
@@ -20,6 +20,7 @@
 	 * @var int
 	 */
 	var $id = "";
+	
 	/**
 	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
 	 * @var int
@@ -27,6 +28,19 @@
 	var $parent = "";
 	
 	/**
+	 * Array containing the FeatureTypes attribute names (aka elements), acquired either by a 
+	 * - Mapbender WFS-configuration
+	 * - or via a DescribeFeatureType request (niy)
+	 * @see PropertyIsEqualTo, TextSymbolizer 
+	 * @var array
+	 */
+	var $attrs = array();
+	
+	final function setElementArray($name,$array) {
+		$this->attrs[$name] = $array;
+	}
+	
+	/**
 	 * creates the xml for this object and its child objects
 	 *
 	 * @param string $offset string used for formatting the output
@@ -133,6 +147,33 @@
 	{
 		array_splice($this->rules, $index, 1);
 	}
+	/**
+	 * generates html with the fts elements to choose from, useful for Label, Filter, etc.
+	 * 
+	 * @param string $field string that holds the id of the form field where to return the selected value
+	 *
+	 * @param string $value string that holds the name of an already used element name
+	 * 
+	 * @return string html-fragment that lists the elements, each can be clicked and the name is 
+	 * returned to the form field 
+	 */
+	final function generateElementsHtml($field,$value)
+	{
+		$html = "";
+		if ($this->attrs) {
+			$html .= "<select name='elementname' onchange=\"if (this.selectedIndex!=0) document.getElementById('".$field."').value=this.options[this.selectedIndex].value;\">\n";
+			$html .= "<option>Choose ...</option>";
+			foreach ($this->attrs["element_name"] as $ename) {
+				$html .= "<option value='".$ename."' ";
+				if ($value == $ename)
+					$html .= "selected";
+				$html .= ">".$ename."<otion>\n";
+			}
+			$html .= "</select>\n";
+		}
+		return $html;
+	}
+	
 }
 
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list