Exemple #1
0
function inputTime($name, $default)
{
    $defaultHour = getHour($default);
    $defaultMin = getMin($default);
    if ($defaultHour > 12) {
        $realHour = $defaultHour - 12;
    } else {
        $realHour = $defaultHour;
    }
    echo "<table cellpadding='0' cellspacing='0'><tr><td rowspan='2'>";
    echo "<select id='" . $name . "hour' onchange='changeMade();updateHour(\"" . $name . "\",this.value)'>";
    for ($i = 1; $i <= 12; $i++) {
        $isSelected = "";
        if ($i % 12 == $realHour) {
            $isSelected = " selected";
        }
        echo "<option value='" . $i . "'" . $isSelected . ">" . $i . "</option>";
    }
    echo "</select></td><td rowspan='2' valign='top'><span style='font-size:12px'><b>&nbsp;: </b></span>";
    echo "<input type='text' id='" . $name . "mins' maxlength='2' size='2' value='" . formatMin($defaultMin) . "' onchange='changeMade();updateMin(\"" . $name . "\",this.value)' style='height:16px' /></td>";
    echo "<td></td><td>";
    echo "<select id='" . $name . "meridian' onchange='changeMade();updateAM(\"" . $name . "\",this.value)'>";
    echo "<option value='0'>AM</option>";
    echo "<option value='1'" . ($default > 1200 ? " selected" : "") . ">PM</option>";
    echo "</select>";
    echo "</td></tr><tr><td></td></tr></table>";
    echo "<input type='hidden' id='" . $name . "' name='" . $name . "' value='" . $defaultHour * 100 . "' />";
}
Exemple #2
0
    $dateString = $a . ' ' . $b . ' UTC';
    return strtotime($dateString) * 1000;
}, $result[1], $result[2]);
// Create Points for Flot charting library
$points = array_map(function ($a, $b) {
    return array($a, $b);
}, $labels, $floatValues);
// Calculate average and min/max values
$average = average($floatValues);
$lowest = getMin($floatValues);
$highest = getMax($floatValues);
$average24Hours = average($valuesLast24Hours);
$lowest24Hours = getMin($valuesLast24Hours);
$highest24Hours = getMax($valuesLast24Hours);
$averageWeek = average($valuesLastWeek);
$lowestWeek = getMin($valuesLastWeek);
$highestWeek = getMax($valuesLastWeek);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Raspberry Pi Monitor</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta http-equiv="refresh" content="900">

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <style>