header('Content-Type: application/javascript');
require '../includes/_func.php';
require '../includes/config.inc.php';
$data_labels = "";
$data_dates = "";
$num_days = date("t");
$result = query("select DATE_FORMAT(date, '%Y-%m-%d') as date,ROUND(light,2) as light from #day where YEAR(date) = YEAR(NOW()) AND MONTH(date) = MONTH(NOW()) group by DAY(date) order by date", $check);
$data_light = "";
$light_min = null;
$light_max = null;
for ($j = 1; $j <= $num_days; $j++) {
    //label
    $data_labels .= '"' . $j . '"' . ($j < $num_days ? ', ' : '');
    //Data dates
    $data_dates .= '"' . den_nazev(date("w", strtotime($j . date(".m.Y")))) . ' ' . ($j < 10 ? '0' : '') . $j . date(".m.Y") . '"' . ($j < $num_days ? ', ' : '');
    //Data
    $search = searchForDate(date("Y-m-") . ($j < 10 ? '0' : '') . $j, $result);
    $data_light .= (!is_null($search) ? '"' . $result[$search]['light'] . '"' : '') . ($j > 0 ? ', ' : '');
    if (!is_null($search)) {
        if (is_null($light_min)) {
            $light_min = $result[$search]['light'];
        }
        if (is_null($light_max)) {
            $light_max = $result[$search]['light'];
        }
        if ($result[$search]['light'] < $light_min) {
            $light_min = $result[$search]['light'];
        }
        if ($result[$search]['light'] > $light_max) {
            $light_max = $result[$search]['light'];
示例#2
0
            $light_min = $result[$search]['light'];
        }
        if ($result[$search]['light'] > $light_max) {
            $light_max = $result[$search]['light'];
        }
    }
}
$data_dates = "";
for ($j = 23; $j >= 0; $j--) {
    $cas = date("H") - $j;
    $den = date("d.m.Y");
    if ($cas < 0) {
        $cas = 24 + $cas;
        $den = date("d.m.Y", time() - 60 * 60 * 24);
    }
    $data_dates .= '"' . den_nazev(date("w", strtotime($den))) . ' ' . $den . ' ' . $cas . ':00"' . ($j > 0 ? ', ' : '');
}
//min, max
if (!is_null($light_min)) {
    echo 'Minimální světlost: <span id="min1">', $light_min, '</span> lx<br />';
}
if (!is_null($light_max)) {
    echo 'Maximální světlost: <span id="max1">', $light_max, '</span> lx<br />';
}
?>
  <script>
      var dataset24hourLabels = [<?php 
echo $data_labels;
?>
];
      var dataset24hourDates = [<?php 
示例#3
0
    echo 'Vlhkost<br /><span>', $humidity, ' %</span>';
}
?>
</div>
    <div class="Column"><?php 
if (strlen($light) > 0 and count(query("select value from #actual where name='light_date' and value > DATE_SUB(NOW() , INTERVAL 3 HOUR)")) > 0) {
    echo 'Světlost<br /><span>', $light, ' lx</span>';
}
?>
</div>
</div>
<br />
<div class="Row">
    <div class="Column2">
      Den v týdnu: <?php 
echo den_nazev(date("w"));
?>
<br />
      Den v roce: <?php 
echo date("z") + 1;
?>
<br />
    </div>
    <div class="Column2">
      Měsíc: <?php 
echo mesic_nazev(date("n"));
?>
<br />
      Týden v roce: <?php 
echo date("W") + 0, date("W") % 2 == 0 ? ' (sudý)' : ' (lichý)';
?>