Сергей Варламов
9 years ago
commit
6d3ec3e7f7
19 changed files with 1994 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||||||
|
## weather |
||||||
|
|
||||||
|
# Модуль Погода |
||||||
|
|
||||||
|
|
||||||
|
## Модуль Погода использует <a href="http://openweathermap.org">Openweathermap.org</a> или<a href="http://developer.yahoo.com/weather/">Yahoo Weather API</a> для получения данных о погоде на текущий день и прогноза на ближайшие дни для любой точки мира. Используя самый надежный источник информации о погоде Вы можете обогатить веб-сайт собственным каналом погоды, который можете оформить по своему усмотрению." |
||||||
|
|
||||||
|
* Перевод отображения погодных явлений корректируется по собственному "вкусу" в файле ru.php |
||||||
|
|
||||||
|
|
||||||
|
## Перед копированием модуля в папку modules, удалите файл README.md, копируйте только корневую папку sitemap со всем ее содержимым внутри! |
||||||
|
|
||||||
|
## Changelog: |
||||||
|
|
||||||
|
07.05.2016 - версии 1.01 |
@ -0,0 +1,527 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
/** |
||||||
|
* AVE.cms - module Weather |
||||||
|
* |
||||||
|
* @package AVE.cms |
||||||
|
* @author N.Popova, npop@abv.bg |
||||||
|
* @subpackage mod_weather |
||||||
|
* @filesource |
||||||
|
*/ |
||||||
|
class Weather |
||||||
|
{ |
||||||
|
|
||||||
|
var $error = ''; |
||||||
|
|
||||||
|
var $config = array( |
||||||
|
'module_unique_id' => 1, |
||||||
|
'location' => 'Varna', //city, region |
||||||
|
'country' => 'Bulgaria', //country |
||||||
|
'WOEID' => '', |
||||||
|
'lat' => '', |
||||||
|
'lon' => '', |
||||||
|
'displayCityNameOnly' => false, |
||||||
|
'api' => 'openweathermap', //yahoo, openweathermap |
||||||
|
'apikey' => "", //api key for openweathermar, cliend ID for yahoo |
||||||
|
'secret_key' => "", //secret key for yahoo YQL |
||||||
|
'forecast' => '5', //number of days to forecast, max 5 |
||||||
|
'view' => "full", //options: simple, today, partial, forecast, full |
||||||
|
'render' => true, //render: false if you to make your own markup, true plugin generates markup |
||||||
|
'lang' => 'bg', |
||||||
|
'cacheTime' => 5, |
||||||
|
'units' => 'metric', // "imperial" default: "auto" |
||||||
|
'useCSS' => 1 |
||||||
|
); |
||||||
|
|
||||||
|
var $content = array(); |
||||||
|
|
||||||
|
var $_use_filelock = true; |
||||||
|
|
||||||
|
var $apiurls = array( |
||||||
|
"openweathermap" => array( "http://api.openweathermap.org/data/2.5/weather", "http://api.openweathermap.org/data/2.5/forecast/daily" ), |
||||||
|
"yahoo" => array( "http://query.yahooapis.com/v1/public/yql" ) |
||||||
|
); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Read cache file |
||||||
|
* |
||||||
|
* @return boolean |
||||||
|
*/ |
||||||
|
function _weatherCacheRead( $cache_filename ) |
||||||
|
{ |
||||||
|
if (!empty($cache_filename) |
||||||
|
&& is_file($cache_filename) |
||||||
|
&& filesize($cache_filename) > 0 |
||||||
|
&& ((filemtime($cache_filename) + $this->config['cacheTime'] * 60) > time())) |
||||||
|
{ |
||||||
|
$fp = @fopen($cache_filename, "rb"); |
||||||
|
if ($this->_use_filelock) @flock($fp, LOCK_SH); |
||||||
|
if ($fp) |
||||||
|
{ |
||||||
|
$cache_file_data = @fread($fp, filesize($cache_filename)); |
||||||
|
if ($this->_use_filelock) @flock($fp, LOCK_UN); |
||||||
|
@fclose($fp); |
||||||
|
|
||||||
|
return $cache_file_data; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Write cache file |
||||||
|
* |
||||||
|
* @return boolean |
||||||
|
*/ |
||||||
|
function _weatherCacheWrite( $cache_filename, $file_data ) |
||||||
|
{ |
||||||
|
if (! empty($cache_filename)) |
||||||
|
{ |
||||||
|
$fp = @fopen($cache_filename, "wb"); |
||||||
|
if ($fp) |
||||||
|
{ |
||||||
|
if ($this->_use_filelock) @flock($fp, LOCK_EX); |
||||||
|
@fwrite($fp, $file_data); |
||||||
|
if ($this->_use_filelock) @flock($fp, LOCK_UN); |
||||||
|
@fclose($fp); |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//Takes wind speed, direction in degrees and units |
||||||
|
//and returns a string ex. (8.5, 270, "metric") returns "W 8.5 km/h" |
||||||
|
function formatWind($speed, $degrees, $units) |
||||||
|
{ |
||||||
|
$wd = $degrees; |
||||||
|
if (($wd >= 0 && $wd <= 11.25) || ($wd > 348.75 && $wd <= 360)) { $wd = "N"; } |
||||||
|
else if ($wd > 11.25 && $wd <= 33.75){ $wd = "NNE"; } |
||||||
|
else if ($wd > 33.75 && $wd <= 56.25){ $wd = "NE"; } |
||||||
|
else if ($wd > 56.25 && $wd <= 78.75){ $wd = "ENE"; } |
||||||
|
else if ($wd > 78.75 && $wd <= 101.25){ $wd = "E"; } |
||||||
|
else if ($wd > 101.25 && $wd <= 123.75){ $wd = "ESE";} |
||||||
|
else if ($wd > 123.75 && $wd <= 146.25){ $wd = "SE"; } |
||||||
|
else if ($wd > 146.25 && $wd <= 168.75){ $wd = "SSE"; } |
||||||
|
else if ($wd > 168.75 && $wd <= 191.25){ $wd = "S"; } |
||||||
|
else if ($wd > 191.25 && $wd <= 213.75){ $wd = "SSW"; } |
||||||
|
else if ($wd > 213.75 && $wd <= 236.25){ $wd = "SW"; } |
||||||
|
else if ($wd > 236.25 && $wd <= 258.75){ $wd = "WSW"; } |
||||||
|
else if ($wd > 258.75 && $wd <= 281.25){ $wd = "W"; } |
||||||
|
else if ($wd > 281.25 && $wd <= 303.75){ $wd = "WNW"; } |
||||||
|
else if ($wd > 303.75 && $wd <= 326.25){ $wd = "NW"; } |
||||||
|
else if ($wd > 326.25 && $wd <= 348.75){ $wd = "NNW"; } |
||||||
|
|
||||||
|
$speedUnits = ($units == "metric")?"km/h":"mph"; |
||||||
|
return $wd + " " + $speed + " " + $speedUnits; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Init class |
||||||
|
* |
||||||
|
*/ |
||||||
|
function weatherInit() |
||||||
|
{ |
||||||
|
global $AVE_DB; |
||||||
|
|
||||||
|
//Load settings |
||||||
|
$row = $AVE_DB->Query(" |
||||||
|
SELECT * |
||||||
|
FROM " . PREFIX . "_module_weather |
||||||
|
WHERE Id = '1' |
||||||
|
LIMIT 1 |
||||||
|
")->FetchRow(); |
||||||
|
|
||||||
|
$this->config['location' ] = $row->location; |
||||||
|
$this->config['country' ] = $row->country; |
||||||
|
$this->config['WOEID' ] = $row->WOEID; |
||||||
|
$this->config['lat' ] = $row->lat; |
||||||
|
$this->config['lon' ] = $row->lon; |
||||||
|
$this->config['displayCityNameOnly' ] = $row->displayCityNameOnly; |
||||||
|
$this->config['api' ] = $row->api; |
||||||
|
$this->config['apikey' ] = $row->apikey; |
||||||
|
$this->config['secret_key' ] = $row->secret_key; |
||||||
|
$this->config['forecast' ] = $row->forecast; |
||||||
|
$this->config['view' ] = $row->view; |
||||||
|
$this->config['render' ] = $row->render; |
||||||
|
$this->config['lang' ] = $row->lang; |
||||||
|
$this->config['cacheTime' ] = $row->cacheTime; |
||||||
|
$this->config['units' ] = $row->units; |
||||||
|
$this->config['useCSS' ] = $row->useCSS; |
||||||
|
|
||||||
|
} // init() |
||||||
|
|
||||||
|
function ShowWeather($tpl_dir, $lang_file) { |
||||||
|
global $AVE_DB, $AVE_Template; |
||||||
|
|
||||||
|
$AVE_Template->config_load($lang_file); |
||||||
|
//Load settings |
||||||
|
$this->weatherInit(); |
||||||
|
$this->weatherDataGet(); |
||||||
|
|
||||||
|
if ($this->error === '') |
||||||
|
{ |
||||||
|
|
||||||
|
$weather = $this->datamapper($this->content); |
||||||
|
$degrees = $this->config['units'] == "metric"?"°C":"°F"; |
||||||
|
$format_wind = $this->formatWind( $weather['today']['wind']['speed'], $weather['today']['wind']['deg'], $this->config['units']); |
||||||
|
|
||||||
|
$AVE_Template->assign('config', $this->config); |
||||||
|
$AVE_Template->assign('weather', $weather ); |
||||||
|
$AVE_Template->assign('degrees', $degrees); |
||||||
|
$AVE_Template->assign('format_wind', $format_wind); |
||||||
|
|
||||||
|
$AVE_Template->display($tpl_dir . 'weather.tpl'); |
||||||
|
} else { |
||||||
|
// открити грешки |
||||||
|
//reportlog('открити грешки'); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Get weather data JSON |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
function weatherDataGet( ) |
||||||
|
{ |
||||||
|
|
||||||
|
if ($this->config['cacheTime'] > 0) |
||||||
|
{ |
||||||
|
// using cache |
||||||
|
|
||||||
|
if ($this->config['api'] == 'openweathermap' ) |
||||||
|
{ |
||||||
|
$cache_weather = $this->_weatherCacheRead(BASE_DIR . '/cache/module_weather_' . md5($this->config['city'] . $this->config['language']) . '.json'); |
||||||
|
$cache_forecast = $this->_weatherCacheRead(BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json'); |
||||||
|
if ( ($cache_weather !="") and ($cache_forecast !="") ) { |
||||||
|
$this->content = array(); |
||||||
|
$this->content[] = json_decode( $cache_weather, true ); |
||||||
|
$this->content[] = json_decode( $cache_forecast, true ); |
||||||
|
return; |
||||||
|
} |
||||||
|
} else if ($this->config['api'] == 'yahoo') { |
||||||
|
$cache_weather = $this->_weatherCacheRead(BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json'); |
||||||
|
if ($cache_weather !="") { |
||||||
|
$this->content = array(); |
||||||
|
$this->content[] = json_decode( $cache_weather, true ); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if(function_exists('curl_init')) |
||||||
|
{ |
||||||
|
|
||||||
|
if ($this->config['api'] == 'openweathermap' ) |
||||||
|
{ |
||||||
|
$this->content = array(); |
||||||
|
$curl = curl_init(); // initializing connection |
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 0); |
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // saves us before putting directly results of request |
||||||
|
// check the source of request |
||||||
|
curl_setopt($curl, CURLOPT_URL, $this->apiurls["openweathermap"][0]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']); // url to get |
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds |
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent |
||||||
|
|
||||||
|
$temp_data = curl_exec($curl); |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
|
||||||
|
$this->content[] = json_decode( $temp_data, true ); // reading content |
||||||
|
curl_close($curl); // closing connection |
||||||
|
|
||||||
|
$curl = curl_init(); // initializing connection |
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 0); |
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // saves us before putting directly results of request |
||||||
|
curl_setopt($curl, CURLOPT_URL, $this->apiurls["openweathermap"][1]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']); // url to get |
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds |
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent |
||||||
|
|
||||||
|
$temp_data = curl_exec($curl); |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
|
||||||
|
$this->content[] = json_decode( $temp_data, true ); // reading content |
||||||
|
curl_close($curl); // closing connection |
||||||
|
|
||||||
|
} else if ($this->config['api'] == 'yahoo') { |
||||||
|
// Yahoo YQL |
||||||
|
$this->content = array(); |
||||||
|
$curl = curl_init(); // initializing connection |
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 0); |
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); // saves us before putting directly results of request |
||||||
|
|
||||||
|
$yunit = ($this->config['units'] == "metric")?"c":"f"; |
||||||
|
$yql_query = 'select * from weather.forecast where woeid="'.$this->config['WOEID'].'" AND u="'. $yunit .'"'; |
||||||
|
|
||||||
|
curl_setopt( $curl, CURLOPT_URL, $this->apiurls["yahoo"][0]."?q=" . urlencode($yql_query).'&format=json&env="store://datatables.org/alltableswithkeys"' ) ; // url to get |
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds |
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent |
||||||
|
|
||||||
|
|
||||||
|
$temp_data = curl_exec($curl); |
||||||
|
|
||||||
|
// if(($temp_data = curl_exec($curl)) === false){reportlog('Curl error: ' . curl_error($curl));} |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
|
||||||
|
$this->content[] = json_decode( $temp_data, true ); // reading content |
||||||
|
curl_close($curl); // closing connection |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
// check file_get_contents function enable and allow external url's' |
||||||
|
else if( file_get_contents(__FILE__) && ini_get('allow_url_fopen') && !function_exists('curl_init')) |
||||||
|
{ |
||||||
|
if ($this->config['api'] == 'openweathermap' ) |
||||||
|
{ |
||||||
|
$this->content = array(); |
||||||
|
$temp_data = json_decode( file_get_contents( $apiurls["openweathermap"][0]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']), true ); |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
$this->content[] = $temp_data; |
||||||
|
|
||||||
|
$temp_data = json_decode( file_get_contents( $apiurls["openweathermap"][1]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']), true ); |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
$this->content[] = $temp_data; |
||||||
|
|
||||||
|
} else if ($this->config['api'] == 'yahoo') { |
||||||
|
// Yahoo YQL |
||||||
|
$this->content = array(); |
||||||
|
$yunit = ($this->config['units'] == "metric")?"c":"f"; |
||||||
|
$yql_query = 'select * from weather.forecast where woeid="'.$this->config['WOEID'].'" AND u="'. $yunit .'"'; |
||||||
|
$temp_data = json_decode( file_get_contents( $this->apiurls["yahoo"][0]."?q=".urlencode($yql_query).'&format=json&env="store://datatables.org/alltableswithkeys"'), true ); |
||||||
|
if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); |
||||||
|
$this->content[] = $temp_data; |
||||||
|
} |
||||||
|
|
||||||
|
} else { |
||||||
|
$this->error = 'cURL extension and file_get_content method is not available on your server'; |
||||||
|
return; |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//note: input data is in an array of the returned api result request(s) in the same order as setup in the apiurls |
||||||
|
//All data manipulation and cleaning up happens below |
||||||
|
//making this was tedious. |
||||||
|
|
||||||
|
function datamapper($input) { |
||||||
|
|
||||||
|
|
||||||
|
if ($this->config['api'] == 'openweathermap' ) |
||||||
|
{ |
||||||
|
//data[0] is current weather, data[1] is forecast |
||||||
|
|
||||||
|
$out['location'] = $this->config['location'] + ", " + $this->config['country']; |
||||||
|
$out['city'] = $this->config['location']; |
||||||
|
|
||||||
|
$out['today'] = array(); |
||||||
|
$out['today']['temp'] = array(); |
||||||
|
$out['today']['temp']['now'] = round($input[0]['main']['temp']); |
||||||
|
|
||||||
|
$out['today']['temp']['min'] = round($input[1]['list'][0]['temp']['min']); |
||||||
|
$out['today']['temp']['max'] = round($input[1]['list'][0]['temp']['max']); |
||||||
|
|
||||||
|
$out['today']['desc'] = $input[0]['weather'][0]['description'] ; |
||||||
|
$out['today']['code'] = $input[0]['weather'][0]['id']; |
||||||
|
|
||||||
|
//no weather id code remapping needed, we will use this as our default weather code system |
||||||
|
//and convert all other codes to the openweathermap weather code format |
||||||
|
|
||||||
|
$out['today']['wind'] = $input[0]['wind']; |
||||||
|
$out['today']['humidity'] = $input[0]['main']['humidity']; |
||||||
|
$out['today']['pressure'] = $input[0]['main']['pressure']; |
||||||
|
$out['today']['sunrise'] = Date( 'H:i', $input[0]['sys']['sunrise']); |
||||||
|
$out['today']['sunset'] = Date( 'H:i', $input[0]['sys']['sunset']); |
||||||
|
|
||||||
|
$out['today']['day'] = $this->getDayString( Date('w') ) ; |
||||||
|
|
||||||
|
$out['forecast'] = array(); |
||||||
|
for ($i = 0; $i < $this->config['forecast']; $i++) { |
||||||
|
$forecast = array(); |
||||||
|
|
||||||
|
$forecast['day'] = $this->getDayString( Date( 'w' , $input[1]['list'][$i]['dt'] ) ); //api time is in unix epoch |
||||||
|
$forecast['code'] = $input[1]['list'][$i]['weather'][0]['id']; |
||||||
|
$forecast['desc'] = $input[1]['list'][$i]['weather'][0]['description']; |
||||||
|
$forecast['temp'] = array( 'max' => round($input[1]['list'][$i]['temp']['max']), 'min' => round($input[1]['list'][$i]['temp']['min']) ); |
||||||
|
$out['forecast'][] = $forecast; |
||||||
|
} |
||||||
|
|
||||||
|
return $out; |
||||||
|
|
||||||
|
} else if ($this->config['api'] == 'yahoo') { |
||||||
|
//key = yahoo code, value = standard code (based on openweathermap codes) |
||||||
|
$codes = array( |
||||||
|
0 => "900", //tornado |
||||||
|
1 => "901", //tropical storm |
||||||
|
2 => "902", //hurricane |
||||||
|
3 => "212", //severe thunderstorms |
||||||
|
4 => "200", //thunderstorms |
||||||
|
5 => "616", //mixed rain and snow |
||||||
|
6 => "612", //mixed rain and sleet |
||||||
|
7 => "611", //mixed snow and sleet |
||||||
|
8 => "511", //freezing drizzle |
||||||
|
9 => "301", //drizzle |
||||||
|
10 => "511", //freezing rain |
||||||
|
11 => "521", //showers |
||||||
|
12 => "521", //showers |
||||||
|
13 => "600", //snow flurries |
||||||
|
14 => "615", //light snow showers |
||||||
|
15 => "601", //blowing snow |
||||||
|
16 => "601", //snow |
||||||
|
17 => "906", //hail |
||||||
|
18 => "611", //sleet |
||||||
|
19 => "761", //dust |
||||||
|
20 => "741", //foggy |
||||||
|
21 => "721", //haze |
||||||
|
22 => "711", //smoky |
||||||
|
23 => "956", //blustery |
||||||
|
24 => "954", //windy |
||||||
|
25 => "903", //cold |
||||||
|
26 => "802", //cloudy |
||||||
|
27 => "802", //mostly cloudy (night) |
||||||
|
28 => "802", //mostly cloudy (day) |
||||||
|
29 => "802", //partly cloudy (night) |
||||||
|
30 => "802", //partly cloudy (day) |
||||||
|
31 => "800", //clear (night) |
||||||
|
32 => "800", //sunny |
||||||
|
33 => "951", //fair (night) |
||||||
|
34 => "951", //fair (day) |
||||||
|
35 => "906", //mixed rain and hail |
||||||
|
36 => "904", //hot |
||||||
|
37 => "210", //isolated thunderstorms |
||||||
|
38 => "210", //scattered thunderstorms |
||||||
|
39 => "210", //scattered thunderstorms |
||||||
|
40 => "521", //scattered showers |
||||||
|
41 => "602", //heavy snow |
||||||
|
42 => "621", //scattered snow showers |
||||||
|
43 => "602", //heavy snow |
||||||
|
44 => "802", //partly cloudy |
||||||
|
45 => "201", //thundershowers |
||||||
|
46 => "621", //snow showers |
||||||
|
47 => "210", //isolated thundershowers |
||||||
|
3200 => "951", //not available... alright... lets make that sunny. |
||||||
|
); |
||||||
|
|
||||||
|
include(BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".php"); |
||||||
|
|
||||||
|
$input = $input[0]['query']['results']['channel']; |
||||||
|
//reportlog(print_r($input)); |
||||||
|
$out['location'] = $this->config['location'] + ", " + $this->config['country']; |
||||||
|
$out['city'] = $this->config['location']; |
||||||
|
|
||||||
|
$out['today'] = array(); |
||||||
|
$out['today']['temp'] = array(); |
||||||
|
$out['today']['temp']['now'] = round($input['item']['condition']['temp']); |
||||||
|
|
||||||
|
$out['today']['temp']['min'] = round($input['item']['forecast'][0]['low']); |
||||||
|
$out['today']['temp']['max'] = round($input['item']['forecast'][0]['high']); |
||||||
|
|
||||||
|
$out['today']['desc'] = $conditions[$input['item']['condition']['code']]; |
||||||
|
$out['today']['code'] = $codes[$input['item']['condition']['code']]; //map weather code |
||||||
|
|
||||||
|
$out['today']['wind'] = array(); |
||||||
|
$out['today']['wind']['speed'] = $input['wind']['speed']; |
||||||
|
$out['today']['wind']['deg'] = $input['wind']['deg']; |
||||||
|
|
||||||
|
$out['today']['humidity'] = $input['atmosphere']['humidity']; |
||||||
|
$out['today']['pressure'] = $input['atmosphere']['pressure']; |
||||||
|
$out['today']['sunrise'] = $input['astronomy']['sunrise']; |
||||||
|
$out['today']['sunset'] = $input['astronomy']['sunset']; |
||||||
|
|
||||||
|
$out['today']['day'] = $this->getDayString( Date('w') ) ; |
||||||
|
|
||||||
|
|
||||||
|
$out['forecast'] = array(); |
||||||
|
for ($i = 0; $i < $this->config['forecast']; $i++) { |
||||||
|
$forecast = array(); |
||||||
|
// day |
||||||
|
if(isset($tdays[ (string)$input['item']['forecast'][$i]['day'] ] )){ |
||||||
|
$forecast['day'] = $tdays[ (string)$input['item']['forecast'][$i]['day'] ] ; |
||||||
|
} else { |
||||||
|
$forecast['day'] = (string)$input['item']['forecast'][$i]['day'] ; |
||||||
|
} |
||||||
|
// condition code |
||||||
|
$forecast['code'] = $codes[$input['item']['forecast'][$i]['code']]; //map weather code |
||||||
|
// condition text |
||||||
|
if(isset($conditions[ $input['item']['condition']['code'] ] )){ |
||||||
|
$forecast['desc'] = $conditions[ $input['item']['condition']['code'] ]; |
||||||
|
} else { |
||||||
|
$forecast['desc'] = $input['item']['forecast'][$i]['text']; |
||||||
|
} |
||||||
|
|
||||||
|
$forecast['temp'] = array( 'max' => round($input['item']['forecast'][$i]['high']), 'min' => round($input['item']['forecast'][$i]['low']) ); |
||||||
|
$out['forecast'][] = $forecast; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
return $out; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getDayString($day) { |
||||||
|
$days = array("Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък" , "Събота"); |
||||||
|
include(BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".php"); |
||||||
|
return $days[$day]; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Config module |
||||||
|
* @param string $tpl_dir |
||||||
|
* @param string $lang_file |
||||||
|
*/ |
||||||
|
|
||||||
|
function weatherSettingsEdit($tpl_dir, $lang_file) |
||||||
|
{ |
||||||
|
global $AVE_DB, $AVE_Template; |
||||||
|
|
||||||
|
if ( isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save' ) |
||||||
|
{ |
||||||
|
$AVE_DB->Query(" |
||||||
|
UPDATE " . PREFIX . "_module_weather |
||||||
|
SET |
||||||
|
location = '" . $_REQUEST['location'] . "', |
||||||
|
country = '" . $_REQUEST['country'] . "', |
||||||
|
WOEID = '" . $_REQUEST['WOEID'] . "', |
||||||
|
lat = '" . $_REQUEST['lat'] . "', |
||||||
|
lon = '" . $_REQUEST['lon'] . "', |
||||||
|
displayCityNameOnly = '" . $_REQUEST['displayCityNameOnly'] . "', |
||||||
|
api = '" . $_REQUEST['api'] . "', |
||||||
|
apikey = '" . $_REQUEST['apikey'] . "', |
||||||
|
secret_key = '" . $_REQUEST['secret_key'] . "', |
||||||
|
forecast = '" . $_REQUEST['forecast'] . "', |
||||||
|
view = '" . $_REQUEST['view'] . "', |
||||||
|
render = '" . $_REQUEST['render'] . "', |
||||||
|
lang = '" . $_REQUEST['lang'] . "', |
||||||
|
cacheTime = '" . $_REQUEST['cacheTime'] . "', |
||||||
|
units = '" . $_REQUEST['units'] . "', |
||||||
|
useCSS = '" . $_REQUEST['useCSS'] . "' |
||||||
|
WHERE id = '1' |
||||||
|
"); |
||||||
|
|
||||||
|
header('Location:index.php?do=modules&action=modedit&mod=weather&moduleaction=1&cp=' . SESSION); |
||||||
|
exit; |
||||||
|
}; |
||||||
|
|
||||||
|
$row = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_weather WHERE id = 1")->FetchAssocArray(); |
||||||
|
|
||||||
|
$AVE_Template->assign('row', $row); |
||||||
|
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_weather.tpl')); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} // class : end |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,14 @@ |
|||||||
|
<?php
|
||||||
|
/** |
||||||
|
* AVE.cms - module Weather |
||||||
|
* |
||||||
|
* @package AVE.cms |
||||||
|
* @author N.Popova, npop@abv.bg |
||||||
|
* @subpackage mod_weather |
||||||
|
* @filesource |
||||||
|
*/ |
||||||
|
|
||||||
|
header('Location:/index.php?'); |
||||||
|
exit; |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,66 @@ |
|||||||
|
<?php |
||||||
|
$conditions = array( |
||||||
|
0 => "Торнадо", //tornado |
||||||
|
1 => "Тропическа буря", //tropical storm |
||||||
|
2 => "Ураган", //hurricane |
||||||
|
3 => "Силна гръмотевична буря", //severe thunderstorms |
||||||
|
4 => "Гръмотевична буря", //thunderstorms |
||||||
|
5 => "Дъжд със сняг", //mixed rain and snow |
||||||
|
6 => "Дъжд с лапавица", //mixed rain and sleet |
||||||
|
7 => "Сняг с киша", //mixed snow and sleet |
||||||
|
8 => "Леден ръмеж", //freezing drizzle |
||||||
|
9 => "Ръмеж", //drizzle |
||||||
|
10 => "Студен дъжд", //freezing rain |
||||||
|
11 => "Дъжд", //showers |
||||||
|
12 => "Дъжд", //showers |
||||||
|
13 => "Снежни вихрушки", //snow flurries |
||||||
|
14 => "Лек сняг", //light snow showers |
||||||
|
15 => "Мокър сняг", //blowing snow |
||||||
|
16 => "Сняг", //snow |
||||||
|
17 => "Градушка", //hail |
||||||
|
18 => "Суграшица", //sleet |
||||||
|
19 => "Прах", //dust |
||||||
|
20 => "Мъгливо", //foggy |
||||||
|
21 => "Мараня", //haze |
||||||
|
22 => "Смог", //smoky |
||||||
|
23 => "Виелица", //blustery |
||||||
|
24 => "Ветровито", //windy |
||||||
|
25 => "Студено", //cold |
||||||
|
26 => "Облачно", //cloudy |
||||||
|
27 => "Предимно облачно", //mostly cloudy (night) |
||||||
|
28 => "Предимно облачно", //mostly cloudy (day) |
||||||
|
29 => "Частнична облачност", //partly cloudy (night) |
||||||
|
30 => "Частнична облачност", //partly cloudy (day) |
||||||
|
31 => "Ясно", //clear (night) |
||||||
|
32 => "Слънчево", //sunny |
||||||
|
33 => "Ясно", //fair (night) |
||||||
|
34 => "Ясно", //fair (day) |
||||||
|
35 => "Смесено дъжд и градушка", //mixed rain and hail |
||||||
|
36 => "Горещо", //hot |
||||||
|
37 => "Изолирани гръмотевични бури", //isolated thunderstorms |
||||||
|
38 => "Разпокъсани гръмотевични бури", //scattered thunderstorms |
||||||
|
39 => "Разпокъсани гръмотевични бури", //scattered thunderstorms |
||||||
|
40 => "Разпокъсани превалявания", //scattered showers |
||||||
|
41 => "Силен снеговалеж", //heavy snow |
||||||
|
42 => "Превалявания от сняг", //scattered snow showers |
||||||
|
43 => "Силен снеговалеж", //heavy snow |
||||||
|
44 => "Частична облачност", //partly cloudy |
||||||
|
45 => "Дъжд с гръмотевици", //thundershowers |
||||||
|
46 => "Снеговалеж", //snow showers |
||||||
|
47 => "Разпокъсани превалявания", //isolated thundershowers |
||||||
|
3200 => "Слънчево", //not available... alright... lets make that sunny. |
||||||
|
); |
||||||
|
|
||||||
|
$tdays = array( |
||||||
|
'Mon' => 'Понеделник', |
||||||
|
'Tue' => 'Вторник', |
||||||
|
'Wed' => 'Сряда', |
||||||
|
'Thu' => 'Четвъртък', |
||||||
|
'Fri' => 'Петък', |
||||||
|
'Sat' => 'Събота', |
||||||
|
'Sun' => 'Неделя' |
||||||
|
); |
||||||
|
|
||||||
|
$days = array( "Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък" , "Събота"); |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,33 @@ |
|||||||
|
WEATHER_NAME = 'Времето' |
||||||
|
[admin] |
||||||
|
WEATHER_MODULE_NAME = "Модул Прогноза" |
||||||
|
WEATHER_MODULE_INFO = "Извежда прогноза за времето от <a href="http://openweathermap.org">Openweathermap.org</a> или <a href="http://developer.yahoo.com/weather/">Yahoo Weather API</a> . При смяна на източника, моля изтрийте кеша на шаблоните." |
||||||
|
WEATHER_MODULE_EDIT = "Редактиране" |
||||||
|
WEATHER_FCOUNTRY ="Държава" |
||||||
|
WEATHER_FCITY="Локация(име населено място)" |
||||||
|
WEATHER_FCITY_DESC="Моля въведете името на града, което да се показва в сайта" |
||||||
|
WEATHER_LANG="Език (Openweathermap)" |
||||||
|
WEATHER_LANG_DESC="Моля въведете езика на който искате да бъде показана прогнозата - 'bg' за български" |
||||||
|
WEATHER_LONGITUDE="Географска дължина" |
||||||
|
WEATHER_LONGITUDE_DESC="" |
||||||
|
WEATHER_LATITUDE="Географска ширина" |
||||||
|
WEATHER_LATITUDE_DESC="" |
||||||
|
WEATHER_SHOWCITY="Покажи само името на града" |
||||||
|
WEATHER_SHOWCITY_DESC="Разрешете тази опция, ако желаете да се показва името на града" |
||||||
|
WEATHER_AMOUNT_DAYS="Брой дни" |
||||||
|
WEATHER_AMOUNT_DAYS_DESC="Брой дни за които да се показва прогнозата" |
||||||
|
WEATHER_UNIT="Мерна система" |
||||||
|
WEATHER_UNIT_DESC="Моля да изберете мерната единица - Metric (C) or Imperial (F)" |
||||||
|
WEATHER_USECSS="Модула зарежда CSS" |
||||||
|
WEATHER_USECSS_DESC="Изключете опцията, ако използвате шаблон, съдържащ стиловете, нообходими за работата на модула" |
||||||
|
WEATHER_CACHETIME="Време за кеширане в мин." |
||||||
|
WEATHER_CACHETIME_DESC="Определете времето за кеширане в минути" |
||||||
|
WEATHER_ENABLE = "Да" |
||||||
|
WEATHER_DISABLE = "Не" |
||||||
|
WEATHER_BUTTON_SAVE = "Запиши" |
||||||
|
WEATHER_TEMPLATE = "Начин на показване" |
||||||
|
WEATHER_TEMPLATE_DESC = "full, forecast, today, partial, simple" |
||||||
|
WEATHER_SOURCE = "Източник на прогнозата" |
||||||
|
WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" |
||||||
|
WEATHER_WOEID_DESC = "Например за Варна, България - 840430" |
||||||
|
|
@ -0,0 +1,65 @@ |
|||||||
|
<?php |
||||||
|
$conditions = array( |
||||||
|
0 => "Tornado", //tornado |
||||||
|
1 => "Tropical Storm", //tropical storm |
||||||
|
2 => "Hurricane", //hurricane |
||||||
|
3 => "Severe Thunderstorms", //severe thunderstorms |
||||||
|
4 => "Thunderstorms", //thunderstorms |
||||||
|
5 => "Mixed Rain and Snow", //mixed rain and snow |
||||||
|
6 => "Mixed Rain and Sleet", //mixed rain and sleet |
||||||
|
7 => "Mixed Snow and Sleet", //mixed snow and sleet |
||||||
|
8 => "Freezing Drizzle", //freezing drizzle |
||||||
|
9 => "Drizzle", //drizzle |
||||||
|
10 => "Freezing Rain",, //freezing rain |
||||||
|
11 => "Showers", //showers |
||||||
|
12 => "Showers", //showers |
||||||
|
13 => "Snow Flurries", //snow flurries |
||||||
|
14 => "Light Snow Showers", //light snow showers |
||||||
|
15 => "Blowing Snow", //blowing snow |
||||||
|
16 => "Snow", //snow |
||||||
|
17 => "Hail", //hail |
||||||
|
18 => "Sleet", //sleet |
||||||
|
19 => "Dust", //dust |
||||||
|
20 => "Foggy", //foggy |
||||||
|
21 => "Haze", //haze |
||||||
|
22 => "Smoky", //smoky |
||||||
|
23 => "Blustery", //blustery |
||||||
|
24 => "Windy", //windy |
||||||
|
25 => "Cold", //cold |
||||||
|
26 => "Cloudy", //cloudy |
||||||
|
27 => "Mostly Cloudy", //mostly cloudy (night) |
||||||
|
28 => "Mostly Cloudy", //mostly cloudy (day) |
||||||
|
29 => "Partly Cloudy", //partly cloudy (night) |
||||||
|
30 => "Partly Cloudy", //partly cloudy (day) |
||||||
|
31 => "Clear", //clear (night) |
||||||
|
32 => "Sunny", //sunny |
||||||
|
33 => "Fair", //fair (night) |
||||||
|
34 => "Fair", //fair (day) |
||||||
|
35 => "Mixed Rain and Hail", //mixed rain and hail |
||||||
|
36 => "Hot", //hot |
||||||
|
37 => "Isolated Thunderstormsи", //isolated thunderstorms |
||||||
|
38 => "Scattered Thunderstorms", //scattered thunderstorms |
||||||
|
39 => "Scattered Thunderstorms", //scattered thunderstorms |
||||||
|
40 => "Scattered Showers", //scattered showers |
||||||
|
41 => "Heavy Snow", //heavy snow |
||||||
|
42 => "Scattered Snow Showersг", //scattered snow showers |
||||||
|
43 => "Heavy Snow", //heavy snow |
||||||
|
44 => "Partly Cloudy", //partly cloudy |
||||||
|
45 => "Thundershowers", //thundershowers |
||||||
|
46 => "Snow Showers", //snow showers |
||||||
|
47 => "Isolated Thundershowers", //isolated thundershowers |
||||||
|
3200 => "Sunny", //not available... alright... lets make that sunny. |
||||||
|
); |
||||||
|
|
||||||
|
$tdays = array( |
||||||
|
'Mon' => 'Monday', |
||||||
|
'Tue' => 'Tuesday', |
||||||
|
'Wed' => 'Wednesday', |
||||||
|
'Thu' => 'Thursday', |
||||||
|
'Fri' => 'Friday', |
||||||
|
'Sat' => 'Saturday', |
||||||
|
'Sun' => 'Sunday' |
||||||
|
); |
||||||
|
$days = array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday"); |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,32 @@ |
|||||||
|
WEATHER_NAME = 'WEATHER' |
||||||
|
[admin] |
||||||
|
WEATHER_MODULE_NAME = "Module WEATHER" |
||||||
|
WEATHER_MODULE_INFO = "Module info" |
||||||
|
WEATHER_MODULE_EDIT = "Edit" |
||||||
|
WEATHER_FCOUNTRY ="Country" |
||||||
|
WEATHER_FCITY="Location" |
||||||
|
WEATHER_FCITY_DESC="Please specify full name of city which will be visible in the module" |
||||||
|
WEATHER_LANG="Language (Openweathermap)" |
||||||
|
WEATHER_LANG_DESC="Please specify language for forecast - i.e. 'en' for english, 'bg' for bulgarian" |
||||||
|
WEATHER_LATITUDE="Latitude" |
||||||
|
WEATHER_LATITUDE_DESC="" |
||||||
|
WEATHER_LONGITUDE="Longitude" |
||||||
|
WEATHER_LONGITUDE_DESC="" |
||||||
|
WEATHER_SHOWCITY="Show only city name" |
||||||
|
WEATHER_SHOWCITY_DESC="Enable this option if you want to show only city name" |
||||||
|
WEATHER_AMOUNT_DAYS="Amount of days" |
||||||
|
WEATHER_AMOUNT_DAYS_DESC="Amount of days in forecast.<br />0 - display only current day." |
||||||
|
WEATHER_UNIT="Units" |
||||||
|
WEATHER_UNIT_DESC="Select units used in your weather - Metric (C) or Imperial (F)" |
||||||
|
WEATHER_USECSS="Use module CSS" |
||||||
|
WEATHER_USECSS_DESC="Disable this option when you are using template with built-in styles for this module" |
||||||
|
WEATHER_CACHETIME="Cache time" |
||||||
|
WEATHER_CACHETIME_DESC="Set time for cache in minutes.<br />0 - disable cache" |
||||||
|
WEATHER_ENABLE = "Yes" |
||||||
|
WEATHER_DISABLE = "No" |
||||||
|
WEATHER_BUTTON_SAVE = "Save" |
||||||
|
WEATHER_TEMPLATE = "Template" |
||||||
|
WEATHER_TEMPLATE_DESC = "" |
||||||
|
WEATHER_SOURCE = "Weather API" |
||||||
|
WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" |
||||||
|
WEATHER_WOEID_DESC = "" |
@ -0,0 +1,65 @@ |
|||||||
|
<?php |
||||||
|
$conditions = array( |
||||||
|
0 => "Tornado", //tornado |
||||||
|
1 => "Tropical Storm", //tropical storm |
||||||
|
2 => "Hurricane", //hurricane |
||||||
|
3 => "Severe Thunderstorms", //severe thunderstorms |
||||||
|
4 => "Thunderstorms", //thunderstorms |
||||||
|
5 => "Mixed Rain and Snow", //mixed rain and snow |
||||||
|
6 => "Mixed Rain and Sleet", //mixed rain and sleet |
||||||
|
7 => "Mixed Snow and Sleet", //mixed snow and sleet |
||||||
|
8 => "Freezing Drizzle", //freezing drizzle |
||||||
|
9 => "Drizzle", //drizzle |
||||||
|
10 => "Freezing Rain",, //freezing rain |
||||||
|
11 => "Showers", //showers |
||||||
|
12 => "Showers", //showers |
||||||
|
13 => "Snow Flurries", //snow flurries |
||||||
|
14 => "Light Snow Showers", //light snow showers |
||||||
|
15 => "Blowing Snow", //blowing snow |
||||||
|
16 => "Snow", //snow |
||||||
|
17 => "Hail", //hail |
||||||
|
18 => "Sleet", //sleet |
||||||
|
19 => "Dust", //dust |
||||||
|
20 => "Foggy", //foggy |
||||||
|
21 => "Haze", //haze |
||||||
|
22 => "Smoky", //smoky |
||||||
|
23 => "Blustery", //blustery |
||||||
|
24 => "Windy", //windy |
||||||
|
25 => "Cold", //cold |
||||||
|
26 => "Cloudy", //cloudy |
||||||
|
27 => "Mostly Cloudy", //mostly cloudy (night) |
||||||
|
28 => "Mostly Cloudy", //mostly cloudy (day) |
||||||
|
29 => "Partly Cloudy", //partly cloudy (night) |
||||||
|
30 => "Partly Cloudy", //partly cloudy (day) |
||||||
|
31 => "Clear", //clear (night) |
||||||
|
32 => "Sunny", //sunny |
||||||
|
33 => "Fair", //fair (night) |
||||||
|
34 => "Fair", //fair (day) |
||||||
|
35 => "Mixed Rain and Hail", //mixed rain and hail |
||||||
|
36 => "Hot", //hot |
||||||
|
37 => "Isolated Thunderstormsи", //isolated thunderstorms |
||||||
|
38 => "Scattered Thunderstorms", //scattered thunderstorms |
||||||
|
39 => "Scattered Thunderstorms", //scattered thunderstorms |
||||||
|
40 => "Scattered Showers", //scattered showers |
||||||
|
41 => "Heavy Snow", //heavy snow |
||||||
|
42 => "Scattered Snow Showersг", //scattered snow showers |
||||||
|
43 => "Heavy Snow", //heavy snow |
||||||
|
44 => "Partly Cloudy", //partly cloudy |
||||||
|
45 => "Thundershowers", //thundershowers |
||||||
|
46 => "Snow Showers", //snow showers |
||||||
|
47 => "Isolated Thundershowers", //isolated thundershowers |
||||||
|
3200 => "Sunny", //not available... alright... lets make that sunny. |
||||||
|
); |
||||||
|
|
||||||
|
$tdays = array( |
||||||
|
'Mon' => 'Monday', |
||||||
|
'Tue' => 'Tuesday', |
||||||
|
'Wed' => 'Wednesday', |
||||||
|
'Thu' => 'Thursday', |
||||||
|
'Fri' => 'Friday', |
||||||
|
'Sat' => 'Saturday', |
||||||
|
'Sun' => 'Sunday' |
||||||
|
); |
||||||
|
$days = array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday"); |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,31 @@ |
|||||||
|
WEATHER_NAME = 'Погода' |
||||||
|
[admin] |
||||||
|
WEATHER_MODULE_NAME = "Модуль Погода > Настройки" |
||||||
|
WEATHER_MODULE_INFO = "Модуль Погода использует <a href="http://openweathermap.org">Openweathermap.org</a> или<a href="http://developer.yahoo.com/weather/">Yahoo Weather API</a> для получения данных о погоде на текущий день и прогноза на ближайшие дни для любой точки мира. Используя самый надежный источник информации о погоде Вы можете обогатить веб-сайт собственным каналом погоды, который можете оформить по своему усмотрению." |
||||||
|
WEATHER_MODULE_EDIT = "Редактировать" |
||||||
|
WEATHER_CITY = "Местоположение" |
||||||
|
WEATHER_FCOUNTRY ="Страна" |
||||||
|
WEATHER_FCITY = "Полное наименование города" |
||||||
|
WEATHER_FCITY_DESC = "Пожалуйста, укажите полное наименование города, для которого будет выводится информация о погоде" |
||||||
|
WEATHER_LANG = "Язык" |
||||||
|
WEATHER_LANG_DESC = "Пожалуйста, укажите язык вывода информации о погоде. Например, <b>en</b> - английский, <b>bg</b> - болгарский" |
||||||
|
WEATHER_LATITUDE = "Широта" |
||||||
|
WEATHER_LATITUDE_DESC = "" |
||||||
|
WEATHER_LONGITUDE = "Долгота" |
||||||
|
WEATHER_LONGITUDE_DESC = "" |
||||||
|
WEATHER_SHOWCITY = "Отображать название города" |
||||||
|
WEATHER_SHOWCITY_DESC = "Включите этот параметр, если хотите отображать название города" |
||||||
|
WEATHER_AMOUNT_DAYS = "Количество дней в прогнозе" |
||||||
|
WEATHER_AMOUNT_DAYS_DESC = "На сколько дней выводить прогноз погоды.<br />0 - выводить информацию о погоде только на текущий день" |
||||||
|
WEATHER_UNIT = "Единица измерения температуры" |
||||||
|
WEATHER_UNIT_DESC = "Выберите единицу измерения температуры: Metric (C) or Imperial (F)" |
||||||
|
WEATHER_USECSS = "CSS стили" |
||||||
|
WEATHER_USECSS_DESC = "Отключите эту опцию если используете шаблон со встроенными стилями" |
||||||
|
WEATHER_CACHETIME = "Время жизни кэша" |
||||||
|
WEATHER_CACHETIME_DESC = "Использование кэширования. Укажите время жизни кэша в минутах.<br />0 - кэш отключен" |
||||||
|
WEATHER_ENABLE = "Вкл" |
||||||
|
WEATHER_DISABLE = "Выкл" |
||||||
|
WEATHER_BUTTON_SAVE = "Сохранить" |
||||||
|
WEATHER_SOURCE = "Weather API" |
||||||
|
WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" |
||||||
|
WEATHER_WOEID_DESC = "" |
@ -0,0 +1,67 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* AVE.cms - module Weather |
||||||
|
* |
||||||
|
* @package AVE.cms |
||||||
|
* @author N.Popova, npop@abv.bg |
||||||
|
* @subpackage mod_weather |
||||||
|
* @filesource |
||||||
|
*/ |
||||||
|
|
||||||
|
if (!defined('BASE_DIR')) exit; |
||||||
|
|
||||||
|
if (defined('ACP')) |
||||||
|
{ |
||||||
|
|
||||||
|
$modul['ModuleName'] = 'Weather widget'; |
||||||
|
$modul['ModuleSysName'] = 'weather'; |
||||||
|
$modul['ModuleVersion'] = '1.01'; |
||||||
|
$modul['ModuleDescription'] = 'Weather is weather module which utilizes the Openweather/Yahoo API allowing you to display weather data and related information from regions from all over the world very easily.<br />You can enrich your website with your own weather channel, were all weather conditions from any place of the world will look as you want to be, using the most reliable weather forecast source and combining with the most professional style.<br />System tag <strong>[mod_weather]</strong>.'; |
||||||
|
$modul['ModuleAutor'] = "N. Popova, npop@abv.bg"; // Автор |
||||||
|
$modul['ModuleCopyright'] = '© 2016 npop@abv.bg'; // |
||||||
|
$modul['ModuleIsFunction'] = 1; |
||||||
|
$modul['ModuleAdminEdit'] = 1; |
||||||
|
$modul['ModuleFunction'] = 'mod_weather'; |
||||||
|
$modul['ModuleTag'] = '[mod_weather]'; |
||||||
|
$modul['ModuleTagLink'] = null; |
||||||
|
$modul['ModuleAveTag'] = "#\\\[mod_weather]#"; |
||||||
|
$modul['ModulePHPTag'] = "<?php mod_weather(); ?>";
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function mod_weather() |
||||||
|
{ |
||||||
|
|
||||||
|
require_once(BASE_DIR . "/modules/weather/class.weather.php"); |
||||||
|
|
||||||
|
$weather = new Weather(); |
||||||
|
|
||||||
|
$tpl_dir = BASE_DIR . '/modules/weather/templates/'; |
||||||
|
$lang_file = BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".txt"; |
||||||
|
|
||||||
|
if (! is_file(BASE_DIR . '/cache/')) {@mkdir(BASE_DIR . '/cache/', 0777);} |
||||||
|
|
||||||
|
$weather->ShowWeather($tpl_dir, $lang_file); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (defined('ACP') && ! empty($_REQUEST['moduleaction'])) |
||||||
|
{ |
||||||
|
|
||||||
|
require_once(BASE_DIR . "/modules/weather/class.weather.php"); |
||||||
|
|
||||||
|
$tpl_dir = BASE_DIR . '/modules/weather/templates/'; |
||||||
|
$lang_file = BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".txt"; |
||||||
|
|
||||||
|
$weather = new Weather(); |
||||||
|
$AVE_Template->config_load($lang_file, "admin"); |
||||||
|
|
||||||
|
switch($_REQUEST['moduleaction']) |
||||||
|
{ |
||||||
|
case '1': |
||||||
|
$weather->weatherSettingsEdit($tpl_dir, $lang_file); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,64 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* AVE.cms - module Weather |
||||||
|
* |
||||||
|
* @package AVE.cms |
||||||
|
* @author N.Popova, npop@abv.bg |
||||||
|
* @subpackage mod_weather |
||||||
|
* @filesource |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* mySQL-query install, update and delete module |
||||||
|
*/ |
||||||
|
|
||||||
|
$module_sql_install = array(); |
||||||
|
$module_sql_deinstall = array(); |
||||||
|
$module_sql_update = array(); |
||||||
|
|
||||||
|
$module_sql_deinstall[] = "DROP TABLE IF EXISTS `CPPREFIX_module_weather`;"; |
||||||
|
|
||||||
|
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_weather` ( |
||||||
|
`id` tinyint(1) unsigned NOT NULL auto_increment, |
||||||
|
`location` char(100) default 'Varna', |
||||||
|
`country` char(100) default 'Bulgaria', |
||||||
|
`WOEID` varchar(20) default '726050', |
||||||
|
`lat` decimal(10,8) default '43.216671', |
||||||
|
`lon` decimal(10,8) default '27.91667', |
||||||
|
`displayCityNameOnly` enum('0','1') NOT NULL default '0', |
||||||
|
`api` enum('openweathermap','yahoo') NOT NULL default 'openweathermap', |
||||||
|
`apikey` char(255) default '', |
||||||
|
`secret_key` char(255) default '', |
||||||
|
`forecast` enum('1','2','3','4','5') NOT NULL default '3', |
||||||
|
`view` enum('simple','today','partial','forecast', 'full') NOT NULL default 'full', |
||||||
|
`render` enum('0','1') NOT NULL default '1', |
||||||
|
`loadingAnimation` enum('0','1') NOT NULL default '1', |
||||||
|
`lang` char(2) NOT NULL default 'bg', |
||||||
|
`cacheTime` int(3) unsigned NOT NULL default '5', |
||||||
|
`units` enum('metric','imperial') NOT NULL default 'metric', |
||||||
|
`useCSS` enum('0','1') NOT NULL default '1', |
||||||
|
PRIMARY KEY (`id`) |
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;" ; |
||||||
|
|
||||||
|
$module_sql_install[] = "INSERT INTO `CPPREFIX_module_weather` VALUES (1, 'Varna','Bulgaria', '726050', '43.216671', '27.91667', '0', 'openweathermap','','','3','full','1', '1','bg','10','metric','1');"; |
||||||
|
|
||||||
|
$module_sql_update[] = " |
||||||
|
UPDATE |
||||||
|
CPPREFIX_module |
||||||
|
SET |
||||||
|
CpEngineTag = '" . $modul['CpEngineTag'] . "', |
||||||
|
CpPHPTag = '" . $modul['CpPHPTag'] . "', |
||||||
|
Version = '" . $modul['ModulVersion'] . "' |
||||||
|
WHERE |
||||||
|
ModulPfad = '" . $modul['ModulPfad'] . "' |
||||||
|
LIMIT 1;"; |
||||||
|
|
||||||
|
$module_sql_update[] = " |
||||||
|
ALTER TABLE |
||||||
|
`CPPREFIX_module_weather` |
||||||
|
ADD |
||||||
|
`secret_key` CHAR(255) NOT NULL |
||||||
|
AFTER |
||||||
|
`apikey`; |
||||||
|
"; |
||||||
|
?> |
@ -0,0 +1,163 @@ |
|||||||
|
<div class="title"><h5>{#WEATHER_MODULE_NAME#}</h5></div> |
||||||
|
|
||||||
|
<div class="widget" style="margin-top: 0px;"> |
||||||
|
<div class="body"> |
||||||
|
{#WEATHER_MODULE_INFO#} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="breadCrumbHolder module"> |
||||||
|
<div class="breadCrumb module"> |
||||||
|
<ul> |
||||||
|
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li> |
||||||
|
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li> |
||||||
|
<li>{#WEATHER_MODULE_NAME#}</li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<form method="post" action="index.php?do=modules&action=modedit&mod=weather&moduleaction=1&sub=save&cp={$sess}" class="mainForm"> |
||||||
|
<fieldset> |
||||||
|
<div class="widget first"> |
||||||
|
<div class="head"><h5 class="iFrames">{#WEATHER_MODULE_EDIT#}</h5></div> |
||||||
|
|
||||||
|
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic"> |
||||||
|
<colgroup> |
||||||
|
<col width="30"> |
||||||
|
<col width="250px;"> |
||||||
|
<col> |
||||||
|
</colgroup> |
||||||
|
<tbody> |
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_SOURCE_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>{#WEATHER_SOURCE#}</td> |
||||||
|
<td> |
||||||
|
<select name="api" > |
||||||
|
<option value="openweathermap"{if $row.api=="openweathermap"} selected="selected"{/if}>Openweathermap Api</option> |
||||||
|
<option value="yahoo"{if $row.api=="yahoo"} selected="selected"{/if}>Yahoo weather Api</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><a title="API key" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>API key (Openweathermap)</td> |
||||||
|
<td><input type="text" name="apikey" value="{$row.apikey}"/></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_WOEID_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_WOEID#}</td> |
||||||
|
<td><div class="pr12"><input type="text" name="WOEID" value="{$row.WOEID}"/></div></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_TEMPLATE_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>{#WEATHER_TEMPLATE#}</td> |
||||||
|
<td> |
||||||
|
<select name="view" > |
||||||
|
<option value="simple"{if $row.view=="simple"} selected="selected"{/if}>simple</option> |
||||||
|
<option value="today"{if $row.view=="today"} selected="selected"{/if}>today</option> |
||||||
|
<option value="partial"{if $row.view=="partial"} selected="selected"{/if}>partial</option> |
||||||
|
<option value="forecast"{if $row.view=="forecast"} selected="selected"{/if}>forecast</option> |
||||||
|
<option value="full"{if $row.view=="full"} selected="selected"{/if}>full</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_AMOUNT_DAYS_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>{#WEATHER_AMOUNT_DAYS#}</td> |
||||||
|
<td> |
||||||
|
<select name="forecast" id="forecast"> |
||||||
|
<option value="1"{if $row.forecast=="1"} selected="selected"{/if}>1</option> |
||||||
|
<option value="2"{if $row.forecast=="2"} selected="selected"{/if}>2</option> |
||||||
|
<option value="3"{if $row.forecast=="3"} selected="selected"{/if}>3</option> |
||||||
|
<option value="4"{if $row.forecast=="4"} selected="selected"{/if}>4</option> |
||||||
|
<option value="5"{if $row.forecast=="5"} selected="selected"{/if}>5</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_FCITY_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>{#WEATHER_FCITY#}</td> |
||||||
|
<td ><div class="pr12"><input type="text" name="location" value="{$row.location}" /></div></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_FCITY_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>{#WEATHER_FCOUNTRY#}</td> |
||||||
|
<td ><div class="pr12"><input type="text" name="country" value="{$row.country}" /></div></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_SHOWCITY_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_SHOWCITY#}</td> |
||||||
|
<td> |
||||||
|
<select name="displayCityNameOnly" id="displayCityNameOnly"> |
||||||
|
<option value="1"{if $row.showCity=="1"} selected="selected"{/if}>{#WEATHER_ENABLE#}</option> |
||||||
|
<option value="0"{if $row.showCity=="0"} selected="selected"{/if}>{#WEATHER_DISABLE#}</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
{* |
||||||
|
<tr> |
||||||
|
<td><a title="API key" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td>Secret key (Yahoo YQL)</td> |
||||||
|
<td><input type="text" name="secret_key" value="{$row.secret_key}"/></td> |
||||||
|
</tr> |
||||||
|
*} |
||||||
|
|
||||||
|
|
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_LANG_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></td> |
||||||
|
<td >{#WEATHER_LANG#}</td> |
||||||
|
<td><input type="text" name="lang" value="{$row.lang}" style="width: 200px;"/></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_LATITUDE_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_LATITUDE#}</td> |
||||||
|
<td><input type="text" name="lat" value="{$row.lat}" style="width: 300px;"/></td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_LONGITUDE_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_LONGITUDE#}</td> |
||||||
|
<td><input type="text" name="lon" value="{$row.lon}" style="width: 300px;"/></td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr> |
||||||
|
<td><a title="{#WEATHER_UNIT_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></td> |
||||||
|
<td>{#WEATHER_UNIT#}</td> |
||||||
|
<td> |
||||||
|
<select name="units" id="units"> |
||||||
|
<option value="metric" {if $row.tempUnit=="metric"} selected="selected"{/if}>Metric (C)</option> |
||||||
|
<option value="imperial" {if $row.tempUnit=="imperial"} selected="selected"{/if}>Imperial (F)</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_CACHETIME_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_CACHETIME#}</td> |
||||||
|
<td><input type="text" name="cacheTime" value="{$row.cacheTime}" style="width: 300px;"/></td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr> |
||||||
|
<td ><a title="{#WEATHER_USECSS_DESC#}" href="javascript:void(0);" style="cursor:help;" class="rightDir icon_sprite ico_info"></a></td> |
||||||
|
<td >{#WEATHER_USECSS#}</td> |
||||||
|
<td> |
||||||
|
<select name="useCSS" id="useCSS"> |
||||||
|
<option value="1"{if $row.useCSS=="1"} selected="selected"{/if}>{#WEATHER_ENABLE#}</option> |
||||||
|
<option value="0"{if $row.useCSS=="0"} selected="selected"{/if}>{#WEATHER_DISABLE#}</option> |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
<div class="rowElem"> |
||||||
|
<input type="submit" class="basicBtn" value="{#WEATHER_BUTTON_SAVE#}" /> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</fieldset> |
||||||
|
</form> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,644 @@ |
|||||||
|
/*************************************************************************************************/ |
||||||
|
/* Global - Base */ |
||||||
|
/*************************************************************************************************/ |
||||||
|
@font-face { |
||||||
|
font-family: 'weathericons'; |
||||||
|
src: url('../fonts/weathericons-regular-webfont.eot'); |
||||||
|
src: url('../fonts/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/weathericons-regular-webfont.woff') format('woff'), url('../fonts/weathericons-regular-webfont.ttf') format('truetype'), url('../fonts/weathericons-regular-webfont.svg#weathericons-regular-webfontRg') format('svg'); |
||||||
|
font-weight: normal; |
||||||
|
font-style: normal; |
||||||
|
} |
||||||
|
|
||||||
|
.wi:before, .wi:after { |
||||||
|
display: inline-block; |
||||||
|
font-family: 'weathericons'; |
||||||
|
font-style: normal; |
||||||
|
font-weight: normal; |
||||||
|
line-height: 1; |
||||||
|
-webkit-font-smoothing: antialiased; |
||||||
|
-moz-osx-font-smoothing: grayscale; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.WeatherPlugin { |
||||||
|
font-size: inherit; |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin p, .WeatherPlugin h2, .WeatherPlugin h3, .WeatherPlugin ul, .WeatherPlugin li { |
||||||
|
padding: 0; |
||||||
|
margin: 0; |
||||||
|
color: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
#flatWeatherLoading.loading { |
||||||
|
font-size: 90px; |
||||||
|
text-align: center; |
||||||
|
padding: 10px; |
||||||
|
overflow: hidden; |
||||||
|
-webkit-animation:spin 2s linear infinite; |
||||||
|
-moz-animation:spin 2s linear infinite; |
||||||
|
animation:spin 2s linear infinite; |
||||||
|
opacity: 0.2; |
||||||
|
} |
||||||
|
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } |
||||||
|
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } |
||||||
|
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } |
||||||
|
|
||||||
|
.WeatherPlugin h2 { |
||||||
|
margin: 0 0 5px 0; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiToday { |
||||||
|
width: 100%; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiToday > .wiIconGroup { |
||||||
|
float: right; |
||||||
|
width: 50%; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiToday > .wiIconGroup p { |
||||||
|
width: 100%; |
||||||
|
color: inherit; |
||||||
|
line-height: 1em; |
||||||
|
padding: 6px 0 0 0; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.WeatherPlugin .wiToday .wiIconGroup div.wi { |
||||||
|
font-size: 400%; |
||||||
|
line-height: 1.45em; |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiToday .wiIconGroup div.wi:before { |
||||||
|
vertical-align: text-bottom; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .clearfix:after { |
||||||
|
content: " "; |
||||||
|
display: table; |
||||||
|
clear: both; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin div.wiToday > p.wiTemperature { |
||||||
|
font-size: 400%; |
||||||
|
line-height: 1.45em; |
||||||
|
float: left; |
||||||
|
width: 50%; |
||||||
|
text-align: center; |
||||||
|
color: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin sup { |
||||||
|
opacity: 0.7; |
||||||
|
font-size: 65%; |
||||||
|
vertical-align: baseline; |
||||||
|
top: -0.5em; |
||||||
|
position: relative; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail { |
||||||
|
overflow: hidden; |
||||||
|
width: 100%; |
||||||
|
padding-bottom: 5px; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin.today .wiDetail { |
||||||
|
padding-top: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail p.wiDay { |
||||||
|
font-weight: bold; |
||||||
|
margin: 5px 0 2px 0; |
||||||
|
text-align: left; |
||||||
|
color: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin.partial .wiToday p.wiDay { |
||||||
|
text-align: center; |
||||||
|
font-weight: bold; |
||||||
|
padding: 0 0 10px 0; |
||||||
|
clear: both; |
||||||
|
width: 100%; |
||||||
|
color: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail ul { |
||||||
|
width: 33%; |
||||||
|
float: left; |
||||||
|
list-style: none; |
||||||
|
font-size: 90%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail ul + ul { |
||||||
|
width: 27%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail ul + ul + ul { |
||||||
|
width: 40%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin .wiDetail ul li:before { |
||||||
|
width:30px; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts{ |
||||||
|
width: 100%; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts li > span { |
||||||
|
width: 25%; |
||||||
|
display: inline-block; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts li { |
||||||
|
float: left; |
||||||
|
width: 100%; |
||||||
|
overflow: hidden; |
||||||
|
display: inline; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts ul.wiForecast { |
||||||
|
font-weight: normal; |
||||||
|
list-style: none; |
||||||
|
float: right; |
||||||
|
width: 75%; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin.forecast ul.wiForecasts ul.wiForecast li { |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts ul.wiForecast li { |
||||||
|
width: 33%; |
||||||
|
float: left; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts ul.wiForecast li.wi:before { |
||||||
|
vertical-align: bottom; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts li.wiDay { |
||||||
|
font-weight: bold; |
||||||
|
border-color: inherit; |
||||||
|
border-top: 1px solid RGBA(255,255,255,0.2); |
||||||
|
padding: 5px 0; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin.forecast ul.wiForecasts li.wiDay { |
||||||
|
border-bottom: 1px solid RGBA(255,255,255,0.2); |
||||||
|
border-top: none; |
||||||
|
} |
||||||
|
|
||||||
|
.WeatherPlugin ul.wiForecasts li.wiDay:last-child { |
||||||
|
border-bottom: none; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************************************/ |
||||||
|
/* Font mappings */ |
||||||
|
/*************************************************************************************************/ |
||||||
|
|
||||||
|
/*************************** |
||||||
|
General |
||||||
|
****************************/ |
||||||
|
.wi.sunrise:before { |
||||||
|
content: "\f051"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.sunset:before { |
||||||
|
content: "\f052"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.wind:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.humidity:before { |
||||||
|
content: "\f04e"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.pressure:before { |
||||||
|
content: "\f040"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.cloudiness:before { |
||||||
|
content: "\f041"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.temperature.metric:after { |
||||||
|
content: "\f03c"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.temperature.imperial:after { |
||||||
|
content: "\f045"; |
||||||
|
} |
||||||
|
|
||||||
|
.wi.loading:after { |
||||||
|
content: "\f04c"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Thunderstorm |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* thunderstorm with light rain */ |
||||||
|
.wi.wi200:before { |
||||||
|
content: "\f01d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm with rain */ |
||||||
|
.wi.wi201:before { |
||||||
|
content: "\f01d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm with heavy rain */ |
||||||
|
.wi.wi202:before { |
||||||
|
content: "\f01e"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light thunderstorm */ |
||||||
|
.wi.wi210:before { |
||||||
|
content: "\f010"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm */ |
||||||
|
.wi.wi211:before { |
||||||
|
content: "\f01e"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy thunderstorm */ |
||||||
|
.wi.wi212:before { |
||||||
|
content: "\f01e"; |
||||||
|
} |
||||||
|
|
||||||
|
/* ragged thunderstorm */ |
||||||
|
.wi.wi221:before { |
||||||
|
content: "\f016"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm with light drizzle */ |
||||||
|
.wi.wi230:before { |
||||||
|
content: "\f01d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm with drizzle */ |
||||||
|
.wi.wi231:before { |
||||||
|
content: "\f01d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* thunderstorm with heavy drizzle */ |
||||||
|
.wi.wi232:before { |
||||||
|
content: "\f01d"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Drizzle |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* light intensity drizzle */ |
||||||
|
.wi.wi300:before { |
||||||
|
content: "\f01c"; |
||||||
|
} |
||||||
|
|
||||||
|
/* drizzle */ |
||||||
|
.wi.wi301:before { |
||||||
|
content: "\f01c"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy intensity drizzle */ |
||||||
|
.wi.wi302:before { |
||||||
|
content: "\f01c"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light intensity drizzle rain */ |
||||||
|
.wi.wi310:before { |
||||||
|
content: "\f01c"; |
||||||
|
} |
||||||
|
|
||||||
|
/* drizzle rain */ |
||||||
|
.wi.wi311:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy intensity drizzle rain */ |
||||||
|
.wi.wi312:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* shower rain and drizzle */ |
||||||
|
.wi.wi313:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy shower rain and drizzle */ |
||||||
|
.wi.wi314:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* shower drizzle */ |
||||||
|
.wi.wi321:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Rain |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* light rain */ |
||||||
|
.wi.wi500:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* moderate rain */ |
||||||
|
.wi.wi501:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy intensity rain */ |
||||||
|
.wi.wi502:before { |
||||||
|
content: "\f019"; |
||||||
|
} |
||||||
|
|
||||||
|
/* very heavy rain */ |
||||||
|
.wi.wi503:before { |
||||||
|
content: "\f019"; |
||||||
|
} |
||||||
|
|
||||||
|
/* extreme rain */ |
||||||
|
.wi.wi504:before { |
||||||
|
content: "\f018"; |
||||||
|
} |
||||||
|
|
||||||
|
/* freezing rain */ |
||||||
|
.wi.wi511:before { |
||||||
|
content: "\f015"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light intensity shower rain */ |
||||||
|
.wi.wi520:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* shower rain */ |
||||||
|
.wi.wi521:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy intensity shower rain */ |
||||||
|
.wi.wi522:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/* ragged shower rain */ |
||||||
|
.wi.wi531:before { |
||||||
|
content: "\f01a"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Snow |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* light snow */ |
||||||
|
.wi.wi600:before { |
||||||
|
content: "\f01b"; |
||||||
|
} |
||||||
|
|
||||||
|
/* snow */ |
||||||
|
.wi.wi601:before { |
||||||
|
content: "\f01b"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy snow */ |
||||||
|
.wi.wi602:before { |
||||||
|
content: "\f01b"; |
||||||
|
} |
||||||
|
|
||||||
|
/* sleet */ |
||||||
|
.wi.wi611:before { |
||||||
|
content: "\f015"; |
||||||
|
} |
||||||
|
|
||||||
|
/* shower sleet */ |
||||||
|
.wi.wi612:before { |
||||||
|
content: "\f015"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light rain and snow */ |
||||||
|
.wi.wi615:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* rain and snow */ |
||||||
|
.wi.wi616:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light shower snow */ |
||||||
|
.wi.wi620:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* shower snow */ |
||||||
|
.wi.wi621:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/* heavy shower snow */ |
||||||
|
.wi.wi622:before { |
||||||
|
content: "\f017"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Atmosphere |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* mist */ |
||||||
|
.wi.wi701:before { |
||||||
|
content: "\f014"; |
||||||
|
} |
||||||
|
|
||||||
|
/* smoke */ |
||||||
|
.wi.wi711:before { |
||||||
|
content: "\f062"; |
||||||
|
} |
||||||
|
|
||||||
|
/* haze */ |
||||||
|
.wi.wi721:before { |
||||||
|
content: "\f014"; |
||||||
|
} |
||||||
|
|
||||||
|
/* sand, dust whirls */ |
||||||
|
.wi.wi731:before { |
||||||
|
content: "\f063"; |
||||||
|
} |
||||||
|
|
||||||
|
/* fog */ |
||||||
|
.wi.wi741:before { |
||||||
|
content: "\f014"; |
||||||
|
} |
||||||
|
|
||||||
|
/* sand */ |
||||||
|
.wi.wi751:before { |
||||||
|
content: "\f063"; |
||||||
|
} |
||||||
|
|
||||||
|
/* dust */ |
||||||
|
.wi.wi761:before { |
||||||
|
content: "\f063"; |
||||||
|
} |
||||||
|
|
||||||
|
/* volcanic ash */ |
||||||
|
.wi.wi762:before { |
||||||
|
content: "\f063"; |
||||||
|
} |
||||||
|
|
||||||
|
/* squalls */ |
||||||
|
.wi.wi771:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
/* tornado */ |
||||||
|
.wi.wi781:before { |
||||||
|
content: "\f056"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Clouds |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* clear sky */ |
||||||
|
.wi.wi800:before { |
||||||
|
content: "\f00d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* few clouds */ |
||||||
|
.wi.wi801:before { |
||||||
|
content: "\f002"; |
||||||
|
} |
||||||
|
|
||||||
|
/* scattered clouds */ |
||||||
|
.wi.wi802:before { |
||||||
|
content: "\f002"; |
||||||
|
} |
||||||
|
|
||||||
|
/* broken clouds */ |
||||||
|
.wi.wi803:before { |
||||||
|
content: "\f002"; |
||||||
|
} |
||||||
|
|
||||||
|
/* overcast clouds */ |
||||||
|
.wi.wi804:before { |
||||||
|
content: "\f00c"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Extreme |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* tornado */ |
||||||
|
.wi.wi900:before { |
||||||
|
content: "\f056"; |
||||||
|
} |
||||||
|
|
||||||
|
/* tropical storm */ |
||||||
|
.wi.wi901:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
||||||
|
|
||||||
|
/* hurricane */ |
||||||
|
.wi.wi902:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
||||||
|
|
||||||
|
/* cold */ |
||||||
|
.wi.wi903:before { |
||||||
|
content: "\f076"; |
||||||
|
} |
||||||
|
|
||||||
|
/* hot */ |
||||||
|
.wi.wi904:before { |
||||||
|
content: "\f072"; |
||||||
|
} |
||||||
|
|
||||||
|
/* windy */ |
||||||
|
.wi.wi905:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
/* hail */ |
||||||
|
.wi.wi906:before { |
||||||
|
content: "\f015"; |
||||||
|
} |
||||||
|
|
||||||
|
/*************************** |
||||||
|
Additional |
||||||
|
****************************/ |
||||||
|
|
||||||
|
/* calm */ |
||||||
|
.wi.wi951:before { |
||||||
|
content: "\f00d"; |
||||||
|
} |
||||||
|
|
||||||
|
/* light breeze */ |
||||||
|
.wi.wi952:before { |
||||||
|
content: "\f021"; |
||||||
|
} |
||||||
|
|
||||||
|
/* gentle breeze */ |
||||||
|
.wi.wi953:before { |
||||||
|
content: "\f021"; |
||||||
|
} |
||||||
|
|
||||||
|
/* moderate breeze */ |
||||||
|
.wi.wi954:before { |
||||||
|
content: "\f021"; |
||||||
|
} |
||||||
|
|
||||||
|
/* fresh breeze */ |
||||||
|
.wi.wi955:before { |
||||||
|
content: "\f021"; |
||||||
|
} |
||||||
|
|
||||||
|
/* strong breeze */ |
||||||
|
.wi.wi956:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
/* high wind, near gale */ |
||||||
|
.wi.wi957:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
/* gale */ |
||||||
|
.wi.wi958:before { |
||||||
|
content: "\f050"; |
||||||
|
} |
||||||
|
|
||||||
|
/* severe gale */ |
||||||
|
.wi.wi959:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
||||||
|
|
||||||
|
/* storm */ |
||||||
|
.wi.wi960:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
||||||
|
|
||||||
|
/* violent storm */ |
||||||
|
.wi.wi961:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
||||||
|
|
||||||
|
/* hurricane */ |
||||||
|
.wi.wi962:before { |
||||||
|
content: "\f073"; |
||||||
|
} |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,55 @@ |
|||||||
|
{if $config.useCSS == 1 }<link href="{$ABS_PATH}modules/weather/templates/css/weatherplugin.css" rel="stylesheet" type="text/css"/>{/if} |
||||||
|
<div class="side-widget mweather c-margin-t-30"> |
||||||
|
<div class="WeatherPlugin {$config.view}"> |
||||||
|
<h2>{$weather.city}</h2> |
||||||
|
{if $config.view != "forecast" } |
||||||
|
<div class="wiToday"> |
||||||
|
<div class="wiIconGroup"> |
||||||
|
<div class="wi wi{$weather.today.code}"></div> |
||||||
|
<p class="wiText">{$weather.today.desc}</p> |
||||||
|
</div> |
||||||
|
<p class="wiTemperature">{$weather.today.temp.now}<sup>{$degrees}</sup></p> |
||||||
|
{if $config.view != "simple" } |
||||||
|
<div class="wiDetail"> |
||||||
|
{if $config.view == "partial" } |
||||||
|
<p class="wiDay">{$weather.today.day}</p> |
||||||
|
{/if} |
||||||
|
{if $config.view != "partial" } |
||||||
|
{if $config.view != "today"}<p class="wiDay">{$weather.today.day}</p>{/if} |
||||||
|
<ul class="astronomy"> |
||||||
|
<li class="wi sunrise">{$weather.today.sunrise}</li> |
||||||
|
<li class="wi sunset">{$weather.today.sunset}</li> |
||||||
|
</ul> |
||||||
|
<ul class="temp"> |
||||||
|
<li>Max: {$weather.today.temp.max}<sup>{$degrees}</sup></li> |
||||||
|
<li>Min: {$weather.today.temp.min}<sup>{$degrees}</sup></li> |
||||||
|
</ul> |
||||||
|
<ul class="atmosphere"> |
||||||
|
<li class="wi humidity">{$weather.today.humidity}</li> |
||||||
|
<li class="wi pressure">{$weather.today.pressure}</li> |
||||||
|
<li class="wi wind">{$format_wind}</li> |
||||||
|
</ul> |
||||||
|
{/if} |
||||||
|
</div> |
||||||
|
{/if} |
||||||
|
</div> |
||||||
|
{/if} |
||||||
|
{if $config.view != "simple" } |
||||||
|
{if ($config.view != "today" ) ||($config.view == "forecast") } |
||||||
|
<ul class="wiForecasts"> |
||||||
|
|
||||||
|
{if $config.view == "forecast" }{assign var=startingIndex value=0}{else}{assign var=startingIndex value=1}{/if} |
||||||
|
{section name=i start=$startingIndex loop=$weather.forecast step=1} |
||||||
|
<li class="wiDay"><span>{$weather.forecast[i].day}</span> |
||||||
|
<ul class="wiForecast"> |
||||||
|
<li class="wi wi{$weather.forecast[i].code}"></li> |
||||||
|
<li class="wiMax">{$weather.forecast[i].temp.max}<sup>{$degrees}</sup></li> |
||||||
|
<li class="wiMin">{$weather.forecast[i].temp.min}<sup>{$degrees}</sup></li> |
||||||
|
</ul> |
||||||
|
</li> |
||||||
|
{/section} |
||||||
|
</ul> |
||||||
|
{/if} |
||||||
|
{/if} |
||||||
|
</div> |
||||||
|
</div> |
Loading…
Reference in new issue