]> git.mxchange.org Git - friendica-addons.git/commitdiff
use icon for visualisation of current weather
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 17 Jul 2015 14:46:54 +0000 (16:46 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 17 Jul 2015 14:46:54 +0000 (16:46 +0200)
curweather/curweather.css
curweather/curweather.php
curweather/templates/widget.tpl

index a0b7c8fb01871c34a75fe1a3d12f6b6868c555fa..adf948f093bafee59df6d2efa97e154270c1b253 100644 (file)
@@ -1,3 +1,7 @@
+#curweather-network img {
+    float: left;
+    margin: 20px 10px;
+}
 ul.curweather-details li {
     list-type: none;
 }
index 58daab0b86354e1c7682f5e0d50b1d3063629e48..88eee9c9713acccfd6f0ec32836517d2164aec2f 100644 (file)
@@ -52,7 +52,8 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
        'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'],
        'descripion' => $desc,
        '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());
     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/" );
        $curweather = replace_macros ($t, array(
            '$title' => t("Current Weather"),
+           '$icon' => $res['icon'],
            '$city' => $res['city'],
            '$lon' => $res['lon'],
            '$lat' => $res['lat'],
index 910c0258695a0726cfeee462e6ee9cba4398aa80..9c6cacd3bf6134ca7288aa64e99d43f15f3d63d0 100644 (file)
@@ -2,11 +2,13 @@
        <div class="title tool">
                <h4 title="{{$lastupdate}}">{{$title}}: {{$city}}</h4>
        </div>
-       <p>{{$description}}, {{$temp}}
+       <p>
+       <img src="http://openweathermap.org/img/w/{{$icon}}.png" title="{{$description}}">
        <ul class="curweather-details">
-               <li>{{$relhumidity['caption']}}: {{$relhumidity['val']}}</li>
-               <li>{{$pressure['caption']}}: {{$pressure['val']}}</li>
-               <li>{{$wind['caption']}}: {{$wind['val']}}</li>
+           <li><strong>{{$temp}}</strong></li>
+           <li>{{$relhumidity['caption']}}: {{$relhumidity['val']}}</li>
+           <li>{{$pressure['caption']}}: {{$pressure['val']}}</li>
+           <li>{{$wind['caption']}}: {{$wind['val']}}</li>
        </ul></p>
        <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>