示例#1
0
function calc_events_trend($conn)
{
    $values = SIEM_trend($conn);
    $data = array();
    $label = array();
    $timetz = gmdate('U') - 86400 + 3600;
    for ($i = 0; $i < 24; $i++) {
        //Data
        $timetz += 3600;
        $h = gmdate('Y-m-d H:00:00', $timetz);
        $data[] = $values[$h] != "" ? $values[$h] : 0;
        //Label
        $label[] = gmdate("Y-m-d H\\h", $timetz);
    }
    return array($label, $data);
}
function calc_events_trend($conn)
{
    $tz = Util::get_timezone();
    $timetz = gmdate("U") + 3600 * $tz - 3600;
    $values = SIEM_trend($conn);
    $data = array();
    $label = array();
    for ($i = 0; $i < 60; $i++) {
        //Data
        $h = gmdate("i", $timetz + 60 * $i);
        $h = preg_replace("/^0/", '', $h);
        $data[] = $values[$h] != "" ? $values[$h] : 0;
        //Label
        $label[] = gmdate("Y-m-d  H:i", $timetz + 60 * $i);
    }
    return array($label, $data);
}