<html>
<head>
<title>Oxman Capsule Corp</title>
<style type="text/css">

:root {
--generalbg: #000000;
--tilebg: #262626;
--grid: #676767;
--text: #ffffff;
--alarmbg: #ff0000;
}

@font-face {
font-family: 'NHG-Display-Light';
src: url('fonts/NeueHaasDisplayLight.ttf') format('truetype');
}
@font-face {
font-family: 'NHG-Display-Thin';
src: url('fonts/NeueHaasDisplayThin.ttf') format('truetype');
}
@font-face {
font-family: 'NHG-Display-Extra-Thin';
src: url('fonts/NeueHaasDisplayXThin.ttf') format('truetype');
}
@font-face {
font-family: 'NHG-Display-Roman';
src: url('fonts/NeueHaasDisplayRoman.ttf') format('truetype');
}

.header {
font-family: "NHG-Display-Thin";
font-weight: thin;
font-size: 8.352941176471vh;
}

.label {
font-family: "NHG-Display-Roman";
font-weight: roman;
font-size: 1.058823529412vh;
font-height: 1.270588235294vh;
vertical-align:top;
}

.primary {
font-family: "NHG-Display-Light";
font-weight: lighter;
font-size: 4.941176470588vh;
float: right;
}

body {
background-color:var(--generalbg);
color:var(--text);
font-family: "NHG-Display-Light";
}
.table{
display:grid;
grid-template-columns: 50% 50%;
width:100%;
height:100%;
}
.cell{
display:table-cell;
}
.tile{
background-color: var(--tilebg);
margin: 0.665674680867vh;
padding: 1.331349361735vh;
}

/*
.header {
font-family: "NHG-Display-Thin";
font-weight: thin;
font-size: 120pt;
}

.label {
font-family: "NHG-Display-Roman";
font-weight: roman;
font-size: 15pt;
font-height: 18pt;
vertical-align:top;
}

.primary {
font-family: "NHG-Display-Light";
font-weight: lighter;
font-size: 70pt;
float: right;
}

body {
background-color:var(--generalbg);
color:var(--text);
font-family: "NHG-Display-Light";
}
.table{
display:grid;
grid-template-columns: 50% 50%;
width:100%;
height:100%;
}
.cell{
display:table-cell;
margin: 28px;
padding: 8px;
}
.tile{
background-color: var(--tilebg);
}
table {
width: 100%;
table-layout: fixed;
height:100%;
font-size: 48px;
font-weight: 100!important;
}
.title {
width:100%;
border-top: 1px solid white;
padding:0;
margin:0;
vertical-align:top;
}
tr {
height: 11.1%;
overflow: hidden;
}
td {
width:50%;
position:relative;
border-top: 1px solid white;
padding:0;
margin:0;
vertical-align:top;
}
.bottom {
border-bottom: 1px solid white;
}
.graph {
vertical-align:middle;
text-align:center;
}
div {
display:inline-block;
}
sup {
width:30%;
font-size: 12px;
}
.right {
vertical-align:super;
float:right;
font-size: 12px;
}
.header {
position:absolute;
left:30%;
}
img {
width: 100%;
height: 100%;
}
*/

