mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 05:03:47 +00:00
use icon for visualisation of current weather
This commit is contained in:
parent
ce637c5845
commit
7c6ae901d9
3 changed files with 13 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
#curweather-network img {
|
||||||
|
float: left;
|
||||||
|
margin: 20px 10px;
|
||||||
|
}
|
||||||
ul.curweather-details li {
|
ul.curweather-details li {
|
||||||
list-type: none;
|
list-type: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
|
||||||
'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'],
|
'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'],
|
||||||
'descripion' => $desc,
|
'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'],
|
||||||
|
'icon' => (string)$res->weather['icon']
|
||||||
);
|
);
|
||||||
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
|
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||||
Cache::set('curweather'.md5($url), serialize($r));
|
Cache::set('curweather'.md5($url), serialize($r));
|
||||||
|
@ -107,6 +108,7 @@ function curweather_network_mod_init(&$fk_app,&$b) {
|
||||||
$t = get_markup_template("widget.tpl", "addon/curweather/" );
|
$t = get_markup_template("widget.tpl", "addon/curweather/" );
|
||||||
$curweather = replace_macros ($t, array(
|
$curweather = replace_macros ($t, array(
|
||||||
'$title' => t("Current Weather"),
|
'$title' => t("Current Weather"),
|
||||||
|
'$icon' => $res['icon'],
|
||||||
'$city' => $res['city'],
|
'$city' => $res['city'],
|
||||||
'$lon' => $res['lon'],
|
'$lon' => $res['lon'],
|
||||||
'$lat' => $res['lat'],
|
'$lat' => $res['lat'],
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
<div class="title tool">
|
<div class="title tool">
|
||||||
<h4 title="{{$lastupdate}}">{{$title}}: {{$city}}</h4>
|
<h4 title="{{$lastupdate}}">{{$title}}: {{$city}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<p>{{$description}}, {{$temp}}
|
<p>
|
||||||
|
<img src="http://openweathermap.org/img/w/{{$icon}}.png" title="{{$description}}">
|
||||||
<ul class="curweather-details">
|
<ul class="curweather-details">
|
||||||
<li>{{$relhumidity['caption']}}: {{$relhumidity['val']}}</li>
|
<li><strong>{{$temp}}</strong></li>
|
||||||
<li>{{$pressure['caption']}}: {{$pressure['val']}}</li>
|
<li>{{$relhumidity['caption']}}: {{$relhumidity['val']}}</li>
|
||||||
<li>{{$wind['caption']}}: {{$wind['val']}}</li>
|
<li>{{$pressure['caption']}}: {{$pressure['val']}}</li>
|
||||||
|
<li>{{$wind['caption']}}: {{$wind['val']}}</li>
|
||||||
</ul></p>
|
</ul></p>
|
||||||
<p class="curweather-footer">
|
<p class="curweather-footer">
|
||||||
{{$databy}}: <a href="http://openweathermap.org">OpenWeatherMap</a>. <a href="http://openweathermap.org/Maps?zoom=7&lat={{$lat}}&lon={{$lon}}&layers=B0FTTFF">{{$showonmap}}</a>
|
{{$databy}}: <a href="http://openweathermap.org">OpenWeatherMap</a>. <a href="http://openweathermap.org/Maps?zoom=7&lat={{$lat}}&lon={{$lon}}&layers=B0FTTFF">{{$showonmap}}</a>
|
||||||
|
|
Loading…
Reference in a new issue