forked from SDFIdk/arkiv_meta_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
233 lines (219 loc) · 10.8 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php
include_once __DIR__.'/Classes/KFProxy.php';
include_once __DIR__.'/Classes/Document.php';
function makeSelectOption($val)
{
return "<option value=\"" . $val . "\">" . $val . "</option>";
}
$msg = [];
// Get data for listboxes
$proxy = new KFProxy();
// dækningsområde
$proxy->setUrl($proxy->getHost() . "/rest/arkivmeta/metadata/daekningsomraade");
$response = $proxy->getData();
$daekningsomraadeData = [];
if($response) {
foreach($response as $value) {
$daekningsomraadeData[] = makeSelectOption($value);
}
} else {
$msg[] = "Kunne ikke hente data fra " . $proxy->getUrl();
}
// kortværker
$proxy->setUrl($proxy->getHost() . "/rest/arkivmeta/metadata/kortvaerker");
$response = $proxy->getData();
$kortvaerkData = [];
if($response) {
foreach($response as $value) {
$kortvaerkData[] = makeSelectOption($value);
}
} else {
$msg[] = "Kunne ikke hente data fra " . $proxy->getUrl();
}
// målestok
$proxy->setUrl($proxy->getHost() . "/rest/arkivmeta/metadata/maalestok");
$response = $proxy->getData();
$maalestokData = [];
if($response) {
foreach($response as $value) {
$maalestokData[] = makeSelectOption($value);
}
} else {
$msg[] = "Kunne ikke hente data fra " . $proxy->getUrl();
}
$document = new Document("Arkivdata");
$document->generateDocumentStartHTML(
["js/bootstrap-select-1.12.4/bootstrap-select.min.js"],
["css/bootstrap-select-1.12.4/bootstrap-select.min.css"]
);
?>
<div class="row">
<div class="col-md-12">
<h1>Arkivdata</h1>
</div>
</div>
<form action="viewSearchResult.php" method="get" autocomplete="off">
<?php if($msg) { ?>
<div class="row">
<div class="col-md-12 col-sm-6">
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Fejl</h4>
<p><?php echo implode("<br>",$msg);?></p>
</div>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="kortvaerk">Kortværk <span class="small"><a id="kortvaerkReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<select name="kortvaerk" id="kortvaerk" data-width="100%" data-live-search="true" data-container="body" class="selectpicker">
<option value="" selected>Intet valgt</option>
<?php echo implode("", $kortvaerkData); ?>
</select>
<script type="text/javascript">
$('#kortvaerkReset').click(function() {
$('#kortvaerk').selectpicker('deselectAll')
.val([])
.trigger('change.abs.preserveSelected')
.selectpicker('refresh');
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="daekningsomraade">Dækningsområde <span class="small"><a id="daekningsomraadeReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<select name="daekningsomraade" id="daekningsomraade" data-width="100%" data-live-search="true" data-container="body" class="selectpicker">
<option value="" selected>Intet valgt</option>
<?php echo implode("", $daekningsomraadeData); ?>
</select>
<script type="text/javascript">
$('#daekningsomraadeReset').click(function() {
$('#daekningsomraade').selectpicker('deselectAll')
.val([])
.trigger('change.abs.preserveSelected')
.selectpicker('refresh');
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="maalestok">Målestok <span class="small"><a id="maalestokReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<select name="maalestok" id="maalestok" data-width="100%" data-live-search="true" data-container="body" class="selectpicker">
<option value="" selected>Intet valgt</option>
<?php echo implode("", $maalestokData); ?>
</select>
<script type="text/javascript">
$('#maalestokReset').click(function() {
$('#maalestok').selectpicker('deselectAll')
.val([])
.trigger('change.abs.preserveSelected')
.selectpicker('refresh');
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="titel">Titel <span class="small"><a id="titelReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<input class="form-control" type="text" placeholder="Indtast titel" id="titel" name="titel" autocomplete="off">
<script type="text/javascript">
$('#titelReset').click(function() {
$('#titel').val("");
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="gyldighedsaar">Gyldighedsår <span class="small"><a id="gyldighedsaarReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<input class="form-control" type="number" min="0" placeholder="Indtast gyldighedsår" id="gyldighedsaar" name="gyldighedsaar" autocomplete="off">
<script type="text/javascript">
$('#gyldighedsaarReset').click(function() {
$('#gyldighedsaar').val("");
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="kortbladnummer">Kortbladnummer <span class="small"><a id="kortbladnummerReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<input class="form-control" type="text" placeholder="Indtast kortbladnummer" id="kortbladnummer" name="kortbladnummer" autocomplete="off">
<script type="text/javascript">
$('#kortbladnummerReset').click(function() {
$('#kortbladnummer').val("");
return false;
});
</script>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="form-group">
<label for="bemaerk">Bemærkning <span class="small"><a id="bemaerkReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<input class="form-control" type="text" placeholder="Indtast bemærkning" id="bemaerk" name="bemaerk" autocomplete="off">
<script type="text/javascript">
$('#bemaerkReset').click(function() {
$('#bemaerk').val("");
return false;
});
</script>
</div>
</div>
<div class="col-md-8 col-sm-6">
<div class="form-group">
<label for="geometri">Geometri <span class="small"><a id="geometriReset" href="#" title="Nulstil"><i class="fa fa-remove"></i></a></span></label>
<input class="form-control" type="text" placeholder="Indtast WKT geometri" id="geometri" name="geometri" autocomplete="off" value="">
<div class="small pull-right">
<a href="#" class="wktlink" title="Danmark">Danmark</a>
<a href="#" class="wktlink" title="Næstved">Næstved</a>
<a href="#" class="wktlink" title="Odense">Odense</a>
</div>
<script type="text/javascript">
$('#geometriReset').click(function() {
$('#geometri').val("");
return false;
});
</script>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" style="vertical-align: bottom">
<button class="btn btn-primary">Søg</button>
</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('.selectpicker').selectpicker({});
$('.wktlink').click(function(e){
e.preventDefault();
var wkt;
switch (this.title) {
case 'Danmark':
wkt = 'POLYGON((10 54, 10 56, 13 56, 13 54, 10 54))';
break;
case 'Næstved':
wkt = 'POLYGON((11.662259820816189 55.333961620571394,11.988416437027126 55.333961620571394,11.988416437027126 55.11896429099891,11.662259820816189 55.11896429099891,11.662259820816189 55.333961620571394))';
break;
case 'Odense':
wkt = 'POLYGON((10.24577267977952 55.51476210208637,10.59733517977952 55.51476210208637,10.59733517977952 55.30621763024291,10.24577267977952 55.30621763024291,10.24577267977952 55.51476210208637))';
break;
default:
wkt = "";
}
$('#geometri').val(wkt);
});
});
</script>
<?php
$document->generateDocumentEndHTML();
?>