Community Support

A few lines to add ...
 
Notifications
Clear all

A few lines to add "Outdated" message on tooltip over maps.

1 Posts
1 Users
1 Reactions
2,257 Views
daguilera
(@daguilera)
Posts: 39
Eminent Member
Topic starter
 

Hi there and Pierre,

This is a small contribution to code: a snippet that you could put on includes/classes/MapBaseHelper.php file about line 730, that allows you to show a "Outdated" message if the last retrieved data from certain weather station on map is older than 3 hours (you can easily change that setting, editing the "if" sentence.

$date->setTimezone(new \DateTimeZone($station['loc_timezone']));
$nowtime = date_create(); // now
$nowtime->setTimezone(new \DateTimeZone($station['loc_timezone']));

$ht1 = date_timestamp_get($date);
$ht2 = date_timestamp_get($nowtime);
$difference = abs($ht2 - $ht1);
if($difference > 10800){
$msgdesact = '<b>[Outdated]</b>';
} else {
$msgdesact = '';
}
$lr = $lr . '&nbsp; ' . $msgdesact . '&nbsp; ' . $date->format('d-m-Y H:i');

SALUDOS

This topic was modified 5 years ago by daguilera

David Aguilera-Riquelme (@davidagriq).
https://redmeteo.cl - an Open Chilean hobbyist weather network

 
Posted : 03/01/2020 5:23 am