<?php
/*
+---------------------------------------------------------------------+
| |
| SensorAndSwitch |
| Pseudo-Script |
| =============================================================== |
| Info |
| |
+---------------------------------------------------------------------+
*/
error_reporting(0);
include __DIR__."/../include/psg.php";
$ver="V#V 4.55#";
$name="Fritz!Box CPU";
$gerarray=getGerInfo($name);
$tempz=unserialize($gerarray["tempz"]);
$info ="";
# 10°C-Linien
for ($g=0;$g<=10;$g++) {
$l=$g*10+1;
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$l.'px;background-color:rgb(80,80,80);border-style:solid;border-color:black;left:30px;width:485px;height:1px"></div>';
$info.='<div id="tab" style="position:absolute;border:1px;top:'.($l-4).'px;left:0px;font-size:10px;width:30px;text-align:right">'.(100-$g*10).'°C</div>';
}
# 5°C-Linien
for ($g=0;$g<=9;$g++) {
$l=$g*10+6;
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$l.'px;background-color:rgb(60,60,60);border-style:solid;border-color:black;left:30px;width:485px;height:1px"></div>';
}
# Markierung akt. Stunde
for ($z=0;$z<=23;$z++) {
$h=113;
$t=1;
$p=$z*20+5+30;
if ($z==$gerarray["zeith"]) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.($p-2).'px;background-color:rgb(80,80,80);border-style:solid;border-color:rgb(80,80,80);font-size:8px;width:19px;height:'.$h.'px"></div>';
}
}
# Tempsäulen
for ($z=0;$z<=23;$z++) {
$h=$tempz[$z]["max"]-$tempz[$z]["min"];
$h0=$tempz[$z]["max"];
$t=100+1-$tempz[$z]["max"];
$t0=$t;
$p=$z*20+5+30;
$f=120;if ($z<=$gerarray["zeith"]) {$f=200;}
$f0=100;if ($z<=$gerarray["zeith"]) {$f0=140;}
if ($h0<0) {$t=50+7; $h0=$h0*-1; $t0=50+7;}
if (isset($tempz[$z]["max"])) {
if ($tempz[$z]["max"]>=80) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb('.$f0.',0,0);border-style:solid;border-color:rgb('.$f0.',0,0);font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if (isset($tempz[$z]["max"])) {
if ($tempz[$z]["max"]>=70) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb('.($f0/1).','.($f0/2).',0);border-style:solid;border-color:rgb('.($f0/1).','.($f0/2).',0);font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if ($tempz[$z]["max"]>=60) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb('.($f0/1).','.($f0/1).',0);border-style:solid;border-color:rgb('.($f0/1).','.($f0/1).',0);font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if ($tempz[$z]["max"]>=50) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb(0,'.$f0.',0);border-style:solid;border-color:rgb(0,'.$f0.',0);font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if ($tempz[$z]["max"]>=40) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb(0,'.($f0/1).','.($f0/2).');border-style:solid;border-color:rgb(0,'.($f0/1).','.($f0/2).');font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if ($tempz[$z]["max"]>=30) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb(0,'.($f0/1).','.($f0/1).');border-style:solid;border-color:rgb(0,'.($f0/1).','.($f0/1).');font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
if ($tempz[$z]["max"]>=20) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb(0,'.($f0/2).','.($f0/1).');border-style:solid;border-color:rgb(0,'.($f0/2).','.($f0/1).');font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
else {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t.'px;left:'.$p.'px;background-color:rgb(0,0,'.($f0/1).');border-style:solid;border-color:rgb(0,0,'.($f0/1).');font-size:8px;width:15px;height:'.$h0.'px"></div>';
}
}
}
}
}
}
}
}
}
}
# Rest
for ($z=0;$z<=23;$z++) {
if ($z<=$gerarray["zeith"]) {
if ($tempz[$z]["min"]<$tempz[24]["min"] or !isset($tempz[24]["min"])) {
if (isset($tempz[$z]["min"])) {
$tempz[24]["min"]=$tempz[$z]["min"];
$tempz[24]["minh"]=$z;
}
}
if ($tempz[$z]["max"]>$tempz[24]["max"] or !isset($tempz[24]["max"])) {
if (isset($tempz[$z]["max"])) {
$tempz[24]["max"]=$tempz[$z]["max"];
$tempz[24]["maxh"]=$z;
}
}
}
$h=$tempz[$z]["max"]-$tempz[$z]["min"];
$h0=$tempz[$z]["max"];
$t=100+1-$tempz[$z]["max"];
$t0=$t;
$p=$z*20+5+30;
$f=120;if ($z<=$gerarray["zeith"]) {$f=200;}
$f0=100;if ($z<=$gerarray["zeith"]) {$f0=140;}
if ($h0<0) {$t=50+7; $h0=$h0*-1; $t0=$tempz[$z]["max"]*-1+50+7;}
# Zeitskala
$info.='<div id="tab" style="position:absolute;border:1px;top:'.(103).'px;left:'.$p.'px;font-size:7px;width:15px;text-align:center">'.$z.'h</div>';
# Werte
if (isset($tempz[$z]["max"])) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.$t0.'px;left:'.$p.'px;background-color:rgb(0,'.$f.','.$f.');border-style:solid;border-color:rgb(0,'.$f.','.$f.');font-size:8px;width:15px;height:'.$h.'px"></div>';
if ($tempz[$z]["max"]>80) {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.(83).'px;left:'.$p.'px;width:15px;text-align:center;font-size:8px;text-shadow:0px 0px 1px black,0px 0px 1px black,0px 0px 1px black;">'.number_format(sprintf('%.1f',$tempz[$z]["max"]),1,",",".").'</div>';
$info.='<div id="tab" style="position:absolute;border:1px;top:'.(92).'px;left:'.$p.'px;width:15px;text-align:center;font-size:8px;text-shadow:0px 0px 1px black,0px 0px 1px black,0px 0px 1px black;">'.number_format(sprintf('%.1f',$tempz[$z]["min"]),1,",",".").'</div>';
}
else {
$info.='<div id="tab" style="position:absolute;border:1px;top:'.(3).'px;left:'.$p.'px;width:15px;text-align:center;font-size:8px;text-shadow:0px 0px 1px black,0px 0px 1px black,0px 0px 1px black;">'.number_format(sprintf('%.1f',$tempz[$z]["max"]),1,",",".").'</div>';
$info.='<div id="tab" style="position:absolute;border:1px;top:'.(12).'px;left:'.$p.'px;width:15px;text-align:center;font-size:8px;text-shadow:0px 0px 1px black,0px 0px 1px black,0px 0px 1px black;">'.number_format(sprintf('%.1f',$tempz[$z]["min"]),1,",",".").'</div>';
}
}
}
$zh=$gerarray["zeith"];
$zvh=$zh-1;
if ($zvh<0) {$zvh=23;}
$pfeil="⇒";
$w=($tempz[$zh]["max"]+$tempz[$zh]["min"])/2;
$wv=($tempz[$zvh]["max"]+$tempz[$zvh]["min"])/2;
if ($wv>$w) {$pfeil='⇓';}
if ($wv<$w) {$pfeil='⇑';}
$info.='<div id="text" style="position:absolute;border:1px;top:0px;left:520px;text-align:left;width:90px;font-size:30px;">'.$pfeil.'</div>';
$info.='<div id="text" style="position:absolute;border:1px;top:0px;left:520px;text-align:right;width:90px;font-size:12px;">CPU-<br />Temp.</div>';
$info.='<div id="text" style="position:absolute;border:1px;top:35px;left:520px;text-align:right;width:90px;font-size:20px;">'.number_format(sprintf('%.1f',$tempz[24]["max"]),1,",",".").'°C</div>';
$info.='<div id="text" style="position:absolute;border:1px;top:55px;left:520px;text-align:right;width:90px;font-size:12px;">('.$tempz[24]["maxh"].'h) max.</div>';
$info.='<div id="text" style="position:absolute;border:1px;top:70px;left:520px;text-align:right;width:90px;font-size:20px;">'.number_format(sprintf('%.1f',$tempz[24]["min"]),1,",",".").'°C</div>';
$info.='<div id="text" style="position:absolute;border:1px;top:90px;left:520px;text-align:right;width:90px;font-size:12px;">('.$tempz[24]["minh"].'h) min.</div>';
echo 'IB#<div style="position:absolute;left:85px;top:0px;">'.$info.'</div>#'.$ver;
?>