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'); date_default_timezone_set('UTC');
$mapbox_token="write_mapbox_token_here";
$db_server = "mariadb"; $db_server = "mariadb";
$db_user = "dbuser"; $db_user = "dbuser";
$db_passwd = "geheim"; $db_passwd = "geheim";

View File

@ -9,7 +9,7 @@ services:
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.unfallkarte.entrypoints=https" - "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=true"
- "traefik.http.routers.unfallkarte.tls.certresolver=http" - "traefik.http.routers.unfallkarte.tls.certresolver=http"
- "traefik.http.routers.unfallkarte.middlewares=default@file" - "traefik.http.routers.unfallkarte.middlewares=default@file"

View File

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