First attempt of dashboard

This commit is contained in:
dg9vh 2016-04-30 15:38:12 +02:00
parent 7ec596e52f
commit 6293153ba4
5 changed files with 138 additions and 0 deletions

View file

@ -1,2 +1,13 @@
# MMDVMHost-Dashboard # MMDVMHost-Dashboard
Dashboard for MMDVMHost (by G4KLX) Dashboard for MMDVMHost (by G4KLX)
==================================
This is a first attempt for a dashboard for MMDVMHost-Software by G4KLX. It is configured by a file
"config/config.php" where some basic information are defined.
Copy all files into your webroot and enjoy working with it.
Contact
=======
Feel free to contact the author via email: dg9vh@darc.de

8
config/config.php Normal file
View file

@ -0,0 +1,8 @@
<?php
date_default_timezone_set('UTC');
define("REPEATERCALLSIGN","DG9VH");
define("LOGPATH","/mnt/ramdisk/");
define("LOGPREFIX","MMDVM");
define("LOGFILE",LOGPATH . LOGPREFIX . "-" . date("Y-m-d") . ".log");
define("REFRESHAFTER","60");
?>

47
include/functions.php Normal file
View file

@ -0,0 +1,47 @@
<?php
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
// M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S
// M: 2016-04-29 19:43:21.839 DMR Slot 2, received network voice header from DL1ESZ to TG 9
function getLastHeard() {
$lastHeard = array();
$heardList = array();
$heardCalls = array();
if ($log = fopen(LOGFILE,'r')) {
while ($logLine = fgets($log)) {
// timestamp, mode, callsign, dstarid, target
$timestamp = substr($logLine, 3, 19);
$mode = substr($logLine, 27, strpos($logLine,",") - 27);
$callsign2 = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
$callsign = $callsign2;
if (strpos($callsign2,"/") > 0) {
$callsign = substr($callsign2, 0, strpos($callsign2,"/"));
}
$callsign = trim($callsign);
$id ="";
if ($mode == "D-Star") {
$id = substr($callsign2, strpos($callsign2,"/") + 1);
}
$target = substr($logLine, strpos($logLine, "to") + 3);
if ( strlen($callsign <7) ) {
array_push($heardList, array($timestamp, $mode, $callsign, $id, $target));
}
//Last-Heard-Liste: Array aufbauen in umgekehrter Richtung des Logs
//Zeilen ausblenden, bei denen das Callsign länger als 6 Stellen ist
}
fclose($log);
}
array_multisort($heardList,SORT_DESC);
foreach ($heardList as $listElem) {
if(!(array_search($listElem[2], $heardCalls) > -1)) {
array_push($heardCalls, $listElem[2]);
array_push($lastHeard, $listElem);
}
}
return $lastHeard;
}
//getLastHeard();
?>

34
include/lh.php Normal file
View file

@ -0,0 +1,34 @@
<?php
$lastHeard = getLastHeard();
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Last Heard List</div>
<div class="panel-body">
<p>In the following table you find the last heard callsigns on this repeater of the current day</p>
</div>
<!-- Tabelle -->
<table class="table">
<tr>
<th>Time</th>
<th>Mode</th>
<th>Callsign</th>
<th>DSTAR-ID</th>
<th>Target</th>
</tr>
<?php
foreach ($lastHeard as $listElem) {
//$timestamp, $mode, $callsign, $id, $target
echo"<tr>";
echo"<td>$listElem[0]</td>";
echo"<td>$listElem[1]</td>";
echo"<td>$listElem[2]</td>";
echo"<td>$listElem[3]</td>";
echo"<td>$listElem[4]</td>";
echo"</tr>";
}
?>
</table>
</div>

38
index.php Normal file
View file

@ -0,0 +1,38 @@
<?php
include "config/config.php";
include "include/functions.php";
?>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="<?php echo REFRESHAFTER?>">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<!-- Das neueste kompilierte und minimierte CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optionales Theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Das neueste kompilierte und minimierte JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title>MMDVM-Dashboard by DG9VH</title>
</head>
<body>
<div class="page-header">
<h1>MMDVM-Dashboard by DG9VH <small>Repeater: <?php echo REPEATERCALLSIGN?></small></h1>
</div>
<?php
include "include/lh.php";
?>
<div class="panel panel-info">
<?php
date_default_timezone_set("UTC");
$datum = date("d.m.Y");
$uhrzeit = date("H:i:s");
echo "Last Update $datum, $uhrzeit";
?>
</div>
</body>
</html>