From aa0e3c364f515adf60e17f10ceea9f7b6e6a3777 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Thu, 17 Mar 2016 20:43:51 +0100 Subject: [PATCH] Inserito meteo --- private/common/config.php | 2 ++ private/crontab/core.hourly.php | 2 +- private/lib/gui/HTMLHelper.php | 34 +++++++++++++++++++++++ private/lib/task/UpdateMeteoCacheTask.php | 26 +++++++++++++++++ private/lib/task/lib.inclusion.php | 2 ++ public/admin/editConfig.php | 3 +- public/index.php | 3 +- public/style/public.css | 15 ++++++++-- 8 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 private/lib/task/UpdateMeteoCacheTask.php diff --git a/private/common/config.php b/private/common/config.php index 44b7537..919076b 100644 --- a/private/common/config.php +++ b/private/common/config.php @@ -69,6 +69,8 @@ $config->files->gui_log = $config->paths->log . "/gui.log"; $config->files->mail_log = $config->paths->log . "/mail.log"; $config->files->api_log = $config->paths->log . "/api.log"; +$config->files->meteoCache = $config->paths->tmp . "/meteo.json"; + // Pages $config->pages = new StdClass(); $config->pages->remoteLocationPath = $currentSystem->remoteLocationPath; diff --git a/private/crontab/core.hourly.php b/private/crontab/core.hourly.php index f283a68..8c259c5 100644 --- a/private/crontab/core.hourly.php +++ b/private/crontab/core.hourly.php @@ -2,7 +2,7 @@ 0){ foreach ($tasks as $taskName){ diff --git a/private/lib/gui/HTMLHelper.php b/private/lib/gui/HTMLHelper.php index e965a8b..88f9c1c 100644 --- a/private/lib/gui/HTMLHelper.php +++ b/private/lib/gui/HTMLHelper.php @@ -33,6 +33,40 @@ class HTMLHelper { echo ''; } + + public static function getMeteoBlock(){ + $config = GlobalVariables::get("config"); + $cont = file_get_contents($config->files->meteoCache); + $json = json_decode($cont); + + $todayImgUrl = " http://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png"; + $todayTemp = $json->list[0]->main->temp; + $todayMax = $json->list[0]->main->temp_max; + $todayMin = $json->list[0]->main->temp_min; + + $tomorrowImgUrl = " http://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png"; + $tomorrowTemp = $json->list[1]->main->temp; + $tomorrowMax = $json->list[1]->main->temp_max; + $tomorrowMin = $json->list[1]->main->temp_min; + + + ?> +
Meteo Napoli
+
+
+
Oggi
+
°
+
Max: °
+
Min: °
+
+
Domani
+
°
+
Max: °
+
Min: °
+
+
+ \ No newline at end of file diff --git a/private/lib/task/UpdateMeteoCacheTask.php b/private/lib/task/UpdateMeteoCacheTask.php new file mode 100644 index 0000000..b08ad0f --- /dev/null +++ b/private/lib/task/UpdateMeteoCacheTask.php @@ -0,0 +1,26 @@ +files->meteoCache, $cont); + } +} + +?> \ No newline at end of file diff --git a/private/lib/task/lib.inclusion.php b/private/lib/task/lib.inclusion.php index 8d9157b..d2862ae 100644 --- a/private/lib/task/lib.inclusion.php +++ b/private/lib/task/lib.inclusion.php @@ -19,4 +19,6 @@ require_once(dirname(__FILE__)."/GenerateAdminPasswordRecoveryMailTask.php"); require_once(dirname(__FILE__)."/DeleteOldPasswordResetRequestsTask.php"); require_once(dirname(__FILE__)."/GenerateUserActivationMailTask.php"); + +require_once(dirname(__FILE__)."/UpdateMeteoCacheTask.php"); ?> \ No newline at end of file diff --git a/public/admin/editConfig.php b/public/admin/editConfig.php index a4242d4..bcc3bf9 100644 --- a/public/admin/editConfig.php +++ b/public/admin/editConfig.php @@ -28,7 +28,8 @@ $taskList = array( "GenerateUserPasswordRecoveryMailTask", "GenerateAdminPasswordRecoveryMailTask", "DeleteOldPasswordResetRequestsTask", - "GenerateUserActivationMailTask" + "GenerateUserActivationMailTask", + "UpdateMeteoCacheTask" ); $saved = false; diff --git a/public/index.php b/public/index.php index 48cf1a5..2eca135 100644 --- a/public/index.php +++ b/public/index.php @@ -277,7 +277,8 @@ catch (Exception $ex){
-
+ +
diff --git a/public/style/public.css b/public/style/public.css index 2233c00..b758107 100644 --- a/public/style/public.css +++ b/public/style/public.css @@ -261,9 +261,18 @@ display: inline-block; .ristorantiTitle{margin-top:10px;} -.rightBarNews{display:inline-block;width:230px;height:1380px;vertical-align:top;margin-top:20px;} -.meteo{max-height:165px;max-width:220px;} -.meteo > img{max-width:220px;max-height:165px;} +.rightBarNews{display:inline-block;width:230px;height:1380px;vertical-align:top;padding-top: 10px;} + +.meteoTitle{font-size: 15px;font-weight: bold;border-bottom: 3px solid #339CD5;margin-bottom: 7px;text-align:center;} +.meteo{max-height: 165px;max-width: 220px;text-align: center;border-bottom: 1px dotted #C1B4B4;padding-bottom: 10px;margin-bottom: 10px;} +.meteo > div{display:inline-block; width:49%;} +.meteo .today{border-right:1px dotted rgb(221, 221, 221);} +.meteo .image{text-align:center;} +.meteo .image *{vertical-align:middle;} +.meteo div{font-size:10pt;} +.meteo .day{font-size:11pt;text-align:center; font-weight:bold;} +.meteo div span{font-weight:bold;} + .middleRightBanner{width: 220px;overflow: hidden;height: 165px;margin: 5px 0;} .middleRightBanner > img{max-width:220px; max-heigth:200px;}