</style>
</head>
<body>
<?php
$ip="216.51.189.91";
$ip="10.2.0.5"; //For testing, comment out.
$ch=curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_URL,$ip."/read_data.xml?Cmd=read&Tag=Real_Time_Hour&Tag=Real_Time_Minute&Tag=PV_1&Tag=CM_SP_1_Manual&Tag=PV_2&Tag=CM_SP_2_Manual&Tag=PV_3&Tag=CM_SP_3_Manual&Tag=CM_NON_RAMPING_MODE&Tag=Programmed_Lights&Tag=Programmed_Lights_On&Tag=Limit2_PV");
$xml=curl_exec($ch);
$simplexml = new SimpleXMLElement($xml);
foreach($simplexml as $element => $value) {
    $$element = (string)$value;
}
curl_setopt($ch,CURLOPT_URL,$ip."/alarm_status.xml?Cmd=read&Item=menu");
$xml=curl_exec($ch);
$simplexml = new SimpleXMLElement($xml);
foreach($simplexml as $element => $value) {
    $$element = (string)$value;
}
curl_close($ch);
$str="";
$str.="<div class='table'>";
$str.="<div class='cell header'>Capsule 1</div>";
$str.="<div class='cell'><span class='label'>Time</span><span class='primary'>".$Real_Time_Hour.":".$Real_Time_Minute."</span></div>";
$str.="";
$str.="<div class='cell'><!--This space intentionally left blank--></div>";
$str.="<div class='cell'><span class='label'>TEMP LAST SIX HOURS</span><span class='label' style='float:right;'>HUM LAST SIX HOURS</span></div>";
$str.="";
$str.="<div class='cell tile'><span class='label'>MODE</span><span class='primary'>".$CM_NON_RAMPING_MODE."</span></div>";
$str.="<div class='cell tile' style='grid-row:span 6;'>GRAPH</div>";
if($Programmed_Lights==0) {
	$str.="<div class='cell tile'><span class='label'>LIGHTS</span><span class='primary'>OFF</span></div>";
} else if($Programmed_Lights==$Programmed_Lights_On) {
	//Just in case we need some differentiation in light levels of some kind in the future...
	$str.="<div class='cell tile'><span class='label'>LIGHTS</span><span class='primary'>ON</span></div>";
} else {
	$str.="<div class='cell tile'><span class='label'>LIGHTS</span><span class='primary'>ON</span></div>";
};
$str.="<div class='cell tile'><span class='label'>TEMPERATURE<BR>SP:".$CM_SP_1_Manual."</span><span class='primary'>".$PV_1."</span></div>";
$str.="<div class='cell tile'><span class='label'>LIMIT 2</span><span class='primary'>".$Limit2_PV."</span></div>";
$str.="<div class='cell tile'><span class='label'>RELATIVE HUMIDITY<BR>SP:".$CM_SP_2_Manual."</span><span class='primary'>".$PV_2."</span></div>";
$str.="<div class='cell tile'><span class='label'>CO2<BR>SP:".$CM_SP_3_Manual."PPM</span><span class='primary'>".$PV_3."PPM</span></div>";
$str.="<div class='cell'><!--This space intentionally left blank--></div>";
$str.="<div class='cell'><span class='label' style='float:right;'>TEMPERATURE ----- RELATIVE HUMIDITY --  --  --  --</span></div>";
$str.="</div>";
echo $str;
//echo "<table>";
//echo "<tr>";
//echo "<td colspan='2' rowspan='1' class='title'>Capsule 01</td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>TIME</sup><div class='header'>".$Real_Time_Hour.":".$Real_Time_Minute."</div></td>";
//echo "<td><sup>TEMPERATURE<!--TODO--> LAST 6 HOURS</sup><div class='right'><!--TODO-->TEMP INPUT PROCESS<!--TODO--> TEMP INPUT SET POINT</div></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>MODE</sup><div class='header'>$CM_NON_RAMPING_MODE</div></td>";
//echo "<td rowspan='7' class='bottom graph'>";
//
////include_once("lib/classes/pChart/pColor.php"); 
////include_once("lib/classes/pChart/pDraw.php"); 
////include_once("lib/classes/pChart/pCharts.php");
////use pChart\pColor;
////use pChart\pDraw;
////use pChart\pCharts;
////$PVs=array(23.9,24,23.9,24.1,24);
////$SPs=array(24,24,24,24,20);
////$time=array("12PM","1PM","2PM","3PM","4PM");
////    /* Create your dataset object */ 
////    $myPicture= new pDraw(700,600); 
////    /* Add data in your dataset */ 
////    $myPicture->myData->addPoints($PVs,"Temp PVs");
////    $myPicture->myData->addPoints($SPs,"Temp SPs");
////    $myPicture->myData->addPoints($time,"Times");
////    $myPicture->myData->setAbscissa("Times");
////    //$myPicture->myData->setXAxisDisplay(AXIS_FORMAT_TIME);
////    $myPicture->myData->setPalette("Temp PVs",new pColor(255,255,255,255));//(255,0,0,255));//logger temp is red.
////    $myPicture->myData->setPalette("Temp SPs",new pColor(80,80,80,255));//(0,255,0,255));//logger RH is green.
////    /*
////    $seriesSettings=array("R"=>230,"G"=>0,"B"=>0,'Alpha'=>80);
////    $myPicture->myData->setPalette("Ambient Temp",$seriesSettings);
////    $seriesSettings=array("R"=>0,"G"=>0,"B"=>230,'Alpha'=>80);
////    $myPicture->myData->setPalette("Ambient RH",$seriesSettings);
////     */
////    /* Create a pChart object and associate your dataset */ 
////    //$myPicture = new pImage(1024,520,$myData);
////    /* Choose a nice font */
////    $myPicture->setFontProperties(array("FontName"=>"lib/fonts/CenturyGothic.ttf","FontSize"=>11));
////    /* Define the boundaries of the graph area */
////    $myPicture->setGraphArea(50,50,550,550);
////    $myPicture ->drawFilledRectangle(0,0,700,600,["Color"=>new pColor(0,0,0,100)]);
////    /* Draw guide lines */
////    /*
////    for($y=50;$y<950;$y=$y+5) {
////	    $myPicture->drawLine(50,$y,950,$y,["Color"=>new pColor(0,200,200,40),"Ticks"=>0]);
////    };
////    for($y=50;$y<950;$y=$y+39) {
////	    $myPicture->drawLine($y,50,$y,950,["Color"=>new pColor(0,200,200,40),"Ticks"=>0]);
////    };
////     */
////    /*Set axis boundaries*/
////    $axisBoundaries=array(0=>array("Min"=>-15,"Max"=>100));
////    /* Draw the scale, keep everything automatic */ 
////	//echo $n;
////    //$labelSkip=intval($n/30);
////    $labelSkip=1;
////    $labelSkip=0;
////    $myPicture->drawScale(array("Mode"=>SCALE_MODE_MANUAL,"GridTicks"=>0,"ManualScale"=>$axisBoundaries,"GridR"=>40,"GridG"=>40,"GridB"=>40,"LabelSkip"=>$labelSkip,"LabelRotation"=>0,"DrawYLines"=>ALL,"CycleBackground"=>TRUE,"BackgroundColor1"=>new pColor(20,20,20,255),"BackgroundColor2"=>new pColor(20,20,20,255),"AxisColor"=>new pColor(255,255,255,255)));
////    /* Draw the scale, keep everything automatic */ 
////    $pCharts= new pCharts($myPicture);
////    $pCharts->drawSplineChart();
////    /* Render the picture (choose the best way) */
////    $myPicture->Render("temp.png");
//
//echo "<img src='temp.png'></td>";
//echo "</tr>";
//echo "<tr>";
//if($Programmed_Lights==0) {
//echo "<td><sup>LIGHTS</sup><div class='header'>OFF</div></td>";
//} else if($Programmed_Lights==$Programmed_Lights_On) {
//echo "<td><sup>LIGHTS</sup><div class='header'>ON</div></td>";
//} else {
//echo "<td><sup>LIGHTS</sup><div class='header'>ON</div></td>";
//};
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>TEMPERATURE<br>SP:$CM_SP_1_Manual</sup><div class='header'>$PV_1</div></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>RELATIVE HUMIDITY<br>SP:$CM_SP_2_Manual</sup><div class='header'>$PV_2</div></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>CO2<br>SP:$CM_SP_3_Manual</sup><div class='header'>$PV_3</div></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td><sup>ALARM</sup><div class='header'>";
//if( $Lifetime_Alarm=="Off"&& $Deviation_High=="Off"&& $Deviation_Low=="Off"&& $Temp_Limit2_High=="Off"&& $Temp_Limit2_Low=="Off"&& $Temp_Safety_High=="Off"&& $Temp_Safety_Low=="Off"&& $Temp_Soft_High=="Off"&& $Temp_Soft_Low=="Off"&& $RH_Soft_High=="Off"&& $RH_Soft_Low=="Off"&& $Aux_Soft_High=="Off"&& $Aux_Soft_Low=="Off" ) {
//	echo "No Alarms";
//}; 
//if($Lifetime_Alarm!="Off") {
//	echo "Lifetime Alarm</BR>";
//};
//if($Deviation_High!="Off") {
//	echo "Deviation High</BR>";
//};
//if($Deviation_Low!="Off") {
//	echo "Deviation Low</BR>";
//};
//if($Temp_Limit2_High!="Off") {
//	echo "Temp Limit2 High</BR>";
//};
//if($Temp_Limit2_Low!="Off") {
//	echo "Temp Limit2 Low</BR>";
//};
//if($Temp_Safety_High!="Off") {
//	echo "Temp Safety High</BR>";
//};
//if($Temp_Safety_Low!="Off") {
//	echo "Temp Safety Low</BR>";
//};
//if($Temp_Soft_High!="Off") {
//	echo "Temp Soft High</BR>";
//};
//if($Temp_Soft_Low!="Off") {
//	echo "Temp Soft Low</BR>";
//};
//if($RH_Soft_High!="Off") {
//	echo "RH Soft High</BR>";
//};
//if($RH_Soft_Low!="Off") {
//	echo "RH Soft Low</BR>";
//};
//if($Aux_Soft_High!="Off") {
//	echo "Aux Soft High</BR>";
//};
//if($Aux_Soft_Low!="Off") {
//	echo "Aux Soft Low</BR>";
//};
//echo "</div></td>";
//echo "</tr>";
//echo "<tr>";
//echo "<td class='bottom'><sup>LIMIT 2</sup><div class='header'>$Limit2_PV</div></td>";
//echo "</tr>";
//echo "</table>";
?>
</body>
</html>
