From c4fc382cd53392cefadc217039d4dffd113b0cb6 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 11 Sep 2016 21:00:43 +0000 Subject: [PATCH] First attempt of getting AJAX-TX-Info-section Actual only last callsign starting TX shown, but working --- include/functions.php | 29 ++++++++------- include/init.php | 14 ++++++++ include/txinfo.php | 84 +++++++++++++++++++++++++++++++++++++++++++ index.php | 2 ++ txinfo.php | 28 +++++++++++++++ 5 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 include/init.php create mode 100644 include/txinfo.php create mode 100644 txinfo.php diff --git a/include/functions.php b/include/functions.php index 8b84e72..7142eef 100644 --- a/include/functions.php +++ b/include/functions.php @@ -123,6 +123,14 @@ function getMMDVMLog() { return $logLines; } +function getShortMMDVMLog() { + // Open Logfile and copy loglines into LogLines-Array() + $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + + $logLines = explode("\n", `tail -n10 $logPath`); + return $logLines; +} + function getYSFGatewayLog() { // Open Logfile and copy loglines into LogLines-Array() $logLines = array(); @@ -142,7 +150,7 @@ function getYSFGatewayLog() { // 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 // M: 2016-04-30 14:57:43.072 DMR Slot 2, received RF voice header from DG9VH to 5000 -function getHeardList($logLines) { +function getHeardList($logLines, $onlyLast) { //array_multisort($logLines,SORT_DESC); $heardList = array(); $ts1duration = ""; @@ -279,16 +287,19 @@ function getHeardList($logLines) { $duration = ""; $loss =""; $ber = ""; + if ($onlyLast) { + return $heardList; + } } } return $heardList; } -function getLastHeard($logLines) { +function getLastHeard($logLines, $onlyLast) { //returns last heard list from log $lastHeard = array(); $heardCalls = array(); - $heardList = getHeardList($logLines); + $heardList = getHeardList($logLines, $onlyLast); $counter = 0; foreach ($heardList as $listElem) { if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || (startsWith($listElem[1], "DMR")) ) { @@ -526,16 +537,4 @@ function getName($callsign) { return $name; } -//Some basic inits -$mmdvmconfigs = getMMDVMConfig(); -$logLinesMMDVM = getMMDVMLog(); -$reverseLogLinesMMDVM = $logLinesMMDVM; -array_multisort($reverseLogLinesMMDVM,SORT_DESC); -$lastHeard = getLastHeard($reverseLogLinesMMDVM); -if (defined("ENABLEYSFGATEWAY")) { - $YSFGatewayconfigs = getYSFGatewayConfig(); - $logLinesYSFGateway = getYSFGatewayLog(); - $reverseLogLinesYSFGateway = $logLinesYSFGateway; - array_multisort($reverseLogLinesYSFGateway,SORT_DESC); -} ?> diff --git a/include/init.php b/include/init.php new file mode 100644 index 0000000..d633706 --- /dev/null +++ b/include/init.php @@ -0,0 +1,14 @@ + diff --git a/include/txinfo.php b/include/txinfo.php new file mode 100644 index 0000000..14dac70 --- /dev/null +++ b/include/txinfo.php @@ -0,0 +1,84 @@ +
+ +
Currently TXing
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Time (UTC)ModeCallsignNameDSTAR-IDTargetSource
+
+
+ diff --git a/index.php b/index.php index b1aa329..1ad901e 100644 --- a/index.php +++ b/index.php @@ -8,6 +8,7 @@ $start = $time; include "config/config.php"; include "include/tools.php"; include "include/functions.php"; +include "include/init.php"; include "version.php"; ?> @@ -63,6 +64,7 @@ if (defined("ENABLEMANAGEMENT")) { } checkSetup(); // 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/repeaterinfo.php"; diff --git a/txinfo.php b/txinfo.php new file mode 100644 index 0000000..30a46c2 --- /dev/null +++ b/txinfo.php @@ -0,0 +1,28 @@ +$listElem[0]"; + echo"$listElem[1]"; + echo"$listElem[2]"; + if (defined("ENABLEXTDLOOKUP")) { + echo "".getName($listElem[2]).""; + } + echo"$listElem[3]"; + echo"$listElem[4]"; + if ($listElem[5] == "RF"){ + echo "RF"; + }else{ + echo"$listElem[5]"; + } +} + +?> +