<?php
$tpl_version = "1.3";
if (isset($_GET['ver'])) {
  echo $tpl_version;
  exit;
	// Date: 2014-12-25
}
session_start(); // start PHP session
// Check if a language has been selected
if (isset($_POST['langue'])) {
  $lang = $_POST['langue'];
  $_SESSION['langue'] = $lang; // store session data
}
elseif(isset($_SESSION['langue'])){
  $lang = $_SESSION['langue']; // Default language
}
else {
  $lang = 'en'; // Default language
  $_SESSION['langue'] = $lang;
}
// Include text and data file
require('lang/text_standard_en.php');  // Fall-back language: English
require('lang/text_standard_'.$lang.'.php');
include('wt_data_inc.php');

// If you have Davis Evapotranspiration
if ((intval($ET)== 0) AND ($solarTH=="0") AND ($solarYH=="0") AND ($RecentSolarRad=="0")) {
	$sensor_solar = FALSE;
	$sensor_et = FALSE;
}
else {
	$sensor_solar = TRUE;
	if ($DavisTotalPacketsReceived == "0")
		$sensor_et = FALSE;
	else
		$sensor_et = TRUE;
}

	echo "<h1>$TT_today</h1>";
  echo "<table summary=\"Rollover time\">\n<tr>\n".'<td  style="font-size: 100%">'.$Tr_rollovertime_24h."\n</td>\n<td style=\"width:60px\"><strong>$rollovertime</strong></td><td>"; 
  echo $Tr_localtime."</td></tr>\n</table>\n"; 
?>
<!-- WEATHER DATA BEGIN -->
<table id="tbl_3cols" border="0" cellpadding="0" cellspacing="0" summary="Observations for today">
<col width="350px" />
<col width="200px" />
<col width="125px" />
<tr>
	<td colspan="3" class="tableseparator"><?php echo $TT_TempAndHum; ?></td>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_tempTH.'</td><td>'.$tempTH.' '.$tempunit.'</td><td>'.$TtempTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_tempTL.'</td><td>'.$tempTL.' '.$tempunit.'</td><td>'.$TtempTLF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_temprange.'</td><td>'.$temprange.$tempunit.'</td><td>&nbsp;</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_apptempTH.'</td><td>'.$apptempTH.' '.$tempunit.'</td><td>'.$TapptempTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_apptempTL.'</td><td>'.$apptempTL.' '.$tempunit.'</td><td>'.$TapptempTLF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_heatindexTH.'</td><td>'.$heatindexTH.' '.$tempunit.'</td><td>'.$TheatindexTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_wchillTL.'</td><td>'.$wchillTL.' '.$tempunit.'</td><td>'.$TwchillTLF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_dewpointTH.'</td><td>'.$dewpointTH.' '.$tempunit.'</td><td>'.$TdewpointTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_dewpointTL.'</td><td>'.$dewpointTL.' '.$tempunit.'</td><td>'.$TdewpointTLF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_humTH.'</td><td>'.$humTH.'%</td><td>'.$ThumTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_humTL.'</td><td>'.$humTL.'%</td><td>'.$ThumTLF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_heatdegdays.'</td><td>'.$heatdegdays.'</td><td>&nbsp;</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_cooldegdays.'</td><td>'.$cooldegdays.'</td><td>&nbsp;</td>'; ?>
</tr>
	<?php 
	if ($sensor_solar == TRUE) {
		echo '<tr class="td_data"><td>'.$Tr_SunshineHours.'</td><td>'.$SunshineHours.'</td><td>&nbsp;</td></tr>';
		echo '<tr class="td_data"><td>'.$Tr_SolarRad.'</td><td>'.$solarTH.'</td><td>'.$TsolarTHF.'</td></tr>';
		echo '<tr class="td_data"><td>'.$Tr_UV.'</td><td>'.$UVTH.'</td><td>'.$TUVTHF.'</td></tr>';
	if ($sensor_et == TRUE)
		echo '<tr class="td_data"><td>'.$Tr_ET.'</td><td>'.$ET.' '.$rainunit.'</td></tr>';
	}
	?>
<tr>
	<td colspan="3" class="tableseparator"><?php echo $TT_Rainfall; ?></td>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_rrateTM.'</td><td>'.$rrateTM.' '.$rainunit.'/hr</td><td>'.$TrrateTMF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_hourlyrainTH.'</td><td>'.$hourlyrainTH.' '.$rainunit.'</td><td>'.$ThourlyrainTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_ConsecutiveRainDays.'</td><td>'.$ConsecutiveRainDays.' '.$TT_day.'</td><td>&nbsp;</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_ConsecutiveDryDays.'</td><td>'.$ConsecutiveDryDays.' '.$TT_day.'</td><td>&nbsp;</td>'; ?>
</tr><tr>
	<td colspan="3" class="tableseparator"><?php echo $TT_Wind; ?></td>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_wgustTM.'</td><td>'.$wgustTM.' '.$windunit.'/hr</td><td>'.$TwgustTMF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_windTM.'</td><td>'.$windTM.' '.$windunit.' ('.$Tbeaufort.')</td><td>'.$TwindTMF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_bearingTM.'</td><td>'.$bearingTM.'&deg;</td><td>'.$TwgustTMF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_domwindbearing.'</td><td>'.$domwinddir.'</td><td>&nbsp;</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_windrun.'</td><td>'.$windrun.' '.$windrununit.'</td><td>&nbsp;</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_beaufort.'</td><td>'.$Tbeaufort.'</td><td>'.$Tbeaudesc.'</td>'; ?>
</tr><tr>
	<td colspan="3" class="tableseparator"><?php echo $TT_Press; ?></td>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_pressTH.'</td><td>'.$pressTH.' '.$pressunit.'</td><td>'.$TpressTHF.'</td>'; ?>
</tr><tr class="td_data">
	<?php echo '<td>'.$Tr_pressTL.'</td><td>'.$pressTL.' '.$pressunit.'</td><td>'.$TpressTLF.'</td>'; ?>
</tr>
</table>
