[Mapbender-commits] r6776 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 20 08:04:03 EDT 2010


Author: christoph
Date: 2010-08-20 12:04:03 +0000 (Fri, 20 Aug 2010)
New Revision: 6776

Modified:
   trunk/mapbender/lib/class_Filter.php
Log:
allow filters like FALSE

Modified: trunk/mapbender/lib/class_Filter.php
===================================================================
--- trunk/mapbender/lib/class_Filter.php	2010-08-20 10:48:23 UTC (rev 6775)
+++ trunk/mapbender/lib/class_Filter.php	2010-08-20 12:04:03 UTC (rev 6776)
@@ -17,6 +17,7 @@
 
 	const OPERATORS = "=,>,>=,<,<=,<>,LIKE,ILIKE,IN";
 	const BOOLEAN_OPERATORS = "AND,OR";
+	const BOOLEAN = "TRUE,FALSE";
 
 	public function __construct () {
 		if (func_num_args() === 3) {
@@ -47,6 +48,11 @@
 				$this->filterArray = func_get_arg(1);
 			}
 		}
+		else if (func_num_args() === 1) {
+			if (in_array(strtoupper(func_get_arg(0)), explode(",", Filter::BOOLEAN))) {
+				$this->value = strtoupper(func_get_arg(0));
+			}
+		}
 		else {
 			
 		}
@@ -95,9 +101,12 @@
 			}
 			else {
 				$sqlObject->sql = !is_null($this->key) && !is_null($this->operator) ? 
-					$this->key . $this->operator . "$" . $parameterCount : "";
-				$sqlObject->v = !is_null($this->value) ? array($this->value) : array();
-				$sqlObject->t = !is_null($this->value) ? array($this->getType($this->value)) : array();
+					$this->key . $this->operator . "$" . $parameterCount : 
+						(!is_null($this->value) ? $this->value : "");
+				$sqlObject->v = !is_null($this->key) && !is_null($this->operator) && !is_null($this->value) ? 
+					array($this->value) : array();
+				$sqlObject->t = !is_null($this->key) && !is_null($this->operator) && !is_null($this->value) ? 
+					array($this->getType($this->value)) : array();
 			}
 			return $sqlObject;			
 		}



More information about the Mapbender_commits mailing list