[Mapbender-commits] r3485 - branches/astroidex_25/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 22 17:39:57 EST 2009


Author: astrid_emde
Date: 2009-01-22 17:39:56 -0500 (Thu, 22 Jan 2009)
New Revision: 3485

Modified:
   branches/astroidex_25/http/classes/class_administration.php
Log:
two new functions added:
* getGuisByOwnerByGuiCategory($userid,$guicategoryid){
* getGuiCategories

have a look at 
http://trac.osgeo.org/mapbender/ticket/344

Modified: branches/astroidex_25/http/classes/class_administration.php
===================================================================
--- branches/astroidex_25/http/classes/class_administration.php	2009-01-22 22:36:32 UTC (rev 3484)
+++ branches/astroidex_25/http/classes/class_administration.php	2009-01-22 22:39:56 UTC (rev 3485)
@@ -1080,5 +1080,65 @@
 		$user = new User($userid); 	
 		return $user->getWfsConfByPermission();
 	 }
+
+
+    /**
+     * selects the gui_categories 
+     *
+     * @param none			
+     * @return integer[]    the IDs of the gui_categories
+     */
+	function getGuiCategories(){
+		$sql = "SELECT * FROM gui_category order by category_id;";
+		$res = db_query($sql);
+		$row = db_fetch_array($res);
+		if ($row) {
+			$r = array();	
+			while($row = db_fetch_array($res)){
+				array_push($r,$row["category_id"]);
+			}
+			return $r;
+		}
+
+		else {
+			return false;
+		}
+	}
+	
+	
+	function getGuisByOwnerByGuiCategory($userid,$guicategoryid){
+		$gui_list= array();
+		$gui_list = $this->getGuisByOwner($userid,false);
+		$v = array();
+	   	$t = array();
+		
+			$sql = "SELECT fkey_gui_id FROM gui_gui_category ";
+			$sql .= "WHERE gui_gui_category.fkey_gui_category_id = $1 ";
+			$sql .= "AND gui_gui_category.fkey_gui_id IN (";
+					array_push($v, $guicategoryid);
+					array_push($t, "i");
+			
+				for($i=0; $i<count($gui_list); $i++){
+					if($i>0){ $sql .= ",";}
+					$sql .= "$".strval($i+2);
+					array_push($v, $gui_list[$i]);
+					array_push($t, "i");
+				}
+			$sql .= ");";
+			
+			$e = new mb_notice("getGuisByOwnerByGuiCategories: ".$sql);	
+			$e = new mb_notice("v - t: ".count($v)." -- ".count($t));	
+			$res = db_prep_query($sql,$v,$t);
+			$r = array();
+			while($row = db_fetch_array($res)){
+				array_push($r,$row["fkey_gui_id"]);
+			}
+			
+			return $r;
+		
+	}
+	
+	 
 }
+
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list