<?php include_once('livedata.php');?>

<div class="updatedtime"><span>Updated</span> <?php 
$date = new DateTime('now', new DateTimeZone($TZ));
 echo $date->format('H:i:s');
?> </div>
                 <br />
                              <!-- add actual UV forecast value from Wunderground hourly forecast for those who don't have UV sensor. 
	This forecast value has great accuracy when compared to a real UV sensor value (usually within +/- 1 IUV) -->	

	
<?php	
$weather = file_get_contents('jsondata/hourly.json'); 
$decoded = json_decode($weather, true);
$count = 1;
foreach ($decoded['hourly_forecast'] as $value)
{$count++;  
   	$uvi = $value ['uvi'];   	
	if ($count > 1)
        break;
}?>

<style>
/* flex webkit usage homeweatherstation css Moday 25th April 2016 */
uvi {
    font-size: 11px;
    text-align: center;
    margin: 35px auto 0 -32px;
    position: absolute;
	line-height:10px;
	width:25px;
	position: absolute;
	
}

uviforecast 
{
    font-size: 11px;
    text-align: center;
    margin: -5px auto 0 5px;
    position: absolute;
	line-height:10px;
	width:30px;
}
.uvi01, .uvi03, .uvi35, .uvi67, .uvi810, .uvi1112 {
    padding-top: 20px;
    font: 1.7em Helvetica, Arial, Helvetica ;
	color: #fff;
    margin-top: -25px;
    border-radius: 50%;
    margin-left: 20px;
	border: 5px solid rgba(233, 235, 241, 1);
	width:90px;
	height:90px;
	text-align:center;
	line-height:40px;
	
	
	
}

.uvi01 span{
   position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-15px;
	
	
}

.uvi01 p{
   
    font-size:11px;
	margin-top:-20px;
	
	
	
}
.uvi03 span{
   position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-15px;
	
}

.uvi03 p{
  
    font-size:11px;
	margin-top:-20px;
	
	
}
.uvi35 span{
   position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-15px;
	
}

.uvi35 p{
  
    font-size:11px;
	margin-top:-20px;
	
	
}

.uvi67 span{
   position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-15px;
	width:20px;
	
}

.uvi67 p{
   margin-top:-20px;
    font-size:11px;
	
	
}
.uvi810 span{
	position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-15px;
	
	
}

.uvi810 p{
	
    margin-top:-20px;
    font-size:11px;
	
	
	
}

.uvi1112 span{
    position:absolute;
    font-size:11px;
	margin-top:-17px;
	margin-left:-10px;
	
	
}

.uvi1112 p{
   margin-top:-20px;
    font-size:11px;
	
	
}

.uvi01 {
    background: rgba(78, 90, 105, 1)
}



.uvi03 {
   
    background: rgba(79, 184, 123, 1)
}

.uvi35 {
   
    background: rgba(238, 166, 89, 1);
   
}

.uvi67 {
   
    background: rgba(238, 114, 89, 1)
}

.uvi810 {
   
    background: rgba(209, 94, 82, 1);
	 
	
}

.uvi1112 {
    background: rgba(148, 81, 136, 1);
   
	
}

.uvitext color {
    font-weight: 600
}

.solarfcircle {
    position: absolute;
    color: rgba(95,96,97,0.8);
    margin-top: -40px;
    border-radius: 100%;
    -moz-border-radius: 100%;
    -webkit-border-radius: 100%;
    height: 70px;
    width: 70px;
    margin-left: 170px;
    border: 3px solid rgba(233, 235, 241, 1);
    padding-top: 23px;
    background: #fff;
    font:600 1em Helvetica, Helvetica, Arial, Helvetica;
	line-height:12px;
}

.solarfcircle span {
    color: #F26C4F;
    text-align: center;
    font: 600 .7em / 10px Helvetica, Helvetica, Arial, Helvetica
}

.uvisup {
    font-size: 14px;
    color: #F26C4F
}

.uvitext {
    color: rgba(95,96,97,0.8);
    float: left;
    width: 150px;
    margin-left: 130px;
    margin-top: -85px;
    font: .9em / 1em Helvetica, Helvetica, Arial, Helvetica
}

