diff --git a/pages/home.php b/pages/home.php index 4836775..5ff7409 100644 --- a/pages/home.php +++ b/pages/home.php @@ -5,9 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//$weatherclass = "Weather_" . $SETTINGS['sources']['weather']; -//$weather = new $weatherclass(46.595806, -112.027031); // TODO: get user location -$weather = new Weather_DarkSky(46.595806, -112.027031); +$weatherclass = "Weather_" . $SETTINGS['sources']['weather']; +$weather = new $weatherclass(46.595, -112.027); // TODO: get user location $weather->loadForecast(); $tempunits = "C"; diff --git a/pages/weather.php b/pages/weather.php index 13986fb..43fdcc8 100644 --- a/pages/weather.php +++ b/pages/weather.php @@ -1,8 +1,119 @@ loadForecast(); + +$tempunits = "C"; +$degreesymbol = "°"; +if (!empty($_COOKIE['TemperatureUnitsPref']) && preg_match("/[FCK]/", $_COOKIE['TemperatureUnitsPref'])) { + $tempunits = $_COOKIE['TemperatureUnitsPref']; + // No degree symbol for Kelvins + if ($tempunits == "K") { + $degreesymbol = ""; + } +} +?> +
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; + ?> +
++ 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; ?> +
+