Add weather widget with OpenWeatherMap integration
Implementiert vollständiges Wetter-Widget oberhalb des Webcam-Videos: **Features:** 🌤️ **Wetter-Anzeige:** - Temperatur (°C) - Windgeschwindigkeit & Richtung (km/h) - Luftdruck (hPa) - Luftfeuchtigkeit (%) - Wetterbeschreibung mit Emoji-Icons - Niederschlag (Regen/Schnee) wenn vorhanden ⚙️ **Technisch:** - OpenWeatherMap API Integration - 5 Minuten Cache (konfigurierbar) - Auto-Update alle X Minuten (Frontend) - WeatherManager Klasse für Backend - Schönes Gradient-Design mit Hover-Effekten - Responsive für Mobile 🎛️ **Admin-Settings:** - Wetter-Widget ein/aus - API Key Eingabefeld + Registrierungs-Link - Standort konfigurierbar (Stadt,Land) - GPS-Koordinaten (Lat/Lon) - Update-Intervall (5-60 Minuten) - Einheiten (Metrisch/Imperial) **Dateien:** - WeatherManager.php: Neue Klasse für API-Calls & Caching - SettingsManager.php: Weather Settings Defaults & Helper - index.php: Widget HTML, CSS, JavaScript Auto-Update - settings.json: Weather Defaults initialisiert **Koordinaten Oberdürnten:** Lat: 47.2833, Lon: 8.7167 **Setup für User:** 1. Gratis Account auf openweathermap.org erstellen 2. API Key im Admin-Panel einfügen 3. Fertig! Widget zeigt Live-Wetter an
This commit is contained in:
@@ -73,6 +73,16 @@ class SettingsManager {
|
||||
'meta_description' => '',
|
||||
'meta_keywords' => ''
|
||||
],
|
||||
// Weather Widget
|
||||
'weather' => [
|
||||
'enabled' => true,
|
||||
'api_key' => '',
|
||||
'location' => 'Oberdürnten,CH',
|
||||
'lat' => '47.2833',
|
||||
'lon' => '8.7167',
|
||||
'update_interval' => 5, // Minuten
|
||||
'units' => 'metric' // metric (Celsius) oder imperial (Fahrenheit)
|
||||
],
|
||||
'last_updated' => null,
|
||||
'updated_by' => null
|
||||
];
|
||||
@@ -239,4 +249,32 @@ class SettingsManager {
|
||||
public function getMetaKeywords() {
|
||||
return $this->get('seo.meta_keywords') ?? '';
|
||||
}
|
||||
|
||||
// Weather Helper
|
||||
public function isWeatherEnabled() {
|
||||
return $this->get('weather.enabled') === true;
|
||||
}
|
||||
|
||||
public function getWeatherApiKey() {
|
||||
return $this->get('weather.api_key') ?? '';
|
||||
}
|
||||
|
||||
public function getWeatherLocation() {
|
||||
return $this->get('weather.location') ?? 'Oberdürnten,CH';
|
||||
}
|
||||
|
||||
public function getWeatherCoords() {
|
||||
return [
|
||||
'lat' => $this->get('weather.lat') ?? '47.2833',
|
||||
'lon' => $this->get('weather.lon') ?? '8.7167'
|
||||
];
|
||||
}
|
||||
|
||||
public function getWeatherUpdateInterval() {
|
||||
return $this->get('weather.update_interval') ?? 5;
|
||||
}
|
||||
|
||||
public function getWeatherUnits() {
|
||||
return $this->get('weather.units') ?? 'metric';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user