From 25c813f5eb00d321d5096d2347363a2f58cb1c93 Mon Sep 17 00:00:00 2001 From: Patrick Seeger Date: Wed, 18 Apr 2012 21:34:43 +0200 Subject: Wetter eingebaut --- assets/19ae1ccf/clear_night.png | Bin 0 -> 838 bytes assets/19ae1ccf/cloudy.png | Bin 0 -> 710 bytes assets/19ae1ccf/cold.png | Bin 0 -> 511 bytes assets/19ae1ccf/drizzle.png | Bin 0 -> 753 bytes assets/19ae1ccf/dust.png | Bin 0 -> 1024 bytes assets/19ae1ccf/fog.png | Bin 0 -> 500 bytes assets/19ae1ccf/hail.png | Bin 0 -> 970 bytes assets/19ae1ccf/haze.png | Bin 0 -> 521 bytes assets/19ae1ccf/hot.png | Bin 0 -> 426 bytes assets/19ae1ccf/hurricane.png | Bin 0 -> 1102 bytes assets/19ae1ccf/icy.png | Bin 0 -> 420 bytes assets/19ae1ccf/mist.png | Bin 0 -> 488 bytes assets/19ae1ccf/overcast.png | Bin 0 -> 803 bytes assets/19ae1ccf/partly_cloudy_day.png | Bin 0 -> 970 bytes assets/19ae1ccf/partly_cloudy_night.png | Bin 0 -> 981 bytes assets/19ae1ccf/rain.png | Bin 0 -> 1115 bytes assets/19ae1ccf/rain_heavy.png | Bin 0 -> 1200 bytes assets/19ae1ccf/rain_light.png | Bin 0 -> 921 bytes assets/19ae1ccf/showers.png | Bin 0 -> 1171 bytes assets/19ae1ccf/showers_heavy.png | Bin 0 -> 1277 bytes assets/19ae1ccf/sleet.png | Bin 0 -> 1103 bytes assets/19ae1ccf/smoke.png | Bin 0 -> 627 bytes assets/19ae1ccf/snow.png | Bin 0 -> 881 bytes assets/19ae1ccf/snow_heavy.png | Bin 0 -> 957 bytes assets/19ae1ccf/snow_showers.png | Bin 0 -> 1164 bytes assets/19ae1ccf/storm.png | Bin 0 -> 1430 bytes assets/19ae1ccf/sunny.png | Bin 0 -> 936 bytes assets/19ae1ccf/symbols.pspimage | Bin 0 -> 19565 bytes assets/19ae1ccf/thunder_showers.png | Bin 0 -> 1557 bytes assets/19ae1ccf/thunderstorm.png | Bin 0 -> 1123 bytes assets/19ae1ccf/thunderstorm_severe.png | Bin 0 -> 1231 bytes assets/19ae1ccf/tornado.png | Bin 0 -> 1105 bytes assets/19ae1ccf/windy.png | Bin 0 -> 599 bytes assets/85ebad3e/weather_forecast.css | 33 ++++++++++++++ protected/config/main.php | 4 ++ protected/extensions/wetter/Wetter.php | 65 +++++++++++++++++++++++++++ protected/extensions/wetter/views/wetter.php | 21 +++++++++ themes/astaf/views/layouts/main.php | 9 ++-- 38 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 assets/19ae1ccf/clear_night.png create mode 100644 assets/19ae1ccf/cloudy.png create mode 100644 assets/19ae1ccf/cold.png create mode 100644 assets/19ae1ccf/drizzle.png create mode 100644 assets/19ae1ccf/dust.png create mode 100644 assets/19ae1ccf/fog.png create mode 100644 assets/19ae1ccf/hail.png create mode 100644 assets/19ae1ccf/haze.png create mode 100644 assets/19ae1ccf/hot.png create mode 100644 assets/19ae1ccf/hurricane.png create mode 100644 assets/19ae1ccf/icy.png create mode 100644 assets/19ae1ccf/mist.png create mode 100644 assets/19ae1ccf/overcast.png create mode 100644 assets/19ae1ccf/partly_cloudy_day.png create mode 100644 assets/19ae1ccf/partly_cloudy_night.png create mode 100644 assets/19ae1ccf/rain.png create mode 100644 assets/19ae1ccf/rain_heavy.png create mode 100644 assets/19ae1ccf/rain_light.png create mode 100644 assets/19ae1ccf/showers.png create mode 100644 assets/19ae1ccf/showers_heavy.png create mode 100644 assets/19ae1ccf/sleet.png create mode 100644 assets/19ae1ccf/smoke.png create mode 100644 assets/19ae1ccf/snow.png create mode 100644 assets/19ae1ccf/snow_heavy.png create mode 100644 assets/19ae1ccf/snow_showers.png create mode 100644 assets/19ae1ccf/storm.png create mode 100644 assets/19ae1ccf/sunny.png create mode 100644 assets/19ae1ccf/symbols.pspimage create mode 100644 assets/19ae1ccf/thunder_showers.png create mode 100644 assets/19ae1ccf/thunderstorm.png create mode 100644 assets/19ae1ccf/thunderstorm_severe.png create mode 100644 assets/19ae1ccf/tornado.png create mode 100644 assets/19ae1ccf/windy.png create mode 100644 assets/85ebad3e/weather_forecast.css create mode 100644 protected/extensions/wetter/Wetter.php create mode 100644 protected/extensions/wetter/views/wetter.php diff --git a/assets/19ae1ccf/clear_night.png b/assets/19ae1ccf/clear_night.png new file mode 100644 index 0000000..dfeab51 Binary files /dev/null and b/assets/19ae1ccf/clear_night.png differ diff --git a/assets/19ae1ccf/cloudy.png b/assets/19ae1ccf/cloudy.png new file mode 100644 index 0000000..c4be984 Binary files /dev/null and b/assets/19ae1ccf/cloudy.png differ diff --git a/assets/19ae1ccf/cold.png b/assets/19ae1ccf/cold.png new file mode 100644 index 0000000..478be3d Binary files /dev/null and b/assets/19ae1ccf/cold.png differ diff --git a/assets/19ae1ccf/drizzle.png b/assets/19ae1ccf/drizzle.png new file mode 100644 index 0000000..0fbd481 Binary files /dev/null and b/assets/19ae1ccf/drizzle.png differ diff --git a/assets/19ae1ccf/dust.png b/assets/19ae1ccf/dust.png new file mode 100644 index 0000000..7c29271 Binary files /dev/null and b/assets/19ae1ccf/dust.png differ diff --git a/assets/19ae1ccf/fog.png b/assets/19ae1ccf/fog.png new file mode 100644 index 0000000..aa739a3 Binary files /dev/null and b/assets/19ae1ccf/fog.png differ diff --git a/assets/19ae1ccf/hail.png b/assets/19ae1ccf/hail.png new file mode 100644 index 0000000..a5f3d72 Binary files /dev/null and b/assets/19ae1ccf/hail.png differ diff --git a/assets/19ae1ccf/haze.png b/assets/19ae1ccf/haze.png new file mode 100644 index 0000000..0fa9ae4 Binary files /dev/null and b/assets/19ae1ccf/haze.png differ diff --git a/assets/19ae1ccf/hot.png b/assets/19ae1ccf/hot.png new file mode 100644 index 0000000..6aa9af5 Binary files /dev/null and b/assets/19ae1ccf/hot.png differ diff --git a/assets/19ae1ccf/hurricane.png b/assets/19ae1ccf/hurricane.png new file mode 100644 index 0000000..daf35ec Binary files /dev/null and b/assets/19ae1ccf/hurricane.png differ diff --git a/assets/19ae1ccf/icy.png b/assets/19ae1ccf/icy.png new file mode 100644 index 0000000..dafae6c Binary files /dev/null and b/assets/19ae1ccf/icy.png differ diff --git a/assets/19ae1ccf/mist.png b/assets/19ae1ccf/mist.png new file mode 100644 index 0000000..991a88e Binary files /dev/null and b/assets/19ae1ccf/mist.png differ diff --git a/assets/19ae1ccf/overcast.png b/assets/19ae1ccf/overcast.png new file mode 100644 index 0000000..4281a5b Binary files /dev/null and b/assets/19ae1ccf/overcast.png differ diff --git a/assets/19ae1ccf/partly_cloudy_day.png b/assets/19ae1ccf/partly_cloudy_day.png new file mode 100644 index 0000000..b7ad9b1 Binary files /dev/null and b/assets/19ae1ccf/partly_cloudy_day.png differ diff --git a/assets/19ae1ccf/partly_cloudy_night.png b/assets/19ae1ccf/partly_cloudy_night.png new file mode 100644 index 0000000..f16e838 Binary files /dev/null and b/assets/19ae1ccf/partly_cloudy_night.png differ diff --git a/assets/19ae1ccf/rain.png b/assets/19ae1ccf/rain.png new file mode 100644 index 0000000..6ec85d3 Binary files /dev/null and b/assets/19ae1ccf/rain.png differ diff --git a/assets/19ae1ccf/rain_heavy.png b/assets/19ae1ccf/rain_heavy.png new file mode 100644 index 0000000..a935258 Binary files /dev/null and b/assets/19ae1ccf/rain_heavy.png differ diff --git a/assets/19ae1ccf/rain_light.png b/assets/19ae1ccf/rain_light.png new file mode 100644 index 0000000..80f200b Binary files /dev/null and b/assets/19ae1ccf/rain_light.png differ diff --git a/assets/19ae1ccf/showers.png b/assets/19ae1ccf/showers.png new file mode 100644 index 0000000..7584166 Binary files /dev/null and b/assets/19ae1ccf/showers.png differ diff --git a/assets/19ae1ccf/showers_heavy.png b/assets/19ae1ccf/showers_heavy.png new file mode 100644 index 0000000..411f729 Binary files /dev/null and b/assets/19ae1ccf/showers_heavy.png differ diff --git a/assets/19ae1ccf/sleet.png b/assets/19ae1ccf/sleet.png new file mode 100644 index 0000000..529101b Binary files /dev/null and b/assets/19ae1ccf/sleet.png differ diff --git a/assets/19ae1ccf/smoke.png b/assets/19ae1ccf/smoke.png new file mode 100644 index 0000000..623432b Binary files /dev/null and b/assets/19ae1ccf/smoke.png differ diff --git a/assets/19ae1ccf/snow.png b/assets/19ae1ccf/snow.png new file mode 100644 index 0000000..1a20be0 Binary files /dev/null and b/assets/19ae1ccf/snow.png differ diff --git a/assets/19ae1ccf/snow_heavy.png b/assets/19ae1ccf/snow_heavy.png new file mode 100644 index 0000000..ac6d9f3 Binary files /dev/null and b/assets/19ae1ccf/snow_heavy.png differ diff --git a/assets/19ae1ccf/snow_showers.png b/assets/19ae1ccf/snow_showers.png new file mode 100644 index 0000000..504d988 Binary files /dev/null and b/assets/19ae1ccf/snow_showers.png differ diff --git a/assets/19ae1ccf/storm.png b/assets/19ae1ccf/storm.png new file mode 100644 index 0000000..445ac64 Binary files /dev/null and b/assets/19ae1ccf/storm.png differ diff --git a/assets/19ae1ccf/sunny.png b/assets/19ae1ccf/sunny.png new file mode 100644 index 0000000..68b9fcf Binary files /dev/null and b/assets/19ae1ccf/sunny.png differ diff --git a/assets/19ae1ccf/symbols.pspimage b/assets/19ae1ccf/symbols.pspimage new file mode 100644 index 0000000..dacc401 Binary files /dev/null and b/assets/19ae1ccf/symbols.pspimage differ diff --git a/assets/19ae1ccf/thunder_showers.png b/assets/19ae1ccf/thunder_showers.png new file mode 100644 index 0000000..974c833 Binary files /dev/null and b/assets/19ae1ccf/thunder_showers.png differ diff --git a/assets/19ae1ccf/thunderstorm.png b/assets/19ae1ccf/thunderstorm.png new file mode 100644 index 0000000..3f19ad5 Binary files /dev/null and b/assets/19ae1ccf/thunderstorm.png differ diff --git a/assets/19ae1ccf/thunderstorm_severe.png b/assets/19ae1ccf/thunderstorm_severe.png new file mode 100644 index 0000000..7df3597 Binary files /dev/null and b/assets/19ae1ccf/thunderstorm_severe.png differ diff --git a/assets/19ae1ccf/tornado.png b/assets/19ae1ccf/tornado.png new file mode 100644 index 0000000..7d35015 Binary files /dev/null and b/assets/19ae1ccf/tornado.png differ diff --git a/assets/19ae1ccf/windy.png b/assets/19ae1ccf/windy.png new file mode 100644 index 0000000..bd9ea54 Binary files /dev/null and b/assets/19ae1ccf/windy.png differ diff --git a/assets/85ebad3e/weather_forecast.css b/assets/85ebad3e/weather_forecast.css new file mode 100644 index 0000000..adefaad --- /dev/null +++ b/assets/85ebad3e/weather_forecast.css @@ -0,0 +1,33 @@ +/* SVN FILE: $Id: weather_forecast.css 9 2009-10-13 13:20:24Z Chris $ */ +/** + * Weather Forecast CSS + * + * @copyright Copyright 2009 PBM Web Development - All Rights Reserved + * @package weatherForecast + * @since V1.0.0 + * @version $Revision: 9 $ + * @modifiedby $LastChangedBy: Chris $ + * @lastmodified $Date: 2009-10-13 14:20:24 +0100 (Tue, 13 Oct 2009) $ + * @license http://www.opensource.org/licenses/bsd-license.php The BSD License + */ +.weather-forecast { + float: left; + font-size: 90%; + margin-right: 0; + margin-top: 1em; + padding: 1em 1.5%; + width: 28%; +} +.weather-forecast th, +.weather-forecast td { + padding: 0.375em 5px; + text-align: center; +} +.weather-forecast tfoot tr, +.weather-forecast tr.even { + background-color: transparent; +} +.weather-forecast tfoot { + font-size: 80%; + font-style: italic; +} \ No newline at end of file diff --git a/protected/config/main.php b/protected/config/main.php index ca66538..e9c97aa 100644 --- a/protected/config/main.php +++ b/protected/config/main.php @@ -18,6 +18,7 @@ return array( 'application.models.*', 'application.components.*', 'application.extensions.ddeditor.*', + 'application.extensions.wetter.*', ), 'modules'=>array( @@ -38,6 +39,9 @@ return array( // enable cookie-based authentication 'allowAutoLogin'=>true, ), + 'cache' => array( + 'class' => 'system.caching.CDummyCache', + ), // uncomment the following to enable URLs in path-format /* 'urlManager'=>array( diff --git a/protected/extensions/wetter/Wetter.php b/protected/extensions/wetter/Wetter.php new file mode 100644 index 0000000..de2ec93 --- /dev/null +++ b/protected/extensions/wetter/Wetter.php @@ -0,0 +1,65 @@ +website_wetter('71332','Germany'); + $this->render('wetter', compact('wetter')); + } + + /* + Nutzung dieses Scripts nur gestattet, wenn Kommentare in PHP nicht entfernt werden oder ein Link zu folgender Adresse gesetzt wird: + URL: http://www.web-spirit.de/webdesign-tutorial/9/Wetter-auf-eigener-Website-mit-Google-Weahter-API + Beschreibung: Wettervorhersage auf der eigenen Website mit Zugriff auf die Google Weather API + Autor: Sebastian Gollus + Internet: http://www.web-spirit.de + Version: 1.0.201106 + */ + + // Funktionsaufruf z.B.: $wetter = website_wetter("46562", "Germany", "/images/wetter/icons/", "de"); + + private function website_wetter($plz, $land, $icons_src="/", $sprache="de", $ort="") + { + $icons_google = "/ig/images/weather/"; //alte Google-Version + //$icons_google = "http://g0.gstatic.com/images/icons/onebox/"; //neue Google-Version (bzw. zwischenzeitlich geändert) + + if($ort != "") + { + $station = $ort; + } + else + { + $station = $plz."-".$land; + } + + $api = simplexml_load_string(utf8_encode(file_get_contents("http://www.google.com/ig/api?weather=".$station."&hl=".$sprache))); + + $wetter = array(); + + // Allgemeine Informationen + $wetter['stadt'] = $api->weather->forecast_information->city->attributes()->data; + $wetter['datum'] = $api->weather->forecast_information->forecast_date->attributes()->data; + $wetter['zeit'] = $api->weather->forecast_information->current_date_time->attributes()->data; + + // Aktuelles Wetter + $wetter[0]['zustand'] = $api->weather->current_conditions->condition->attributes()->data; + $wetter[0]['temperatur'] = $api->weather->current_conditions->temp_c->attributes()->data; + $wetter[0]['luftfeuchtigkeit'] = $api->weather->current_conditions->humidity->attributes()->data; + $wetter[0]['wind'] = $api->weather->current_conditions->wind_condition->attributes()->data; + $wetter[0]['icon'] = str_replace($icons_google, $icons_src, $api->weather->current_conditions->icon->attributes()->data); + + // Wettervorhersage heute, morgen, in zwei und in drei Tagen ($wetter[1] bis $wetter[4]) + $i = 1; + foreach($api->weather->forecast_conditions as $weather) + { + $wetter[$i]['wochentag'] = $weather->day_of_week->attributes()->data; + $wetter[$i]['zustand'] = $weather->condition->attributes()->data; + $wetter[$i]['tiefsttemperatur'] = $weather->low->attributes()->data; + $wetter[$i]['hoechsttemperatur'] = $weather->high->attributes()->data; + $wetter[$i]['icon'] = str_replace($icons_google, $icons_src, $weather->icon->attributes()->data); + + $i++; + } + + return $wetter; + } +} \ No newline at end of file diff --git a/protected/extensions/wetter/views/wetter.php b/protected/extensions/wetter/views/wetter.php new file mode 100644 index 0000000..0b4c831 --- /dev/null +++ b/protected/extensions/wetter/views/wetter.php @@ -0,0 +1,21 @@ +
+
+
+ + +
Aktuell
+

".$wetter[0]['zustand']." bei ".$wetter[0]['temperatur']."° C"; ?>

+
+
+
+
+ +
+

".$wetter[2]['zustand']." bei min. ".$wetter[2]['tiefsttemperatur']."° C bis max. ".$wetter[2]['hoechsttemperatur']."° C"; ?>

+
+
+
+ + + + diff --git a/themes/astaf/views/layouts/main.php b/themes/astaf/views/layouts/main.php index 4615b50..a9d3614 100644 --- a/themes/astaf/views/layouts/main.php +++ b/themes/astaf/views/layouts/main.php @@ -127,10 +127,13 @@