Пример #1
0
    function perform($params)
    {
        $sql = <<<EOT
SELECT e.event_type,e.event_time,e.context_json,j.ref,j.prettyname,j.oneliner
    FROM event_log e INNER join journo j on j.id=e.journo_id
    WHERE e.event_time >= date ? AND e.event_time < (date ? + interval '24 hours')
    ORDER BY e.event_time DESC
EOT;
        $rows = db_getAll($sql, $params['from_date']->format('Y-m-d'), $params['to_date']->format('Y-m-d'));
        foreach ($rows as &$r) {
            $r['description'] = $r['event_type'] . ' ("' . eventlog_Describe($r) . '")';
            unset($r['event_type']);
            unset($r['context']);
            unset($r['context_json']);
            $r['event_time'] = date_create($r['event_time'])->format('Y-m-d h:i:s');
        }
        collectColumns($rows);
        return $rows;
    }
Пример #2
0
function journo_fetchRecentEvents($journo_id)
{
    $sql = <<<EOT
SELECT event_time, event_type, context_json FROM event_log
    WHERE journo_id=? AND event_time>NOW()-interval '12 hours'
    ORDER BY event_time DESC;
EOT;
    $events = db_getAll($sql, $journo_id);
    foreach ($events as &$ev) {
        $ev['context'] = json_decode($ev['context_json'], TRUE);
        $ev['description'] = eventlog_Describe($ev);
    }
    return $events;
}