<html>
<head>

<title>KATRIN Spectrometer and Detector Section Status Value List</title>

<style type="text/css">
    body      { font-family:Calibri,Arial; }
    a:link    { text-decoration:none; }
    a:visited { text-decoration:none; }
    a:hover   { text-decoration:none; }
    a:active  { text-decoration:none; }
    a:focus   { text-decoration:none; }
</style>

<head>
</head>

<?php
    $onsite = false;
    $slowrefresh = false;
?>

</head>
<body>

<?php
    // include helper functions
    include "SDS_status_functions.php";

    // include channel list
    include "SDS_status_channels.php";

    // read cached ADEI data
    $valuesincluded = 0;
    $loop = 0;
    $includeflag = 0;
    do
    {
        $includeflag = include 'ADEIvalues.php';
        $loop++;
        if ($valuesincluded == 0) usleep(100000);
    }
    while (($loop < 21) && ($includeflag + $valuesincluded < 2));
    if ($valuesincluded == 0) $extraction_time = "Request timed out!" . PHP_EOL;
    //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;


    // ########## TIME STAMP ##########
    echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector Section Value List</b></font><br>';
    echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC822) . '</font><br>';
    echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
    echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';

    //('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
    if ($errorcount > 0) echo "<br> <br> <br> <br>" . $errormessage;
?>



<a href="mailto:thuemmler@kit.edu">
<div title="send email to Thomas Thuemmler" style="position:absolute; top:-50px; left:8px">
<img src="pics/newEmail.png" width="23" height="23">
</div>
</a>

<?php
    // include values
    if ($valuesincluded == 0) echo "Failed to load values! Stopped!" . PHP_EOL;
    else
    {
        echo "All values successfully loaded!<br>" . PHP_EOL;

        for ($id = 0;$id < sizeof($adeiChannel);$id++)
        {
            echo "<br>" . PHP_EOL;
            for ($ch = 0;$ch < sizeof($adeiChannel[$id]);$ch++)
            {
                echo $id . " " . $ch . " " . $adeiChannel[$id][$ch] . " " . $adeiValue[$id][$ch] . "<br>" . PHP_EOL;
            }
        }
    }
?>


</body>
</html>
