getGuisByOwner($logged_user_id,true);
$own_wms_id_array = array();
$sql = "SELECT wms_id FROM wms WHERE wms_owner = $1";
$v = array($logged_user_id);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
while($row = db_fetch_array($res)){
array_push($own_wms_id_array,$row['wms_id']);
}
$own_layer_id_array = $admin->getLayerByWms($selected_wms);
/*handle remove, update and insert*****************************************************************/
if($insert){
if(count($selected_topic) > 0){
for($i=0; $i0){
for($i=0; $i 0) {
$selected_layer = $own_layer_id_array[0];
}
}
$topic_id_layer = array();
if (isset($selected_layer)) {
/*get all topics from selected layer*****************************************************************/
if ($language_suffix == "de") {
$sql_layer_topic = "SELECT t.md_topic_category_id, t.md_topic_category_code_de ";
$sql_layer_topic .= "FROM layer_md_topic_category as w, md_topic_category as t WHERE w.fkey_layer_id = $1 AND w.fkey_md_topic_category_id = t.md_topic_category_id ";
$sql_layer_topic .= "ORDER BY t.md_topic_category_code_de";
}
else {
$sql_layer_topic = "SELECT t.md_topic_category_id, t.md_topic_category_code_en ";
$sql_layer_topic .= "FROM layer_md_topic_category as w, md_topic_category as t WHERE w.fkey_layer_id = $1 AND w.fkey_md_topic_category_id = t.md_topic_category_id ";
$sql_layer_topic .= "ORDER BY t.md_topic_category_code_en";
}
$v = array($selected_layer);
$t = array('s');
$res_layer_topic = db_prep_query($sql_layer_topic,$v,$t);
while($row = db_fetch_array($res_layer_topic)){
array_push($topic_id_layer, $row["md_topic_category_id"]);
array_push($topic_name_layer, $row["md_topic_category_code_".$language_suffix]);
}
}
/*get all topics **********************************************************************************/
if ($language_suffix == "de") {
$sql_topic = "SELECT * FROM md_topic_category ORDER BY md_topic_category_code_de";
}
else {
$sql_topic = "SELECT * FROM md_topic_category ORDER BY md_topic_category_code_en";
}
$res_topic = db_query($sql_topic);
$topic_id = array();
$topic_name = array();
while($row = db_fetch_array($res_topic)){
if (!in_array($row["md_topic_category_id"], $topic_id_layer)) {
array_push($topic_id, $row["md_topic_category_id"]);
array_push($topic_name, $row["md_topic_category_code_".$language_suffix]);
}
}
/*INSERT HTML*/
echo "";
?>