From 58e0f06cf2bc2bc8c2b896df238f4d5ef1b8c954 Mon Sep 17 00:00:00 2001 From: Alfred Egger Date: Sun, 12 Apr 2020 03:40:46 +0200 Subject: [PATCH] Add additional weather information provided by OpenWeatherMap API --- css/style.css | 16 ++++++++++++---- lib/Controller/WeatherController.php | 3 +++ templates/main.php | 13 +++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/css/style.css b/css/style.css index c9c8016..0784c38 100644 --- a/css/style.css +++ b/css/style.css @@ -88,7 +88,9 @@ #city-right .city-current-pressure, #city-right .city-current-wind, #city-right .city-current-humidity, #city-right .city-current-weather, -#city-right .city-current-sunrise, #city-right .city-current-sunset { +#city-right .city-current-sunrise, #city-right .city-current-sunset, +#city-right .city-current-temp_feelslike, #city-right .city-current-temp_min, +#city-right .city-current-temp_max { font-size: 2em; line-height: 1em; } @@ -171,7 +173,9 @@ #city-right .city-current-pressure, #city-right .city-current-wind, #city-right .city-current-weather, #city-right .city-current-humidity, -#city-right .city-current-sunrise, #city-right .city-current-sunset { +#city-right .city-current-sunrise, #city-right .city-current-sunset, +#city-right .city-current-temp_feelslike, #city-right .city-current-temp_min, +#city-right .city-current-temp_max { font-size: 3em; } #city-forecast-panel { @@ -190,7 +194,9 @@ #city-right .city-current-pressure, #city-right .city-current-wind, #city-right .city-current-weather, #city-right .city-current-humidity, -#city-right .city-current-sunrise, #city-right .city-current-sunset { +#city-right .city-current-sunrise, #city-right .city-current-sunset, +#city-right .city-current-temp_feelslike, #city-right .city-current-temp_min, +#city-right .city-current-temp_max { font-size: 2.2em; } #city-forecast-panel { @@ -214,7 +220,9 @@ #city-right .city-current-pressure, #city-right .city-current-wind, #city-right .city-current-weather, #city-right .city-current-humidity, -#city-right .city-current-sunrise, #city-right .city-current-sunset { +#city-right .city-current-sunrise, #city-right .city-current-sunset, +#city-right .city-current-temp_feelslike, #city-right .city-current-temp_min, +#city-right .city-current-temp_max { font-size: 1.6em; } } diff --git a/lib/Controller/WeatherController.php b/lib/Controller/WeatherController.php index 890a2dc..c9deaf9 100644 --- a/lib/Controller/WeatherController.php +++ b/lib/Controller/WeatherController.php @@ -104,6 +104,9 @@ class WeatherController extends IntermediateController { 'date' => $this->UnixTimeToString($forecast['list'][$i]['dt']), 'weather' => $forecast['list'][$i]['weather'][0]['description'], 'temperature' => $forecast['list'][$i]['main']['temp'], + 'temperature_feelslike' => $forecast['list'][$i]['main']['feels_like'], + 'temperature_min' => $forecast['list'][$i]['main']['temp_min'], + 'temperature_max' => $forecast['list'][$i]['main']['temp_max'], 'pressure' => $forecast['list'][$i]['main']['pressure'], 'humidity' => $forecast['list'][$i]['main']['humidity'], 'wind' => array( diff --git a/templates/main.php b/templates/main.php index ead3b29..2a7bcfa 100644 --- a/templates/main.php +++ b/templates/main.php @@ -53,7 +53,10 @@ -
{{ currentCity.main.temp }}{{ metricRepresentation }}
+
t('Current Temperature')); ?>; {{ currentCity.main.temp }}{{ metricRepresentation }}
+
t('Apparent Temperature')); ?>; {{ currentCity.main.feels_like }}{{ metricRepresentation }}
+
t('Minimum Temperature')); ?>; {{ currentCity.main.temp_min }}{{ metricRepresentation }}
+
t('Maximum Temperature')); ?>; {{ currentCity.main.temp_max }}{{ metricRepresentation }}
t('Pressure')); ?>: {{ currentCity.main.pressure }} hpa
t('Humidity')); ?>: {{ currentCity.main.humidity}}%
t('Cloudiness')); ?>: {{ currentCity.weather[0].description }}
@@ -65,7 +68,10 @@ - + + + + @@ -74,6 +80,9 @@ + + +
t('Date')); ?>t('Temperature')); ?>t('Current Temperature')); ?>t('Apparent Temperature')); ?>t('Minimum Temperature')); ?>t('Maximum Temperature')); ?> t('Weather')); ?> t('Pressure')); ?> t('Humidity')); ?>
{{ forecast.date }} {{ forecast.temperature }}{{ metricRepresentation }}{{ forecast.temperature_feelslike }}{{ metricRepresentation }}{{ forecast.temperature_min }}{{ metricRepresentation }}{{ forecast.temperature_max }}{{ metricRepresentation }} {{ forecast.weather }} {{ forecast.pressure }} hpa {{ forecast.humidity }} %