// длинный текстовый прогноз погоды
// $metcast="";
$metcast="На улице ".gg("ow_fact.weather_type").".";
// ветер
$WindSpeed=(float)gg("ow_fact.wind_speed");
if ($WindSpeed<1) { $metcast.=' Ветра, скорее всего, нет.';
} elseif ($WindSpeed<3) { $metcast.=' Возможен слабый ветер.';
} elseif ($WindSpeed<8) { $metcast.=' Возможен умеренный ветер.';
} elseif ($WindSpeed<13) { $metcast.=' Возможен сильный ветер.';
} elseif ($WindSpeed<20) { $metcast.=' Возможен довольно сильный ветер.';
} elseif ($WindSpeed<28) { $metcast.=' Возможен штормовой ветер.';
} else { $metcast.=' Ветер очень очень сильный, УРАГАН, ';
}
$w=round(strip_tags(gg("ow_fact.temperature")));
$tempw=$w;
if($w < "0"){ $tempw=abs($w); }
if($w > "0"){ $templus=" плюс "; }
if($tempw >= 11 and $tempw <= 14){ $tempcels=" градусов";}
else{
while ($tempw > 9){
$tempw=$tempw-10;
}
if($tempw == 0 or $tempw >= 5 and $tempw <= 9){ $tempcels=" градусов"; }
if($tempw == 1){ $tempcels=" градус"; }
if($tempw >= 2 and $tempw <= 4){ $tempcels=" градуса"; }
}
$metcast2.=$metcast;
$metcast.=' Температура '.gg("ow_fact.temperature").' '.$tempcels.'.';
$tm=(float)gg("ow_fact.temperature");
if ($tm<-40) { $metcast.=' Мы морозов не боимся!';
} elseif ($tm<-30) { $metcast.=' Очень холодно, оденьтесь теплее.';
} elseif ($tm<-20) { $metcast.=' Самое время есть мороженое.';
} elseif ($tm<-10) { $metcast.=' Холодновато.';
} elseif ($tm<-3) { $metcast.=' Не особо холодно.';
} elseif ($tm<3) { $metcast.=' Значит, возможно, гололёд.';
} elseif ($tm<10) { $metcast.=' Тепловато.';
} elseif ($tm<25) { $metcast.=' Тепло.';
} elseif ($tm<30) { $metcast.=' Жарко.';
} elseif ($tm>30) { $metcast.=' Ташкент.';
}
$metcast2.=' Давление '.gg("ow_fact.pressure_mmhg").' мм рт.ст.';
$metcast2.=' Влажность '.gg("ow_fact.humidity").' %';
sg('ow_fact.metcast',$metcast2);
$metcast.=' Восход солнца сегодня в '.date('H:i', gg("ow_fact.sunrise")).',';
$metcast.=' закат в '.date('H:i', gg("ow_fact.sunset")).'.';
$metcast.=' долгота дня '.date('H:i', getGlobal('ow_fact.day_length')).'.';
sg('ow_fact.WeatherDnes',$metcast);
/////-------------------///
// Запишем параметры в объект ThisComputer
sg("ThisComputer.weatherFull",$metcast);
sg("ThisComputer.TempOutside",$w);
sg("ThisComputer.HumOutside",gg("ow_fact.humidity"));
sg("ThisComputer.SunSetTime",gg("ow_fact.sunset"));
sg("ThisComputer.SunRiseTime",gg("ow_fact.sunrise"));
// КОНЕЦ ОСНОВНОГО БЛОКА
// Функция - добавления "+" к положительной температуре
function getTempSign($temp)
{
$temp = (int)$temp;
return $temp > 0 ? '+'.$temp : $temp;
}
// Функция - получить направления ветра в МАССИВ
function getWindDirection($wind)
{
$wind = (string)$wind;
$wind_direction = array('s'=>'↑ ю',
'n'=>'↓ с',
'w'=>'→ з',
'e'=>'← в',
'sw'=>'↗ юз',
'se'=>'↖ юв',
'nw'=>'↘ сз',
'ne'=>'↙ св');
$wind_dirtxt = array('s'=>'южный',
'n'=>'северный',
'w'=>'западный',
'e'=>'восточный',
'sw'=>'юго-западный',
'se'=>'юго-восточный',
'nw'=>'северо-западный',
'ne'=>'северо-восточный');
return array ($wind_direction[$wind], $wind_dirtxt[$wind]);
}
// Функция - получить локализованный день недели
function getDayDate($date)
{
$date = strtotime($date);
// $months = array('','января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря');
$days = array('ВС','ПН', 'ВТ', 'СР', 'ЧТ', 'ПТ', 'СБ');
// return $days[date('w', $date)].', '.(int)date('d',$date).' '.$months[date('n', $date)].' '.date('y',$date).' г.';
return $days[date('w', $date)];
}