Skip to content
Permalink
Browse files

Added code to show older heard entries

  • Loading branch information...
acfnews committed Sep 1, 2018
1 parent 7dced54 commit d0e34495d25c4dfe6d933b7604384e7f6a60771b
Showing with 153 additions and 53 deletions.
  1. BIN favicon.ico
  2. +50 −50 include/allheard.php
  3. +34 −0 include/functions.php
  4. +11 −1 include/init.php
  5. +50 −0 include/oldheard.php
  6. +8 −2 index.php
BIN +718 Bytes favicon.ico
Binary file not shown.
@@ -1,50 +1,50 @@
<?php
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">All Heard List</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="allHeard" class="table table-condensed">
<thead>
<tr>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
<th>Dur (s)</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($allHeard); $i++) {
$listElem = $allHeard[$i];
echo"<tr>";
echo"<td>$listElem[0]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[1],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[1])."</td>";
//echo"<td>$listElem[1]</td>";
echo"<td>$listElem[2]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[3],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[3])."</td>";
echo"<td>$listElem[4]</td>";
echo"</tr>\n";
}
?>
</tbody>
</table>
</div>
<script>
$(document).ready(function(){
$('#allHeard').dataTable( {
"aaSorting": [[0,'desc']]
} );
});
</script>
</div>
<?php
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Todays Heard List</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="allHeard" class="table table-condensed">
<thead>
<tr>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
<th>Dur (s)</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($allHeard); $i++) {
$listElem = $allHeard[$i];
echo"<tr>";
echo"<td>$listElem[0]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[1],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[1])."</td>";
//echo"<td>$listElem[1]</td>";
echo"<td>$listElem[2]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[3],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[3])."</td>";
echo"<td>$listElem[4]</td>";
echo"</tr>\n";
}
?>
</tbody>
</table>
</div>
<script>
$(document).ready(function(){
$('#allHeard').dataTable( {
"aaSorting": [[0,'desc']]
} );
});
</script>
</div>
@@ -67,6 +67,40 @@ function getYSFReflectorLog() {
return $logLines;
}
function getOldYSFReflectorLog() {
// first loop through the directory to find all log files for this year
$dir = YSFREFLECTORLOGPATH;
$files = scandir($dir, 1);
$oldlogLines = array();
foreach ($files as $file) {
if ( $file != "." && $file != ".." ) {
// print "$file<br>"; // TMP
// Open older Logfiles and copy loglines into oldLogLines-Array()
// print "opening file $file<br>"; // TMP
if ($log = fopen(YSFREFLECTORLOGPATH."/".$file, 'r')) {
while ($oldlogLine = fgets($log)) {
// print "--log is $oldlogLine <br>"; // TMP
if (strpos($oldlogLine, 'Received data from') !== false) {
// print "----log is $oldlogLine <br>"; // TMP
array_push($oldlogLines, $oldlogLine);
}
// if (startsWith($oldlogLine, "M:"))
// // print "----log is $oldlogLine <br>"; // TMP
// array_push($oldlogLines, $oldlogLine);
}
fclose($log);
}
}
}
return $oldlogLines;
}
function getShortYSFReflectorLog() {
// Open Logfile and copy loglines into LogLines-Array()
$logPath = YSFREFLECTORLOGPATH."/".YSFREFLECTORLOGPREFIX."-".date("Y-m-d").".log";
@@ -3,10 +3,20 @@
$configs = getYSFReflectorConfig();
if (!defined("TIMEZONE"))
define("TIMEZONE", "UTC");
$logLines = getYSFReflectorLog();
if (defined("SHOWOLDMHEARD")) {
$oldlogLines = getOldYSFReflectorLog();
}
$reverseLogLines = $logLines;
array_multisort($reverseLogLines,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLines);
$allHeard = getHeardList($reverseLogLines);
?>
$reverseOldLogLines = $oldlogLines;
array_multisort($reverseOldLogLines,SORT_DESC);
// $oldlastHeard = getLastHeard($reverseOldLogLines); //TMP
$oldallHeard = getHeardList($reverseOldLogLines);
?>
@@ -0,0 +1,50 @@
<?php
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Alltime Heard List</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="oldallHeard" class="table table-condensed">
<thead>
<tr>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
<th>Dur (s)</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($oldallHeard); $i++) {
$listElem = $oldallHeard[$i];
echo"<tr>";
echo"<td>$listElem[0]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[1],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[1])."</td>";
//echo"<td>$listElem[1]</td>";
echo"<td>$listElem[2]</td>";
if (defined("GDPR"))
echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[3],0,3)."***")."</td>";
else
echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[3])."</td>";
echo"<td>$listElem[4]</td>";
echo"</tr>\n";
}
?>
</tbody>
</table>
</div>
<script>
$(document).ready(function(){
$('#oldallHeard').dataTable( {
"aaSorting": [[0,'desc']]
} );
});
</script>
</div>
@@ -34,6 +34,9 @@
h4 {
display: inline
}
body{
padding: 10px;
}
</style>
<title><?php echo getConfigItem("Info", "Name", $configs); ?> - YSFReflector-Dashboard by DG9VH</title>
</head>
@@ -55,10 +58,13 @@
// Here you can feel free to disable info-sections by commenting out with // before include
include "include/txinfo.php";
include "include/sysinfo.php";
include "include/disk.php";
//include "include/disk.php";
include "include/gateways.php";
include "include/lh.php";
include "include/allheard.php";
if (defined("SHOWOLDMHEARD")) {
include "include/oldheard.php";
}
?>
<div class="panel panel-info">
<?php
@@ -74,4 +80,4 @@
?> | get your own at: <a href="https://github.com/dg9vh/YSFReflector-Dashboard">https://github.com/dg9vh/YSFReflector-Dashboard</a>
</div>
</body>
</html>
</html>

0 comments on commit d0e3449

Please sign in to comment.
You can’t perform that action at this time.