function dblog_overview
7.x dblog.admin.inc | dblog_overview() |
6.x dblog.admin.inc | dblog_overview() |
Menu callback; displays a listing of log messages.
1 string reference to 'dblog_overview'
- dblog_menu in drupal-6.x/
modules/ dblog/ dblog.module - Implementation of hook_menu().
File
- drupal-6.x/
modules/ dblog/ dblog.admin.inc, line 29 - Administrative page callbacks for the dblog module.
Code
function dblog_overview() {
$filter = dblog_build_filter_query();
$rows = array();
$icons = array(
WATCHDOG_DEBUG => '',
WATCHDOG_INFO => '',
WATCHDOG_NOTICE => '',
WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')),
WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error')),
WATCHDOG_CRITICAL => theme('image', 'misc/watchdog-error.png', t('critical'), t('critical')),
WATCHDOG_ALERT => theme('image', 'misc/watchdog-error.png', t('alert'), t('alert')),
WATCHDOG_EMERG => theme('image', 'misc/watchdog-error.png', t('emergency'), t('emergency')),
);
$classes = array(
WATCHDOG_DEBUG => 'dblog-debug',
WATCHDOG_INFO => 'dblog-info',
WATCHDOG_NOTICE => 'dblog-notice',
WATCHDOG_WARNING => 'dblog-warning',
WATCHDOG_ERROR => 'dblog-error',
WATCHDOG_CRITICAL => 'dblog-critical',
WATCHDOG_ALERT => 'dblog-alert',
WATCHDOG_EMERG => 'dblog-emerg',
);
$output = drupal_get_form('dblog_filter_form');
$header = array(
' ',
array('data' => t('Type'), 'field' => 'w.type'),
array('data' => t('Date'), 'field' => 'w.wid', 'sort' => 'desc'),
t('Message'),
array('data' => t('User'), 'field' => 'u.name'),
array('data' => t('Operations')),
);
$sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid";
$tablesort = tablesort_sql($header);
if (!empty($filter['where'])) {
$result = pager_query($sql . " WHERE " . $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']);
}
else {
$result = pager_query($sql . $tablesort, 50);
}
while ($dblog = db_fetch_object($result)) {
$rows[] = array('data' =>
array(
// Cells
$icons[$dblog->severity],
t($dblog->type),
format_date($dblog->timestamp, 'small'),
l(truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE), 'admin/reports/event/' . $dblog->wid, array('html' => TRUE)),
theme('username', $dblog),
filter_xss($dblog->link),
),
// Attributes for tr
'class' => "dblog-" . preg_replace('/[^a-z]/i', '-', $dblog->type) . ' ' . $classes[$dblog->severity]
);
}
if (!$rows) {
$rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 6));
}
$output .= theme('table', $header, $rows, array('id' => 'admin-dblog'));
$output .= theme('pager', NULL, 50, 0);
return $output;
}