years as select

This commit is contained in:
Walter Hupfeld 2023-10-06 20:27:05 +02:00
parent 6b233bd192
commit 0470740929
3 changed files with 48 additions and 43 deletions

View File

@ -2,6 +2,8 @@
date_default_timezone_set('UTC');
$mapbox_token="write_mapbox_token_here";
$db_server = "mariadb";
$db_user = "dbuser";
$db_passwd = "geheim";

View File

@ -9,7 +9,7 @@ services:
labels:
- "traefik.enable=true"
- "traefik.http.routers.unfallkarte.entrypoints=https"
- "traefik.http.routers.unfallkarte.rule=Host(`unfallkarte.bankerheide.de`,`unfallkarte.hpadm.de`,`unfallkarte.adfc-hamm.de`,`unfallkarte.radwege-hamm.de`,`www.unfallkarte.adfc-hamm.de`,`www.unfallkarte.radwege-hamm.de`)"
- "traefik.http.routers.unfallkarte.rule=Host(`unfallkarte.bankerheide.de`,`unfallkarte.adfc-hamm.de`,`unfallkarte.radwege-hamm.de`,`www.unfallkarte.adfc-hamm.de`,`www.unfallkarte.radwege-hamm.de`)"
- "traefik.http.routers.unfallkarte.tls=true"
- "traefik.http.routers.unfallkarte.tls.certresolver=http"
- "traefik.http.routers.unfallkarte.middlewares=default@file"

View File

@ -149,42 +149,45 @@
<body>
<!-- Navbar -->
<!-- Navbar ######################## -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#"><?= $strTitle ?></a>
<form method="GET" action="index.php">
<select name="year" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
<?php
for ($i=$numLatestYear;$i>=$numStartYear;$i--) {
$strActive = ($i==$numYear) ? "selected=\"selected\"" : "";
echo "<option value='$i' $strActive >$i</a>";
}
echo "<input type='hidden' name='v' value='$numVehicle'>";
echo "<input type='hidden' name='d' value='$strDistrict'>";
?>
</form>
<div class="collapse navbar-collapse" id="navbars">
<ul class="navbar-nav mr-auto">
<?php foreach ($arrVehicles as $key => $strVehicle):
$strActive = ($numVehicle==$key) ? "active" : ""
?>
<li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>&year=<?=$numYear?>&d=<?=$strDistrict?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a>
<?php endforeach; ?>
<?php
for ($i=$numLatestYear;$i>=$numStartYear;$i--) {
echo "<a class='navbar-brand' href='index.php?year=$i&v=$numVehicle&d=$strDistrict'>$i</a>";
}
?>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbars">
<ul class="navbar-nav mr-auto">
<?php foreach ($arrVehicles as $key => $strVehicle):
$strActive = ($numVehicle==$key) ? "active" : ""
?>
<li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>&year=<?=$numYear?>&d=<?=$strDistrict?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a>
<?php endforeach; ?>
</ul>
</ul>
<div>
<form method="GET" action="index.php">
<select name="d" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
<?php foreach ($arrDistrict as $key => $strTitle):
$strActive = ($strDistrict==$key) ? "selected=\"selected\"" : ""; ?>
<option value="<?=$key?>" <?=$strActive?>><?=$strTitle?></option>
<?php endforeach; ?>
</select>
</from>
<!-- District -->
<form method="GET" action="index.php">
<select name="d" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
<?php foreach ($arrDistrict as $key => $strTitle):
$strActive = ($strDistrict==$key) ? "selected=\"selected\"" : ""; ?>
<option value="<?=$key?>" <?=$strActive?>><?=$strTitle?></option>
<?php endforeach; ?>
</select>
</form>
<ul class="navbar-nav mr-auto right">
<li class="nav-item">
<a class="nav-link" href="impressum.php">Impressum</a>
@ -194,9 +197,15 @@
</li>
</ul>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
<!-- Ende Navbar -->
<!-- Ende Navbar ############# -->
<div class="container-fluid" style="margin-top: 4em;">
<div class="row">
@ -220,21 +229,15 @@
<!-- row -->
</div>
<!-- container-fluid -->
<div id="loader"><img src="css/images/ajax-loader.gif"></div>
<script>
// Map ----------------------------------------------------------------------
var mymap = L.map('mapid').setView([<?=$numInfoLat ?>, <?=$numInfoLng ?>], <?=$numZoom ?>);
var mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
// ocmlink = '<a href="http://thunderforest.com/">Thunderforest</a>';
var ocmLink = '<a href="https://www.mapbox.com/">Mapbox</a>';
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=sk.eyJ1Ijoid2h1cGZlbGQiLCJhIjoiY2xrMW1icTYzMDUxMTNkbXF6NmIyeWI0aSJ9.-GyWgYxxDQGQnD2KnqTOug', {
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=<?=$mapbox_token?>', {
maxZoom: 18,
minZoom:<?=$numZoom ?>,
attribution: 'Map data &copy; '+ mapLink +' contributors, ' +
@ -274,11 +277,11 @@
"opacity": 0.6
};
var hammLayer = new L.GeoJSON.AJAX(["<?= $fileGeojson ?>"], {
var districtLayer = new L.GeoJSON.AJAX(["<?= $fileGeojson ?>"], {
style: myStyle,
invert: true
});
hammLayer.addTo(mymap);
districtLayer.addTo(mymap);
// Marker from database -------------------------------------------------------