}
  	}
  	return true;
  }
</script>
    
</head>
<body>
Gazetteer Configuration<br>
<form method='POST' onsubmit='return validate()'>

<?php 
echo "<input type='hidden' name='gui' value='" . $_REQUEST["gui"] . "'>";
echo "<input type='hidden' name='wms' value='" . $_REQUEST["wms"] . "'>";
echo "<input type='hidden' name='layer' value='" . $_REQUEST["layer"] . "'>";
$aWFS = new wfs_conf();
$aWFS->getallwfs();
/* save gazetteer properties */
if (isset($_REQUEST["save"])) {
    $sql = "UPDATE gui_layer SET gui_layer_wfs_featuretype = \$1 ";
    $sql .= "WHERE fkey_gui_id = \$2 AND fkey_layer_id = \$3";
    $v = array($_REQUEST["myWFS"], $_REQUEST["gui"], $_REQUEST["layer"]);
    $t = array("s", "s", "i");
    $res = db_prep_query($sql, $v, $t);
    echo "layer is connected with: " . $_REQUEST["myWFS"];
    die;
}
/* end save gazetteer properties */
/* select wfs */
if (isset($_REQUEST["wfs"]) && $_REQUEST["wfs"] == "") {
    unset($_REQUEST["wfs"]);
     $wfsConfIds = $currentUser->getWfsConfByWfsOwner();
     if ($wfsConfIds === null) {
         $wfsConfIds = array();
     }
     $result = array();
     foreach ($wfsConfIds as $id) {
         $currentWfsConf = WfsConfiguration::createFromDb($id);
         if ($currentWfsConf !== null) {
             $result[] = $currentWfsConf;
         }
     }
     $ajaxResponse->setResult($result);
     $ajaxResponse->send();
     break;
 case "getWfs":
     $aWFS = new wfs_conf();
     $aWFS->getallwfs(Mapbender::session()->get("mb_user_id"));
     $result = array();
     for ($i = 0; $i < count($aWFS->wfs_id); $i++) {
         // featuretypes
         $featuretypeArray = array();
         $aWFS->getfeatures($aWFS->wfs_id[$i]);
         for ($j = 0; $j < count($aWFS->features->featuretype_id); $j++) {
             // featuretype elements
             $ftElementArray = array();
             $aWFS->getelements($aWFS->features->featuretype_id[$j]);
             for ($k = 0; $k < count($aWFS->elements->element_id); $k++) {
                 $ftElementArray[] = array("id" => $aWFS->elements->element_id[$k], "name" => $aWFS->elements->element_name[$k], "type" => $aWFS->elements->element_type[$k]);
             }
             $featuretypeArray[] = array("id" => $aWFS->features->featuretype_id[$j], "name" => $aWFS->features->featuretype_name[$j], "srs" => $aWFS->features->featuretype_srs[$j], "elementArray" => $ftElementArray);
         }
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/**
 * This is the main page of the sld-editor.
 * It displays the preview images and creates the sld_edit_form
 * used for editing the sld.
 *
 * @package sld_main
 * @author Markus Krzyzanowski
 */
require_once dirname(__FILE__) . "/sld_config.php";
require_once dirname(__FILE__) . "/../classes/class_wfs_conf.php";
$classWfsConf = new wfs_conf();
//read custom sld for this user&wms&layer&gui from the db instead using sld.xml
$con = db_connect($DBSERVER, $OWNER, $PW);
db_select_db($DB, $con);
//Read the layer_id from the DB
$dbutils = new DbUtils();
$layer_id = $dbutils->getLayerIdFromLayerName($_SESSION["sld_wms_id"], $_SESSION["sld_layer_name"]);
if ($layer_id) {
    $_SESSION["sld_layer_id"] = $layer_id;
}
//Read the mb_user_id from the Session
$mb_user_id = $_SESSION["mb_user_id"];
//if layer is not found in DB
if (!$layer_id) {
    echo "layer existiert nicht in Datenbank";
    exit;
  			else{
  				document.forms[0].elements[i].value = 0;
  			}
  			document.forms[0].elements[i].checked = true;
  		}
  	}
  	return true;
  }
</script>
</head>
<body>
Gazetteer Configuration<br>
<form method='POST' onsubmit='return validate()'>
<a href="mod_gazetteer_edit.php">edit</a><br>
<?php 
$aWFS = new wfs_conf();
$aWFS->getallwfs();
/* save gazetteer properties */
if (isset($_REQUEST["save"])) {
    global $DBSERVER, $DB, $OWNER, $PW;
    $con = db_connect($DBSERVER, $OWNER, $PW);
    db_select_db($DB, $con);
    $sql = "INSERT INTO gazetteer (gazetteer_abstract, fkey_wfs_id, ";
    $sql .= "fkey_featuretype_id, g_label, g_label_id, g_button, ";
    $sql .= "g_button_id, g_style, g_buffer, g_res_style, g_use_wzgraphics) ";
    $sql .= "VALUES(\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11);";
    $v = array($_REQUEST["gazetteer_abstract"], $_REQUEST["wfs"], $_REQUEST["featuretype"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"], $_REQUEST["g_use_wzgraphics"]);
    $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "i");
    $res = db_prep_query($sql, $v, $t);
    $wfsID = db_insert_id($con);
    for ($i = 0; $i < count($_REQUEST["f_id"]); $i++) {
<body>
<br>
<b>WFS Configuration</b>
<br>
<form method='POST' action='<?php 
echo $self;
?>
'onsubmit='return validate()'>
<br>
<a href="mod_wfs_edit.php?<?php 
echo $urlParameters;
?>
">edit WFS Configuration</a><br><br>
Select WFS:&nbsp;
<?php 
$aWFS = new wfs_conf();
$aWFS->getallwfs(Mapbender::session()->get("mb_user_id"));
function toImage($text)
{
    $angle = 90;
    if (extension_loaded("gd2")) {
        return "<img src='../php/createImageFromText.php?text=" . urlencode($text) . "&angle=" . $angle . "'>";
    }
    return $text;
}
/* save wfs_conf properties */
if (isset($_POST["save"])) {
    db_select_db($DB, $con);
    $sql = "INSERT INTO wfs_conf (";
    $sql .= "wfs_conf_abstract, fkey_wfs_id, ";
    $sql .= "fkey_featuretype_id, g_label, g_label_id, g_button, ";