[Mapbender-commits] r9250 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 13 06:35:08 PDT 2015


Author: armin11
Date: 2015-07-13 06:35:08 -0700 (Mon, 13 Jul 2015)
New Revision: 9250

Modified:
   trunk/mapbender/http/php/mb_list_wmc_local_data.php
Log:
Enhancement for filtering data table

Modified: trunk/mapbender/http/php/mb_list_wmc_local_data.php
===================================================================
--- trunk/mapbender/http/php/mb_list_wmc_local_data.php	2015-07-13 12:44:12 UTC (rev 9249)
+++ trunk/mapbender/http/php/mb_list_wmc_local_data.php	2015-07-13 13:35:08 UTC (rev 9250)
@@ -18,13 +18,33 @@
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 
+//parse ajax params
+//activateRegistratingGroupFilter
+$activateRegistratingGroupFilter = $_REQUEST["activateRegistratingGroupFilter"];
+
 $user_id = Mapbender::session()->get("mb_user_id");
-// @TODO: select on has_local_data...
-$sql = 'select a.wmc_serial_id, a.wmc_local_data_public, a.wmc_title, a.wmc_timestamp, a.wmc_local_data_size,'.
-       ' a.fkey_user_id, termsofuse.symbollink from mb_user_wmc a left join termsofuse on termsofuse.termsofuse_id'.
-       ' = a.wmc_local_data_fkey_termsofuse_id where wmc_has_local_data = 1 and'.
-       '(fkey_user_id = $1 or wmc_local_data_public = 1);';
+//select mb_user_id from mb_user_mb_group inner join mb_user on mb_user_mb_group.fkey_mb_user_id = mb_user.mb_user_id where mb_user_mb_group.fkey_mb_group_id = 36;
+if (defined("REGISTRATING_GROUP") && is_int(REGISTRATING_GROUP)) {
+	$registratingGroupId = 	REGISTRATING_GROUP;
+} else {
+	$activateRegistratingGroupFilter = "0";
+}
 
+if ($activateRegistratingGroupFilter == "1") {
+	$sql = 'select a.wmc_serial_id, a.wmc_local_data_public, a.wmc_title, a.wmc_timestamp, a.wmc_local_data_size,'.
+       		' a.fkey_user_id, termsofuse.symbollink from mb_user_wmc a left join termsofuse on termsofuse.termsofuse_id'.
+       		' = a.wmc_local_data_fkey_termsofuse_id where wmc_has_local_data = 1 and'.
+       		'(fkey_user_id = $1 or wmc_local_data_public = 1 or fkey_user_id in ('.
+		'select mb_user_id from mb_user_mb_group inner join mb_user on mb_user_mb_group.fkey_mb_user_id = mb_user.mb_user_id where mb_user_mb_group.fkey_mb_group_id = '.$registratingGroupId.
+		'));';
+	$e = new mb_exception("sql: ".$sql);	
+} else {
+	$sql = 'select a.wmc_serial_id, a.wmc_local_data_public, a.wmc_title, a.wmc_timestamp, a.wmc_local_data_size,'.
+       		' a.fkey_user_id, termsofuse.symbollink from mb_user_wmc a left join termsofuse on termsofuse.termsofuse_id'.
+       		' = a.wmc_local_data_fkey_termsofuse_id where wmc_has_local_data = 1 and'.
+       		'(fkey_user_id = $1 or wmc_local_data_public = 1);';
+}
+
 $v = array($user_id);
 $t = array("i");
 $res = db_prep_query($sql, $v, $t);



More information about the Mapbender_commits mailing list