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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 27 08:21:23 EST 2007


Author: christoph
Date: 2007-02-27 08:21:22 -0500 (Tue, 27 Feb 2007)
New Revision: 1147

Modified:
   trunk/mapbender/http/php/mod_filteredGroup_filteredGui.php
Log:
fixed bug 
1653348  	  mod_filteredGroup_filteredGui.php

Modified: trunk/mapbender/http/php/mod_filteredGroup_filteredGui.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredGroup_filteredGui.php	2007-02-26 13:16:10 UTC (rev 1146)
+++ trunk/mapbender/http/php/mod_filteredGroup_filteredGui.php	2007-02-27 13:21:22 UTC (rev 1147)
@@ -142,86 +142,93 @@
 	$cnt_group++;
 }
 
-/*get allocated gui from selected_group******************************************************************************/
-$arrayGuis=mb_getGUIs($logged_user_id);
-$v = array();
-$t = array();
-$sql_group_mb_gui = "SELECT gui.gui_id, gui.gui_name, gui_mb_group.fkey_mb_group_id FROM gui_mb_group ";
-$sql_group_mb_gui .= " JOIN gui ON gui_mb_group.fkey_gui_id = gui.gui_id ";
-$sql_group_mb_gui .= "WHERE gui_mb_group.fkey_mb_group_id = $1 ";
-if(!$selected_group){
-	if($group_id[0] > 0){
-		array_push($v,$group_id[0]);
-		array_push($t,'i');
+if ($cnt_group > 0) {
+
+	/*get allocated gui from selected_group******************************************************************************/
+	$arrayGuis=mb_getGUIs($logged_user_id);
+	$v = array();
+	$t = array();
+	$sql_group_mb_gui = "SELECT gui.gui_id, gui.gui_name, gui_mb_group.fkey_mb_group_id FROM gui_mb_group ";
+	$sql_group_mb_gui .= " JOIN gui ON gui_mb_group.fkey_gui_id = gui.gui_id ";
+	$sql_group_mb_gui .= "WHERE gui_mb_group.fkey_mb_group_id = $1 ";
+	if(!$selected_group){
+		if($group_id[0] > 0){
+			array_push($v,$group_id[0]);
+			array_push($t,'i');
+		}
+		else{
+			array_push($v, "NULL");
+			array_push($t,'i');
+		}
 	}
-	else{
-		array_push($v, "NULL");
+	else if($selected_group){
+		array_push($v,$selected_group);
 		array_push($t,'i');
 	}
-}
-else if($selected_group){
-	array_push($v,$selected_group);
-	array_push($t,'i');
-}
-$sql_group_mb_gui .= " AND gui.gui_id IN (";
-$c = 2;
-for($i=0; $i<count($arrayGuis); $i++){
-	if($i>0){ $sql_group_mb_gui .= ",";}
-	$sql_group_mb_gui .= "$".$c;
-	array_push($v,$arrayGuis[$i]);
-	array_push($t,'s');
-	$c++;
-}
-$sql_group_mb_gui .= ") ORDER BY gui.gui_name";
+	$sql_group_mb_gui .= " AND gui.gui_id IN (";
+	$c = 2;
+	for($i=0; $i<count($arrayGuis); $i++){
+		if($i>0){ $sql_group_mb_gui .= ",";}
+		$sql_group_mb_gui .= "$".$c;
+		array_push($v,$arrayGuis[$i]);
+		array_push($t,'s');
+		$c++;
+	}
+	$sql_group_mb_gui .= ") ORDER BY gui.gui_name";
+	
+	$res_group_mb_gui = db_prep_query($sql_group_mb_gui,$v,$t);
+	while($row = db_fetch_array($res_group_mb_gui)){
+		$gui_id_group[$cnt_gui_group] = $row["gui_id"];
+		$gui_name_group[$cnt_gui_group] =  $row["gui_name"];
+		$cnt_gui_group++;
+	}
 
-$res_group_mb_gui = db_prep_query($sql_group_mb_gui,$v,$t);
-while($row = db_fetch_array($res_group_mb_gui)){
-	$gui_id_group[$cnt_gui_group] = $row["gui_id"];
-	$gui_name_group[$cnt_gui_group] =  $row["gui_name"];
-	$cnt_gui_group++;
-}
-
-/*INSERT HTML*/
-echo "<form name='form1' action='" . $self ."' method='post'>";
-
-/*insert all group in selectbox********************************************************************/
-echo "<div class='text1'>GROUP: </div>";
-echo "<select style='background:#ffffff' class='select1' name='selected_group' onChange='submit()' size='10'>";
-for($i=0; $i<$cnt_group; $i++){
-	echo "<option value='" . $group_id[$i] . "' ";
-	if($selected_group && $selected_group == $group_id[$i]){
-		echo "selected";
+	/*INSERT HTML*/
+	echo "<form name='form1' action='" . $self ."' method='post'>";
+	
+	/*insert all group in selectbox********************************************************************/
+	echo "<div class='text1'>GROUP: </div>";
+	echo "<select style='background:#ffffff' class='select1' name='selected_group' onChange='submit()' size='10'>";
+	for($i=0; $i<$cnt_group; $i++){
+		echo "<option value='" . $group_id[$i] . "' ";
+		if($selected_group && $selected_group == $group_id[$i]){
+			echo "selected";
+		}
+		echo ">" . $group_name[$i]  . "</option>";
 	}
-	echo ">" . $group_name[$i]  . "</option>";
+	echo "</select>";
+	
+	/*insert all gui in selectbox**********************************************************************/
+	echo "<div class='text2'>GUI:</div>";
+	echo "<select style='background:#ffffff' class='select2' multiple='multiple' name='selected_gui[]' size='$fieldHeight' >";
+	for($i=0; $i<$cnt_gui; $i++){
+		echo "<option value='" . $gui_id_array[$i]  . "'>" . $gui_name[$i]  . "</option>";
+	}
+	echo "</select>";
+	
+	/*Button*******************************************************************************************/
+	
+	echo "<div class='button1'><input type='button'  value='==>' onClick='validate(\"insert\")'></div>";
+	echo "<input type='hidden' name='insert'>";
+	
+	echo "<div class='button2'><input type='button' value='<==' onClick='validate(\"remove\")'></div>";
+	echo "<input type='hidden' name='remove'>";
+	
+	/*insert group_gui_dependence in selectbox*********************************************************/
+	echo "<div class='text3'>SELECTED GUI:</div>";
+	echo "<select style='background:#ffffff' class='select3' multiple='multiple' name='remove_gui[]' size='$fieldHeight' >";
+	for($i=0; $i<$cnt_gui_group; $i++){
+		echo "<option value='" . $gui_id_group[$i]  . "'>" . $gui_name_group[$i]  . "</option>";
+	}
+	echo "</select>";
+	
+	echo "</form>";
 }
-echo "</select>";
-
-/*insert all gui in selectbox**********************************************************************/
-echo "<div class='text2'>GUI:</div>";
-echo "<select style='background:#ffffff' class='select2' multiple='multiple' name='selected_gui[]' size='$fieldHeight' >";
-for($i=0; $i<$cnt_gui; $i++){
-	echo "<option value='" . $gui_id_array[$i]  . "'>" . $gui_name[$i]  . "</option>";
+else {
+	echo "<div class = 'text3'>There are no groups available for this user.</div>";
 }
-echo "</select>";
 
-/*Button*******************************************************************************************/
 
-echo "<div class='button1'><input type='button'  value='==>' onClick='validate(\"insert\")'></div>";
-echo "<input type='hidden' name='insert'>";
-
-echo "<div class='button2'><input type='button' value='<==' onClick='validate(\"remove\")'></div>";
-echo "<input type='hidden' name='remove'>";
-
-/*insert group_gui_dependence in selectbox*********************************************************/
-echo "<div class='text3'>SELECTED GUI:</div>";
-echo "<select style='background:#ffffff' class='select3' multiple='multiple' name='remove_gui[]' size='$fieldHeight' >";
-for($i=0; $i<$cnt_gui_group; $i++){
-	echo "<option value='" . $gui_id_group[$i]  . "'>" . $gui_name_group[$i]  . "</option>";
-}
-echo "</select>";
-
-echo "</form>";
-
 ?>
 <script type="text/javascript">
 <!--



More information about the Mapbender_commits mailing list