Added recordings map

This commit is contained in:
Samuel Ortion 2021-04-16 13:41:22 +02:00
parent 0384e3ee48
commit 8a246e7dc1
9 changed files with 115 additions and 22 deletions

View File

@ -16,8 +16,10 @@ try {
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
$req = $db->prepare('SELECT * FROM `records`');
$req->execute();
$result = $req->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
@ -25,10 +27,15 @@ try {
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Make sure you put this AFTER Leaflet's CSS -->
<link rel="stylesheet" type="text/css" href="/styles/style.css">
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
</head>
<?php
include("$root/analytics/matomo.php");
@ -42,12 +49,11 @@ include("$root/analytics/matomo.php");
<div id="map"></div>
</section>
<?php include("$root/footer.php");?>
<script>
let obs = <?= json_encode($result);?>
</script>
<script src="/scripts/script.js"></script>
<script src='/scripts/jquery/script.js'></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<script src="scripts/map.js"></script>
</body>
</html>

View File

@ -1,9 +1,13 @@
var mymap = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXVmanF1bzEwd2Mybm82Nzlobm42bHAifQ.fKY7fUnY-MpzZUcseao0zg'
}).addTo(mymap);
var map = L.map('map').setView([0, 0], 13).setZoom(1);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
for (let record of obs) {
L.circleMarker([record['lat'], record['lng']], {
radius: 2
}).addTo(map).on("click", function (e) {
e.target.bindPopup(`<em>${record['species']}</em> recorded on ${record['date']} <a href="/storage/records/${record['file_name']}"><i style="font-size:24px" class="fa">&#xf08e;</i></a>`);
});
}

View File

@ -52,7 +52,7 @@ include("$root/analytics/matomo.php");
</thead>
<tbody>
<tr>
<td><?=$data['species']." ".$data['subspecies']?></td>
<td><em><?=$data['species']." ".$data['subspecies']?></em></td>
<td><a href="../spectrograms/?record=<?=$data['id']?>"><?=$data['file_name']?></a></td>
<td><?=$data['recordist_name']?></td>
<td><?=$data['license']?></td>

View File

@ -0,0 +1,68 @@
<?php
session_reset();
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require "$root/database/credentials.php";
// Connect the database
try {
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
$user,
$password,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
$req = $db->prepare('SELECT * FROM `authors`');
$req->execute();
$result = $req->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>
<section>
<h3>Explore</h3>
<h4>Random Record</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Username</th>
<th>Private message link</th>
</tr>
</thead>
<tbody>
<?php
foreach($result as $row) {
?>
<tr>
<th><?=$row['firstname']?> <?=$row['lastname']?></th>
<th><?=$row['username']?></th>
<th><a href="/discussion/messages/?author=<?=$row['id']?>"><img src="/media/icons/bubble.png" alt="message bubble"></a></th>
</tr>
<?php
}
?>
</tbody>
</table>
</section>
<?php include("$root/footer.php");?>
</body>
<script src="/scripts/script.js"></script>
</html>

View File

@ -1,11 +1,11 @@
<header>
<div class="container row">
<a href="/">
<div class="container column">
<div class="container column">
<a href="/">
<h1>Chiro - Canto</h1>
<h2>Bat sound sharing tools</h2>
</div>
</a>
</a>
</div>
<?php include("$root/search/searchbar.php");?>
</div>
</header>

View File

@ -37,9 +37,11 @@ if ($data = $req->fetch()) {
<?=$taxa_counter?> Taxa Available<br>
<?php
$bytes = disk_free_space ("$root/storage/records");
$bytes = disk_free_space("$root/storage/records");
$total = disk_total_space("$root/storage/records");
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
echo sprintf('%1.2f', $bytes / pow($base,$class)).' '.$si_prefix[$class];?> of Free space <br>
<progress id="space" max="<?=$total?>" value="<?=$total-$bytes?>"> <?=$bytes?> </progress>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -32,6 +32,9 @@
</a><a href="/explore/guano">
<li>guano</li>
</a>
<a href="/explore/users">
<li>users</li>
</a>
</ul>
</div>
</div></li>

View File

@ -615,3 +615,13 @@ article#guano {
.spectro {
}
#map {
height: 50vh;
width: 50vw;
}
i, .fa {
height: 0.1em;
color: black;
}