430 lines
21 KiB
PHP
430 lines
21 KiB
PHP
|
<?php
|
||
|
session_start();
|
||
|
require('incl/const.php');
|
||
|
require('class/database.php');
|
||
|
require('class/map.php');
|
||
|
require('class/app.php');
|
||
|
require('class/access_groups.php');
|
||
|
|
||
|
if(!isset($_SESSION['user']) || $_SESSION['user']->accesslevel != 'Admin'){
|
||
|
header('Location: ../login.php');
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
$database = new Database(DB_HOST, DB_NAME, DB_USER, DB_PASS, DB_PORT, DB_SCMA);
|
||
|
|
||
|
$map = ['name' => '','description' => ''];
|
||
|
|
||
|
$map_acc_ids = array();
|
||
|
$use_dt = false;
|
||
|
|
||
|
if(!empty($_GET['id'])){
|
||
|
$map_obj = new map_Class($database->getConn(), $_SESSION['user']->id);
|
||
|
|
||
|
$result = $map_obj->getById($_GET['id']);
|
||
|
if(!$result){
|
||
|
$_GET['error'] = 'Error: No such map!';
|
||
|
exit;
|
||
|
}
|
||
|
$map = pg_fetch_assoc($result);
|
||
|
pg_free_result($result);
|
||
|
|
||
|
$map_acc_grps = $map_obj->getAccessGroups($_GET['id']);
|
||
|
$map_acc_ids = array_keys($map_acc_grps);
|
||
|
|
||
|
list($dss,$lys,$use_dt) = App::parseDatasources(APPS_DIR.'/'.$map['id']);
|
||
|
|
||
|
}else{
|
||
|
$upload_dir = App::upload_dir($_SESSION['user']->ftp_user);
|
||
|
$app_names = App::getApps($upload_dir);
|
||
|
}
|
||
|
|
||
|
$acc_obj = new access_group_Class($database->getConn(), $_SESSION['user']->id);
|
||
|
$acc_grps = $acc_obj->getRowsArr();
|
||
|
?>
|
||
|
<!DOCTYPE html>
|
||
|
<html dir="ltr" lang="en">
|
||
|
|
||
|
<head>
|
||
|
<?php include("incl/meta.php"); ?>
|
||
|
<link href="dist/css/table.css" rel="stylesheet">
|
||
|
<?php if(!empty($_GET['id'])){ ?>
|
||
|
<link href="dist/css/accordion.css" rel="stylesheet">
|
||
|
<?php } ?>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
|
||
|
$('[data-toggle="tooltip"]').tooltip();
|
||
|
|
||
|
$('#map_form').submit(false);
|
||
|
<?php
|
||
|
if(isset($_GET['id'])){
|
||
|
|
||
|
foreach($dss as $dsi => $ds) {
|
||
|
if($ds['data_type'] == 'gs'){ ?>
|
||
|
$('#pg_details<?=$dsi?>').hide();
|
||
|
<?php } else if($ds['data_type'] == 'pg'){ ?>
|
||
|
$('#gs_details<?=$dsi?>').hide();
|
||
|
<?php }else { ?>
|
||
|
$('#pg_details<?=$dsi?>').hide();
|
||
|
$('#gs_details<?=$dsi?>').hide();
|
||
|
<?php }
|
||
|
}
|
||
|
|
||
|
foreach($lys as $lyi => $ly) {
|
||
|
if($ly['layer_type'] == 'gs_geo'){ ?>
|
||
|
$('#wms_details<?=$lyi?>').hide();
|
||
|
<?php }else if($ly['layer_type'] == 'wms'){ ?>
|
||
|
$('#gs_geo_details<?=$lyi?>').hide();
|
||
|
<?php }
|
||
|
}
|
||
|
} ?>
|
||
|
$('#archive').hide();
|
||
|
|
||
|
|
||
|
$(document).on("click", 'input[name="from_type"]', function() {
|
||
|
if($(this).attr('id') == 'from_uploaded'){
|
||
|
$('#app').show(); $('#app').prop('disabled', false); $('#app').prop('required',true);
|
||
|
$('#archive').hide();$('#archive').prop('disabled', true); $('#archive').prop('required',false);
|
||
|
}else{
|
||
|
$('#app').hide(); $('#app').prop('disabled', true); $('#app').prop('required',false);
|
||
|
$('#archive').show(); $('#archive').prop('disabled', false); $('#archive').prop('required',true);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//// data
|
||
|
$(document).on("click", 'input[class="data_files"]', function() {
|
||
|
const id = $(this).attr('data-id');
|
||
|
let pg = $('#pg_details' + id);
|
||
|
let gs = $('#gs_details' + id);
|
||
|
|
||
|
pg.hide(); pg.children('input').prop('required',false);
|
||
|
gs.hide(); gs.children('input').prop('required',false);
|
||
|
});
|
||
|
|
||
|
$(document).on("click", 'input[class="data_pg"]', function() {
|
||
|
const id = $(this).attr('data-id');
|
||
|
let pg = $('#pg_details' + id);
|
||
|
let gs = $('#gs_details' + id);
|
||
|
|
||
|
pg.show(); pg.children('input').prop('required',true);
|
||
|
gs.hide(); gs.children('input').prop('required',false);
|
||
|
});
|
||
|
|
||
|
$(document).on("click", 'input[class="data_gs"]', function() {
|
||
|
const id = $(this).attr('data-id');
|
||
|
let pg = $('#pg_details' + id);
|
||
|
let gs = $('#gs_details' + id);
|
||
|
|
||
|
pg.hide(); pg.children('input').prop('required',false);
|
||
|
gs.show(); gs.children('input').prop('required',true);
|
||
|
});
|
||
|
|
||
|
//// layers
|
||
|
$(document).on("click", 'input[class="layer_wms"]', function() {
|
||
|
const id = $(this).attr('data-id');
|
||
|
let wms = $('#wms_details' + id);
|
||
|
let gs = $('#gs_geo_details' + id);
|
||
|
|
||
|
wms.show(); wms.children('input').prop('required',true);
|
||
|
wms.children('input[name^="wms_user"], input[name^="wms_pwd"]').prop('required',false);
|
||
|
gs.hide(); gs.children('input').prop('required',false);
|
||
|
});
|
||
|
|
||
|
$(document).on("click", 'input[class="layer_gs_geo"]', function() {
|
||
|
const id = $(this).attr('data-id');
|
||
|
let wms = $('#wms_details' + id);
|
||
|
let gs = $('#gs_geo_details' + id);
|
||
|
|
||
|
wms.hide(); wms.children('input').prop('required',false);
|
||
|
gs.show(); gs.children('input').prop('required',true);
|
||
|
});
|
||
|
|
||
|
// Update/Create connection on submit button click
|
||
|
$(document).on("click", "#btn_submit", function() {
|
||
|
let obj = $(this);
|
||
|
let input = $('#map_form').find('input[type="text"], input[type="password"], select');
|
||
|
let empty = false;
|
||
|
|
||
|
input.each(function() {
|
||
|
if (!$(this).prop('disabled') && $(this).prop('required') && !$(this).val()) {
|
||
|
$(this).addClass("error");
|
||
|
empty = true;
|
||
|
} else {
|
||
|
$(this).removeClass("error");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if(empty){
|
||
|
$('#map_form').find(".error").first().focus();
|
||
|
}else{
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
url: 'action/map.php',
|
||
|
data: new FormData($('#map_form')[0]),
|
||
|
processData: false,
|
||
|
contentType: false,
|
||
|
dataType:"json",
|
||
|
success: function(response){
|
||
|
alert(response.message);
|
||
|
if(response.success) {
|
||
|
<?php if(isset($_GET['id'])){ ?>
|
||
|
window.location.href = 'maps.php'; // redirect to maps.php
|
||
|
<?php } else { ?>
|
||
|
window.location.href = 'edit_map.php?id=' + response.id; // redirect to step 2 for datasources
|
||
|
<?php } ?>
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="main-wrapper" data-layout="vertical" data-navbarbg="skin5" data-sidebartype="full"
|
||
|
data-sidebar-position="absolute" data-header-position="absolute" data-boxed-layout="full">
|
||
|
|
||
|
<?php const MENU_SEL = 'maps.php';
|
||
|
include("incl/topbar.php");
|
||
|
include("incl/sidebar.php");
|
||
|
?>
|
||
|
<div class="page-wrapper">
|
||
|
<div class="page-breadcrumb" style="padding-left:30px; padding-right: 30px; padding-top:0px; padding-bottom: 0px">
|
||
|
<div class="row align-items-center">
|
||
|
<div class="col-6">
|
||
|
<nav aria-label="breadcrumb">
|
||
|
</nav>
|
||
|
<?php if(isset($_GET['id'])){ ?>
|
||
|
<h1 class="mb-0 fw-bold">Update Map <?=$_GET['id']?></h1>
|
||
|
<?php } else { ?>
|
||
|
<h1 class="mb-0 fw-bold">Add new map</h1>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
<div class="col-6">
|
||
|
<div class="text-end upgrade-btn">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="container-fluid">
|
||
|
|
||
|
<form action="" method="post" enctype="multipart/form-data" id="map_form" style="width: 50%;">
|
||
|
<?php if (isset($_GET['error'])) { ?>
|
||
|
<div class="alert alert-danger" role="alert">
|
||
|
<?=$_GET['error']?>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
|
||
|
<?php if(isset($_GET['id'])){ ?>
|
||
|
<input type="hidden" class="form-control" name="id" id="id" value="<?=$_GET['id']?>" />
|
||
|
<?php } ?>
|
||
|
<input type="hidden" class="form-control" name="save" id="save" value="1" />
|
||
|
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="name" class="form-label">Name</label>
|
||
|
<input type="text" class="form-control" name="name" id="name" value="<?=$map['name']?>" required/>
|
||
|
<label for="description" class="form-label">Description</label>
|
||
|
<input type="text" class="form-control" name="description" id="description" value="<?=$map['description']?>" required/>
|
||
|
</div>
|
||
|
|
||
|
<?php if(!isset($_GET['id'])){ ?>
|
||
|
<fieldset>
|
||
|
<legend>Source</legend>
|
||
|
<div class="form-group">
|
||
|
|
||
|
<input type="radio" id="from_uploaded" name="from_type" value="uploaded" checked>
|
||
|
<label for="from_uploaded">Uploads</label>
|
||
|
<input type="radio" id="from_zip" name="from_type" value="archive">
|
||
|
<label for="from_zip">Archive</label>
|
||
|
|
||
|
<select class="form-control" name="app" id="app" aria-label="Select app">
|
||
|
<?php foreach($app_names as $k){ ?>
|
||
|
<option <?php if($k == $map['name']){ ?> selected <?php }?> value="<?=$k?>"><?=$k?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
|
||
|
<input type="file" class="form-control" name="archive" id="archive" value="" accept=".zip" disabled/>
|
||
|
<p>NOTE: Archive can contains files, or project directory.</p>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
<?php }else {
|
||
|
$aci = 0;
|
||
|
?>
|
||
|
|
||
|
<fieldset>
|
||
|
<legend>Data</legend>
|
||
|
<?php
|
||
|
foreach($dss as $dsi => $ds) { ?>
|
||
|
<div class="panel-group" id="accordion<?=$aci?>" role="tablist" aria-multiselectable="false">
|
||
|
<div class="panel panel-default">
|
||
|
<div class="panel-heading" role="tab" id="heading<?=$aci?>">
|
||
|
<h5 class="panel-title">
|
||
|
<a role="button" data-toggle="collapse" class="accordion-plus-toggle collapsed" data-parent="#accordion<?=$aci?>" href="#collapse<?=$aci?>" aria-expanded="false" aria-controls="collapse<?=$aci?>"><?=$ds['name']?></a>
|
||
|
</h5>
|
||
|
</div>
|
||
|
<div id="collapse<?=$aci?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$aci?>">
|
||
|
|
||
|
<div class="form-group col-sm">
|
||
|
<input type="radio" class="data_files" data-id="<?=$dsi?>" name="data_type<?=$dsi?>" value="file" <?php if($ds['data_type'] == 'file'){ ?> checked<?php } ?>> <label for="data_files<?=$dsi?>">Files</label>
|
||
|
<input type="radio" class="data_pg" data-id="<?=$dsi?>" name="data_type<?=$dsi?>" value="pg" <?php if($ds['data_type'] == 'pg'){ ?> checked<?php } ?>> <label for="data_pg<?=$dsi?>">Postgres</label>
|
||
|
<input type="radio" class="data_gs" data-id="<?=$dsi?>" name="data_type<?=$dsi?>" value="gs" <?php if($ds['data_type'] == 'gs'){ ?> checked<?php } ?>> <label for="data_gs<?=$dsi?>">GeoServer</label>
|
||
|
</div>
|
||
|
|
||
|
<div class="pg_details" id="pg_details<?=$dsi?>">
|
||
|
<label for="pg_host<?=$dsi?>" class="form-label">Host</label> <input type="text" class="form-control" name="pg_host<?=$dsi?>" id="pg_host<?=$dsi?>" value="<?=$ds['pg_host']?>"/>
|
||
|
<label for="pg_port<?=$dsi?>" class="form-label">Port</label> <input type="text" class="form-control" name="pg_port<?=$dsi?>" id="pg_port<?=$dsi?>" value="<?=$ds['pg_port']?>"/>
|
||
|
<label for="pg_db<?=$dsi?>" class="form-label">Database</label> <input type="text" class="form-control" name="pg_db<?=$dsi?>" id="pg_db<?=$dsi?>" value="<?=$ds['pg_db']?>"/>
|
||
|
<label for="pg_user<?=$dsi?>" class="form-label">User</label> <input type="text" class="form-control" name="pg_user<?=$dsi?>" id="pg_user<?=$dsi?>" value="<?=$ds['pg_user']?>"/>
|
||
|
<label for="pg_pwd<?=$dsi?>" class="form-label">Password</label> <input type="password" class="form-control" name="pg_pwd<?=$dsi?>" id="pg_pwd<?=$dsi?>" value="<?=$ds['pg_pwd']?>"/>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="pg_cache<?=$dsi?>" class="form-label">Cache</label>
|
||
|
<input type="number" name="pg_cache_val<?=$dsi?>" id="pg_cache_val<?=$dsi?>" value="<?=$ds['pg_cache_val']?>"/>
|
||
|
<select name="pg_cache_per<?=$dsi?>" id="pg_cache_per<?=$dsi?>">
|
||
|
<?php foreach(TIME_MAP as $per => $val) { ?>
|
||
|
<option value="<?=$per?>" <?php if($ds['pg_cache_per'] == $per) { ?> selected <?php } ?>><?=$per?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="gs_details" id="gs_details<?=$dsi?>">
|
||
|
<label for="gs_host<?=$dsi?>" class="form-label">Host</label> <input type="text" class="form-control" name="gs_host<?=$dsi?>" id="gs_host<?=$dsi?>" value="<?=$ds['gs_host']?>"/>
|
||
|
<label for="gs_user<?=$dsi?>" class="form-label">User</label> <input type="text" class="form-control" name="gs_user<?=$dsi?>" id="gs_user<?=$dsi?>" value="<?=$ds['gs_user']?>"/>
|
||
|
<label for="gs_pwd<?=$dsi?>" class="form-label">Password</label> <input type="password" class="form-control" name="gs_pwd<?=$dsi?>" id="gs_pwd<?=$dsi?>" value="<?=$ds['gs_pwd']?>"/>
|
||
|
<label for="gs_ws<?=$dsi?>" class="form-label">Workspace</label><input type="text" class="form-control" name="gs_ws<?=$dsi?>" id="gs_ws<?=$dsi?>" value="<?=$ds['gs_ws']?>"/>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="gs_cache<?=$dsi?>" class="form-label">Cache</label>
|
||
|
<input type="number" name="gs_cache_val<?=$dsi?>" id="gs_cache_val<?=$dsi?>" value="<?=$ds['gs_cache_val']?>"/>
|
||
|
<select name="gs_cache_per<?=$dsi?>" id="gs_cache_per<?=$dsi?>">
|
||
|
<?php foreach(TIME_MAP as $per => $val) { ?>
|
||
|
<option value="<?=$per?>" <?php if($ds['gs_cache_per'] == $per) { ?> selected <?php } ?>><?=$per?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php $aci = $aci + 1;
|
||
|
} ?>
|
||
|
</fieldset>
|
||
|
|
||
|
<fieldset>
|
||
|
<legend>Layers</legend>
|
||
|
<?php
|
||
|
foreach($lys as $lyi => $ly) { ?>
|
||
|
<div class="panel-group" id="accordion<?=$aci?>" role="tablist" aria-multiselectable="false">
|
||
|
<div class="panel panel-default">
|
||
|
<div class="panel-heading" role="tab" id="heading<?=$aci?>">
|
||
|
<h5 class="panel-title">
|
||
|
<a role="button" data-toggle="collapse" class="accordion-plus-toggle collapsed" data-parent="#accordion<?=$aci?>" href="#collapse<?=$aci?>" aria-expanded="false" aria-controls="collapse<?=$aci?>"><?=$ly['name']?></a>
|
||
|
</h5>
|
||
|
</div>
|
||
|
<div id="collapse<?=$aci?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$aci?>">
|
||
|
|
||
|
<div class="form-group col-sm">
|
||
|
<input type="radio" class="layer_wms" data-id="<?=$lyi?>" name="layer_type<?=$lyi?>" value="wms" <?php if($ly['layer_type'] == 'wms'){ ?> checked<?php } ?>> <label for="layer_wms<?=$lyi?>">WMS</label>
|
||
|
<input type="radio" class="layer_gs_geo" data-id="<?=$lyi?>" name="layer_type<?=$lyi?>" value="gs_geo" <?php if($ly['layer_type'] == 'gs_geo'){ ?> checked<?php } ?>> <label for="layer_gs_geo<?=$lyi?>">GeoJSON(GS)</label>
|
||
|
</div>
|
||
|
|
||
|
<input type="hidden" name="layer_varname<?=$lyi?>" id="layer_varname<?=$lyi?>" value="<?=$ly['layer_varname']?>"/>
|
||
|
|
||
|
<div class="wms_details" id="wms_details<?=$lyi?>">
|
||
|
<label for="wms_url<?=$lyi?>" class="form-label">URL</label> <input type="text" class="form-control" name="wms_url<?=$lyi?>" id="wms_url<?=$lyi?>" value="<?=$ly['wms_url']?>"/>
|
||
|
<label for="wms_ws<?=$lyi?>" class="form-label">Workspace</label> <input type="text" class="form-control" name="wms_ws<?=$lyi?>" id="wms_ws<?=$lyi?>" value="<?=$ly['wms_ws']?>"/>
|
||
|
<label for="wms_layer<?=$lyi?>" class="form-label">Layer</label> <input type="text" class="form-control" name="wms_layer<?=$lyi?>" id="wms_layer<?=$lyi?>" value="<?=$ly['wms_layer']?>"/>
|
||
|
|
||
|
<label for="wms_user<?=$lyi?>" class="form-label">User (only for secured connections)</label> <input type="text" class="form-control" name="wms_user<?=$lyi?>" id="wms_user<?=$lyi?>" value="<?=$ly['wms_user']?>"/>
|
||
|
<label for="wms_pwd<?=$lyi?>" class="form-label">Password</label> <input type="password" class="form-control" name="wms_pwd<?=$lyi?>" id="wms_pwd<?=$lyi?>" value="<?=$ly['wms_pwd']?>"/>
|
||
|
</div>
|
||
|
|
||
|
<div class="gs_geo_details" id="gs_geo_details<?=$lyi?>">
|
||
|
<label for="gs_geo_host<?=$lyi?>" class="form-label">Host</label> <input type="text" class="form-control" name="gs_geo_host<?=$lyi?>" id="gs_geo_host<?=$lyi?>" value="<?=$ly['gs_geo_host']?>"/>
|
||
|
<label for="gs_geo_user<?=$lyi?>" class="form-label">User</label> <input type="text" class="form-control" name="gs_geo_user<?=$lyi?>" id="gs_geo_user<?=$lyi?>" value="<?=$ly['gs_geo_user']?>"/>
|
||
|
<label for="gs_geo_pwd<?=$lyi?>" class="form-label">Password</label> <input type="password" class="form-control" name="gs_geo_pwd<?=$lyi?>" id="gs_geo_pwd<?=$lyi?>" value="<?=$ly['gs_geo_pwd']?>"/>
|
||
|
<label for="gs_geo_ws<?=$lyi?>" class="form-label">Workspace</label> <input type="text" class="form-control" name="gs_geo_ws<?=$lyi?>" id="gs_geo_ws<?=$lyi?>" value="<?=$ly['gs_geo_ws']?>"/>
|
||
|
<label for="gs_geo_layer<?=$lyi?>" class="form-label">Layer</label> <input type="text" class="form-control" name="gs_geo_layer<?=$lyi?>" id="gs_geo_layer<?=$lyi?>" value="<?=$ly['gs_geo_layer']?>"/>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="gs_geo_color<?=$lyi?>" class="form-label">Color</label>
|
||
|
<input type="color" class="form-control" name="gs_geo_color<?=$lyi?>" id="gs_geo_color<?=$lyi?>" value="<?=$ly['gs_geo_color']?>"/>
|
||
|
<input type="range" class="form-control" name="gs_geo_opacity<?=$lyi?>" id="gs_geo_opacity<?=$lyi?>" value="<?=$ly['gs_geo_opacity']?>" min="0" max="100"/>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="gs_geo_fillcolor<?=$lyi?>" class="form-label">Fill Color</label>
|
||
|
<input type="color" class="form-control" name="gs_geo_fill_color<?=$lyi?>" id="gs_geo_fill_color<?=$lyi?>" value="<?=$ly['gs_geo_fill_color']?>"/>
|
||
|
<input type="range" class="form-control" name="gs_geo_fill_opacity<?=$lyi?>" id="gs_geo_fill_opacity<?=$lyi?>" value="<?=$ly['gs_geo_fill_opacity']?>" min="0" max="100"/>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="gs_geo_cache<?=$lyi?>" class="form-label">Cache</label>
|
||
|
<input type="number" name="gs_geo_cache_val<?=$lyi?>" id="gs_geo_cache_val<?=$lyi?>" value="<?=$ly['gs_geo_cache_val']?>"/>
|
||
|
<select name="gs_geo_cache_per<?=$lyi?>" id="gs_geo_cache_per<?=$lyi?>">
|
||
|
<?php foreach(TIME_MAP as $per => $val) { ?>
|
||
|
<option value="<?=$per?>" <?php if($ly['gs_geo_cache_per'] == $per) { ?> selected <?php } ?>><?=$per?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php $aci = $aci + 1;
|
||
|
} ?>
|
||
|
</fieldset>
|
||
|
|
||
|
|
||
|
<?php } ?>
|
||
|
|
||
|
<fieldset>
|
||
|
<legend>View</legend>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<input type="checkbox" class="form-checkbox" name="use_datatable" id="use_datatable" value="1" <?php if($use_dt) {?> checked <?php } ?>/>
|
||
|
<label for="use_datatable" class="form-label">Show DataTable below map</label>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="image" class="form-label">Preview image (.png, .jpeg formats)</label>
|
||
|
<?php if(isset($_GET['id']) && is_file("../assets/maps/".$_GET['id'].".png")){ ?>
|
||
|
<img src="../assets/maps/<?=$_GET['id']?>.png" alt="Map Preview" width="200" height="150">
|
||
|
<?php } else { ?>
|
||
|
<img src="../assets/maps/default.png" alt="Map Preview" width="200" height="150">
|
||
|
<?php } ?>
|
||
|
<input type="file" class="form-control" name="image" id="image" value="" accept=".png,.jpg,.jpeg"/>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="accgrps" class="form-label">Access Groups</label>
|
||
|
<select class="form-control" name="accgrps[]" id="accgrps" aria-label="Select access groups" multiple required>
|
||
|
<?php foreach($acc_grps as $k => $v){?>
|
||
|
<option <?php if(in_array($k, $map_acc_ids)){?> selected <?php }?> value="<?=$k?>"><?=$v?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
|
||
|
<button type="submit" class="btn btn-primary" id="btn_submit"><?php if(isset($_GET['id'])){ ?>Update<?php } else { ?>Create<?php } ?></button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<footer class="footer text-center">
|
||
|
</footer>
|
||
|
</div>
|
||
|
|
||
|
<script src="dist/js/sidebarmenu.js"></script>
|
||
|
<script src="dist/js/custom.js"></script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|