pull/281/head
Tobias Diekershoff 2015-07-15 13:15:02 +02:00
parent e750412d87
commit ce637c5845
2 changed files with 10 additions and 6 deletions

View File

@ -37,6 +37,11 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
$tunit = '°F'; $tunit = '°F';
$wunit = 'mph'; $wunit = 'mph';
} }
if ( trim((string)$res->weather['value']) == trim((string)$res->clouds['name']) ) {
$desc = (string)$res->clouds['name'];
} else {
$desc = (string)$res->weather['value'].', '.(string)$res->clouds['name'];
}
$r = array( $r = array(
'city'=> (string) $res->city['name'][0], 'city'=> (string) $res->city['name'][0],
'country' => (string) $res->city->country[0], 'country' => (string) $res->city->country[0],
@ -45,7 +50,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
'temperature' => (string) $res->temperature['value'][0].$tunit, 'temperature' => (string) $res->temperature['value'][0].$tunit,
'pressure' => (string) $res->pressure['value'].(string)$res->pressure['unit'], 'pressure' => (string) $res->pressure['value'].(string)$res->pressure['unit'],
'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'], 'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'],
'descripion' => (string)$res->weather['value'].', '.(string)$res->clouds['name'], 'descripion' => $desc,
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')', 'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
'update' => (string)$res->lastupdate['value'] 'update' => (string)$res->lastupdate['value']
); );
@ -73,9 +78,10 @@ function curweather_network_mod_init(&$fk_app,&$b) {
$fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n"; $fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
// the OpenWeatherMap-PHP-APIlib does all the work here // $rpt value is needed for location
// the $rpt value is needed for location
// $lang will be taken from the browser session to honour user settings // $lang will be taken from the browser session to honour user settings
// TODO $lang does not work if the default settings are used
// and not all response strings are translated
// $units can be set in the settings by the user // $units can be set in the settings by the user
// $appid is configured by the admin in the admin panel // $appid is configured by the admin in the admin panel
// those parameters will be used to get: cloud status, temperature, preassure // those parameters will be used to get: cloud status, temperature, preassure

View File

@ -1,6 +1,4 @@
<span id="settings_curweather_inflated" class="settings-block fakelink" <span id="settings_curweather_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_curweather_expanded'); openClose('settings_curweather_inflated');">
style="display: block;" onclick="openClose('settings_curweather_expanded');
openClose('settings_curweather_inflated');">
<h3>{{$header}}</h3> <h3>{{$header}}</h3>
</span> </span>
<div id="settings_curweather_expanded" class="settings-block" style="display: none;"> <div id="settings_curweather_expanded" class="settings-block" style="display: none;">