summaryrefslogtreecommitdiff
path: root/includes/pages/admin_log.php
blob: 694b1d5acd76e6bef0cde1c7bf834518e7b9a4ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

/**
 * @return string
 */
function admin_log_title()
{
    return _('Log');
}

/**
 * @return string
 */
function admin_log()
{
    $filter = '';
    if (request()->has('keyword')) {
        $filter = strip_request_item('keyword');
    }
    $log_entries = LogEntries_filter($filter);

    foreach ($log_entries as &$log_entry) {
        $log_entry['date'] = date('d.m.Y H:i', $log_entry['timestamp']);
    }

    return page_with_title(admin_log_title(), [
        msg(),
        form([
            form_text('keyword', _('Search'), $filter),
            form_submit(_('Search'), 'Go')
        ]),
        table([
            'date'    => 'Time',
            'level'   => 'Type',
            'message' => 'Log Entry'
        ], $log_entries)
    ]);
}