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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 23 10:55:11 PST 2017


Author: armin11
Date: 2017-01-23 10:55:11 -0800 (Mon, 23 Jan 2017)
New Revision: 9668

Modified:
   trunk/mapbender/lib/ajax.php
Log:
New possibility to do a serverside filtering of metadata editor list (actual for datatables 1.9)

Modified: trunk/mapbender/lib/ajax.php
===================================================================
--- trunk/mapbender/lib/ajax.php	2017-01-23 18:55:00 UTC (rev 9667)
+++ trunk/mapbender/lib/ajax.php	2017-01-23 18:55:11 UTC (rev 9668)
@@ -116,6 +116,7 @@
  */
 class AjaxResponse extends AjaxRequest {
 	private $data = array();
+	private $highLevelAttributes = array();
 	private $success = true;
 	private $error = null;
 	private $message = "";
@@ -155,8 +156,23 @@
 	public function setMessage ($aMessage) {
 		$this->message = $aMessage;
 	}
-	
+
 	/**
+	 * Compose data to be sent back to the client on highest level.
+	 * Either by key and value, or by passing the complete associative array.
+	 */
+	public function setHighLevelAttributes () {
+		if (func_num_args() == 1) {
+			$this->highLevelAttributes = func_get_arg(0);
+		}
+		else if (func_num_args() == 2) {
+			$key = func_get_arg(0);
+			$value = func_get_arg(1);
+			$this->highLevelAttributes[$key] = $value;
+		}
+	}
+
+	/**
 	 * Set status of the RPC.
 	 * 
 	 * @param $trueOrFalse Boolean
@@ -221,6 +237,10 @@
 			"error" => $this->error,
 			"id" => $this->id
 		);
+		//add highlevel attributes
+		foreach ($this->highLevelAttributes as $key => $value) {
+			$obj[$key] = $value;
+		}
 		return $this->json->encode($obj);
 	}
 }



More information about the Mapbender_commits mailing list