Permalink
Browse files

make timezone switchable in setup

  • Loading branch information...
dg9vh committed Jan 31, 2017
1 parent 4d4dbca commit 87c11811c71d65a26782ff5d91deeb97f1a8f7a2
Showing with 70 additions and 10 deletions.
  1. +1 −1 include/allheard.php
  2. +1 −1 include/functions.php
  3. +2 −2 include/gateways.php
  4. +1 −1 include/lh.php
  5. +6 −0 include/tools.php
  6. +1 −1 include/txinfo.php
  7. +54 −0 setup.php
  8. +3 −3 txinfo.php
  9. +1 −1 version.php
View
@@ -8,7 +8,7 @@
<table id="allHeard" class="table table-condensed">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
View
@@ -140,7 +140,7 @@ function getHeardList($logLines) {
$gateway = substr($logLine, strrpos($logLine,"at") + 3);
// Callsign or ID should be less than 11 chars long, otherwise it could be errorneous
if ( strlen($callsign) < 11 ) {
array_push($heardList, array($timestamp, $callsign, $target, $gateway, $duration));
array_push($heardList, array(convertTimezone($timestamp), $callsign, $target, $gateway, $duration));
}
if(strpos($logLine,"end of") || strpos($logLine,"watchdog has expired") || strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) {
$txend = substr($logLine, 3, 19);
View
@@ -8,7 +8,7 @@
<table id="gateways" class="table table-condensed">
<thead>
<tr>
<th>Reporting Time (UTC)</th>
<th>Reporting Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
</tr>
</thead>
@@ -19,7 +19,7 @@
foreach ($gateways as $gateway) {
echo "<tr>";
echo "<td>$gateway[timestamp]</td><td>$gateway[callsign]</td>";
echo "<td>".convertTimezone($gateway[timestamp])."</td><td>$gateway[callsign]</td>";
echo "</tr>";
}
?>
View
@@ -8,7 +8,7 @@
<table id="lh" class="table table-condensed">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
View
@@ -80,4 +80,10 @@ function checkSetup() {
}
error_reporting($el);
}
function convertTimezone($timestamp) {
$date = new DateTime($timestamp);
$date->setTimezone(new DateTimeZone(TIMEZONE));
return $date->format('Y-m-d H:i:s');
}
?>
View
@@ -6,7 +6,7 @@
<table id="currtx" class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
View
@@ -77,6 +77,60 @@
</div>
<div class="container">
<h2>Global Configuration</h2>
<?php
function get_tz_options($selectedzone, $label, $desc = '') {
echo '<div class="input-group">';
echo '<span class="input-group-addon" id="TIMEZONE" style="width: 300px">Timezone</span>';
echo '<div class="input"><select name="TIMEZONE">';
function timezonechoice($selectedzone) {
$all = timezone_identifiers_list();
$i = 0;
foreach($all AS $zone) {
$zone = explode('/',$zone);
$zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : '';
$zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : '';
$zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
$i++;
}
asort($zonen);
$structure = '';
foreach($zonen AS $zone) {
extract($zone);
// if($continent == 'Africa' || $continent == 'America' || $continent == 'Antarctica' || $continent == 'Arctic' || $continent == 'Asia' || $continent == 'Atlantic' || $continent == 'Australia' || $continent == 'Europe' || $continent == 'Indian' || $continent == 'Pacific') {
if(!isset($selectcontinent)) {
$structure .= '<optgroup label="'.$continent.'">'; // continent
} elseif($selectcontinent != $continent) {
$structure .= '</optgroup><optgroup label="'.$continent.'">'; // continent
}
if(isset($city) != ''){
if (!empty($subcity) != ''){
$city = $city . '/'. $subcity;
}
if ($continent != "UTC") {
$structure .= "<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected "':'')." value=\"".($continent.'/'.$city)."\">".str_replace('_',' ',$city)."</option>"; //Timezone
} else {
$structure .= "<option ".(("UTC"==$selectedzone)?'selected="selected "':'')." value=\"UTC\">UTC</option>"; //Timezone
}
} else {
if (!empty($subcity) != ''){
$city = $city . '/'. $subcity;
}
$structure .= "<option ".(($continent==$selectedzone)?'selected="selected "':'')." value=\"".$continent."\">".$continent."</option>"; //Timezone
}
$selectcontinent = $continent;
// }
}
$structure .= '</optgroup>';
return $structure;
}
echo timezonechoice($selectedzone);
echo '</select>';
echo '</input>';
echo '</div>';
echo '</div>';
}
get_tz_options(constant("TIMEZONE"), "Timezone", '');
?>
<div class="input-group">
<span class="input-group-addon" id="LOGO" style="width: 300px">URL to Logo</span>
<input type="text" value="<?php echo constant("LOGO") ?>" name="LOGO" class="form-control" placeholder="http://your-logo" aria-describedby="LOGO">
View
@@ -10,7 +10,7 @@
array_multisort($reverseLogLines,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLines, True);
$listElem = $lastHeard[0];
if (strlen($listElem[0]) !== 0) {
if (strlen($listElem[1]) !== 0) {
echo "<tr>";
echo"<td nowrap>$listElem[0]</td>";
if (constant("SHOWQRZ") && $listElem[1] !== "??????????" && !is_numeric($listElem[1])) {
@@ -21,8 +21,8 @@
echo"<td nowrap>$listElem[2]</td>";
echo"<td nowrap>$listElem[3]</td>";
$UTC = new DateTimeZone("UTC");
$d1 = new DateTime($listElem[0], $UTC);
$d2 = new DateTime('now', $UTC);
$d1 = new DateTime($listElem[0], new DateTimeZone(TIMEZONE));
$d2 = new DateTime('now', new DateTimeZone(TIMEZONE));
$diff = $d2->getTimestamp() - $d1->getTimestamp();
echo"<td nowrap>$diff s</td>";
echo "</tr>";
View
@@ -1,3 +1,3 @@
<?php
define("VERSION", "20161029-1");
define("VERSION", "20170131-1");
?>

0 comments on commit 87c1181

Please sign in to comment.