get("mb_user_id"); //check for parameter wmc_id if (!isset($_GET["wmc_id"])) { echo 'Error: wmc_id not requested
'; die; //must leave script } function _e ($str) { return htmlentities($str, ENT_QUOTES, CHARSET); } if (!$userId) { $userId = PUBLIC_USER; } //the next functions should come from class administration, but they are not included as they are needed //TODO function getLayerPermission($wms_id, $layer_id, $user_id){ //$layer_id = $this->getLayerIdByLayerName($wms_id,$layer_name); $array_guis = getGuisByPermission($user_id,true); $v = array(); $t = array(); $sql = "SELECT * FROM gui_layer WHERE fkey_gui_id IN ("; $c = 1; //generate guilist assigned to specific user for($i=0; $i0){ $sql .= ",";} $sql .= "$".$c; $c++; array_push($v, $array_guis[$i]); array_push($t, 's'); } $sql .= ") AND fkey_layer_id = $".$c." AND gui_layer_status = 1"; //status 1 must be array_push($v,$layer_id); array_push($t,'i'); $res = db_prep_query($sql,$v,$t); if($row = db_fetch_array($res)){ return true; } else{ return false; } } function getGuisByPermission($mb_user_id,$ignoreublic){ $arrayGuis = array(); $mb_user_groups = array(); $sql_groups = "SELECT fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = $1 "; $v = array($mb_user_id); $t = array("i"); $res_groups = db_prep_query($sql_groups,$v,$t); $cnt_groups = 0; while($row = db_fetch_array($res_groups)){ $mb_user_groups[$cnt_groups] = $row["fkey_mb_group_id"]; $cnt_groups++; } if($cnt_groups > 0){ $v = array(); $t = array(); $sql_g = "SELECT gui.gui_id FROM gui JOIN gui_mb_group "; $sql_g .= " ON gui.gui_id = gui_mb_group.fkey_gui_id WHERE gui_mb_group.fkey_mb_group_id IN ("; for($i=0; $i 0){$sql_g .= ",";} $sql_g .= "$".strval($i+1); array_push($v,$mb_user_groups[$i]); array_push($t,"i"); } $sql_g .= ") GROUP BY gui.gui_id"; $res_g = db_prep_query($sql_g,$v,$t); while($row = db_fetch_array($res_g)){ array_push($arrayGuis,$row["gui_id"]); } } $sql_guis = "SELECT gui.gui_id FROM gui JOIN gui_mb_user ON gui.gui_id = gui_mb_user.fkey_gui_id"; $sql_guis .= " WHERE (gui_mb_user.fkey_mb_user_id = $1) "; if (!isset($ignore_public) OR $ignore_public== false){ $sql_guis .= " AND gui.gui_public = 1 "; } $sql_guis .= " GROUP BY gui.gui_id"; $v = array($mb_user_id); $t = array("i"); $res_guis = db_prep_query($sql_guis,$v,$t); $guis = array(); while($row = db_fetch_array($res_guis)){ if(!in_array($row['gui_id'],$arrayGuis)){ array_push($arrayGuis,$row["gui_id"]); } } return $arrayGuis; } //end of functions which m,ay be included from class_administration in next versions #************************************************************************** //Function to create an OpenLayers Javascript from a mapbender wmc document function createOlFromWMC_id($wmc_id){ global $userId; //Get WMC out of mb Database $sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_serial_id = $1"; $res = db_prep_query($sql, array($wmc_id), array("s")); $wmc = db_fetch_row($res); //Read out WMC into XML object $xml=simplexml_load_string($wmc[0], "SimpleXMLElement", LIBXML_NOBLANKS); //generate general html data $html=''; $html.="\n"; $html.="\n"; //define global variables for extent out of WMC File $windowWidth=$xml->General->Window->attributes()->width; $windowHeight=$xml->General->Window->attributes()->height; $htmlWidth=$windowWidth+40; $htmlHeight=$windowHeight+70; //define CSS $html.="\n"; //Generate Title $html.="".$xml->General->Title."\n"; //include OL libs from local source - must be minimized $html.="\n"; $html.="\n"; $html.=" \n"; $html.="\n"; $html.="
\n"; $html.="
\n";//class dont exists $html.="
\n"; $html.="\n"; $html.="
\n"; //Show coords if wished if($_REQUEST["mb_showCoords"]=='1'){ // $html.="\n"; $html.="
Koordinaten in ".$xml->General->BoundingBox['SRS'].":
\n"; } $html.="
\n"; $html.="
\n"; $html.="\n"; $html.="\n"; //Print out HTML code echo $html; } //end of function createOlfromWMC_id() createOlfromWMC_id($_GET["wmc_id"]); ?>