diff --git a/langs/en/titles.json b/langs/en/titles.json index 35b1b92..4836a0f 100644 --- a/langs/en/titles.json +++ b/langs/en/titles.json @@ -1,5 +1,6 @@ { "Overview": "Overview", "News": "News", - "Headlines": "Headlines" + "Headlines": "Headlines", + "Weather": "Weather" } diff --git a/langs/en/weather.json b/langs/en/weather.json index 4d9c085..dbaf255 100644 --- a/langs/en/weather.json +++ b/langs/en/weather.json @@ -2,5 +2,7 @@ "High: {temp}{units}": "High: {temp}{units}", "Low: {temp}{units}": "Low: {temp}{units}", "Temperature: {temp}{units}": "Temperature: {temp}{units}", - "{temp}{units}": "{temp}{units}" + "{temp}{units}": "{temp}{units}", + "{tempLow} to {tempHigh}{units}": "{tempLow} to {tempHigh}{units}", + "Low: {tempLow}{units} High: {tempHigh}{units}": "Low: {tempLow}{units} | High: {tempHigh}{units}" } diff --git a/lib/Weather_DarkSky.lib.php b/lib/Weather_DarkSky.lib.php index db84c62..cc1e578 100644 --- a/lib/Weather_DarkSky.lib.php +++ b/lib/Weather_DarkSky.lib.php @@ -41,6 +41,35 @@ class Weather_DarkSky extends Weather { $currently->windBearing = $resp->currently->windBearing; $this->setCurrently($currently); + + foreach ($resp->daily->data as $day) { + $daily = new Conditions(); + + $daily->lat = $this->lat; + $daily->lng = $this->lng; + $daily->time = $day->time; + + $daily->summary = $day->summary; + $daily->setDayorNight(); + + $daily->tempHigh = $day->temperatureMax; + $daily->tempLow = $day->temperatureMin; + + $daily->precipProbability = $day->precipProbability; + + $daily->ozone = $day->ozone; + $daily->dewpoint = $day->dewPoint; + $daily->cloudCover = $day->cloudCover; + $daily->humidity = $day->humidity; + $daily->visibility = $day->visibility; + $daily->uvindex = $day->uvIndex; + + $daily->windSpeed = $day->windSpeed; + $daily->windGust = $day->windGust; + $daily->windBearing = $day->windBearing; + + $this->conditions[] = $daily; + } } } diff --git a/pages.php b/pages.php index 8329676..34e1107 100644 --- a/pages.php +++ b/pages.php @@ -29,6 +29,14 @@ define("PAGES", [ "static/js/news.js" ] ], + "weather" => [ + "title" => "Weather", + "navbar" => true, + "icon" => "fas fa-cloud", + "styles" => [ + "static/weather-icons/css/weather-icons.min.css" + ], + ], "404" => [ "title" => "404 error" ] diff --git a/pages/home.php b/pages/home.php index 0b83df6..4836775 100644 --- a/pages/home.php +++ b/pages/home.php @@ -33,16 +33,73 @@ foreach ($newsitems as $item) {
-
- getCurrently(); - ?> -
- +
+
+ getCurrently(); + $forecast = $weather->getForecast(); + ?> +
+
+ +
+
+

summary; ?>

+

build("{temp}{units}", ["temp" => round(Weather::convertDegCToUnits($currently->temperature, $tempunits), 1), "units" => " $degreesymbol$tempunits"]); ?>

+
+
+
+

build("Low: {tempLow}{units} High: {tempHigh}{units}", [ + "tempLow" => round(Weather::convertDegCToUnits($forecast[0]->tempLow, $tempunits), 1), + "tempHigh" => round(Weather::convertDegCToUnits($forecast[0]->tempHigh, $tempunits), 1), + "units" => " $degreesymbol$tempunits" + ]); + ?>

+

+ summary; + ?> +

+
-
-

summary; ?>

-

build("{temp}{units}", ["temp" => round(Weather::convertDegCToUnits($currently->temperature, $tempunits), 1), "units" => " $degreesymbol$tempunits"]); ?>

+
+ = 4) { + break; + } + $i++; + ?> +
+
+ +
+
+ time); ?> +
+

+ build("{tempLow} to {tempHigh}{units}", [ + "tempLow" => round(Weather::convertDegCToUnits($day->tempLow, $tempunits), 1), + "tempHigh" => round(Weather::convertDegCToUnits($day->tempHigh, $tempunits), 1), + "units" => " $degreesymbol$tempunits" + ]); + ?> +

+

+ summary; ?> +

+
+
diff --git a/pages/weather.php b/pages/weather.php new file mode 100644 index 0000000..13986fb --- /dev/null +++ b/pages/weather.php @@ -0,0 +1,8 @@ +