.uvtext color, .uvtext color2 {
    font-size: 1em;
    color: #F26C4F;line-height:15px;
}

.uvfooter {
    position: relative;
    margin-top: 110px;
    text-align: center
}
</style>				
<!-- end of UV forecast from hourly.json -->
		
                              <span style="font-size:0px;">
							  
							  
							  
<?php

// $cumulus[43] was replaced by $uvi on all following lines of original template
// exemple:  echo "${cumulus[43] }</span> \n"; was replaced with:					  
							  
echo "$uvi</span> \n";
if ($uvi <= 0) {
    echo "<div class=\"uvi01\"><span>Forecast</span> $uvi<p>UVI</div><div class=\"uvtext\">No <color>caution</color> required for next hour</div>";
} else if ($uvi < 1) {
    echo "<div class=\"uvi01\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">No <color>caution</color> required for next hour</div>";
} else if ($uvi < 2) {
    echo "<div class=\"uvi03\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Wear <color>sunglasses</color> for next hour </div>";
} else if ($uvi < 3) {
    echo "<div class=\"uvi03\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Wear <color>sunglasses</color> for next hour </div>";
} else if ($uvi < 4) {
    echo "<div class=\"uvi35\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Stay in the shade for next hour when the <color> sun</color> is strongest</div>";
} else if ($uvi < 5) {
    echo "<div class=\"uvi35\"><span>Forecast</span>$uvi<p>UVI<p>UVI</div><div class=\"uvtext\">Stay in the shade for next hour when the <color> sun</color> is strongest</div>";
} else if ($uvi < 6) {
    echo "<div class=\"uvi35\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Stay in the shade for next hour when the <color> sun</color> is strongest</div>";
} else if ($uvi < 7) {
    echo "<div class=\"uvi67\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Reduce time in the <color> sun</color> for next hour</div>";
} else if ($uvi < 8) {
    echo "<div class=\"uvi67\"><span>Forecast</span>$uvi <p>UVI</div><div class=\"uvtext\">Reduce time in the <color> sun</color> for next hour</div>";
} else if ($uvi < 9) {
    echo "<div class=\"uvi810\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Minimize <color> sun</color> exposure for next hour</div>";
} else if ($uvi < 10) {
    echo "<div class=\"uvi810\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Minimize <color> sun</color> exposure for next hour</div>";
} else if ($uvi < 11) {
    echo "<div class=\"uvi810\"><span>&nbsp;&nbsp;Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Minimize <color> sun</color> exposure for next hour</div>";
} else if ($uvi < 12) {
    echo "<div class=\"uvi1112\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Try to avoid<color> sun</color> exposure for next hour</div>";
} else if ($uvi < 13) {
    echo "<div class=\"uvi1112\"><span>Forecast</span>$uvi<p>UVI</div><div class=\"uvtext\">Try to avoid<color> sun</color> exposure for next hour</div>";
}
?> 
 <!-- solar radiation for homeweather station-->
 </span>
   
<!-- SOLAR --> 
<?php echo "";
//solar radiation homeweatherstation for cumulus output
if ($cumulus[45] >500){echo "<div class=\"solarcircle\">${cumulus[45]}<br><span>W/m&sup2</span></div><div class=\"solatext\">Solar Radiation<br><color>Good</color></div>";}
else if ($cumulus[45] >300){echo "<div class=\"solarcircle1\">${cumulus[45]}<br><span>W/m&sup2</span></div><div class=\"solatext\">Solar Radiation<br><color1>Moderate</color1></div>";}
else if ($cumulus[45] >150){echo "<div class=\"solarcircle2\">${cumulus[45]}<br><span>W/m&sup2</span></div><div class=\"solatext\">Solar Radiation<br><color2>Low</color2></div>";}
else if ($cumulus[45] <150){echo "<div class=\"solarcircle3\">${cumulus[45]}<br><span>W/m&sup2</span></div><div class=\"solatext\">Solar Radiation<br><color3>Poor</color3></div>";}
?>
</span>
</span>
</div>


