function filelog_ui_overview in File Log 6.2
Menu callback; displays a listing of log messages.
1 string reference to 'filelog_ui_overview'
- filelog_ui_menu in ./
filelog_ui.module - Implementation of hook_menu()
File
- ./
filelog_ui.pages.inc, line 11 - Log viewer page callbacks for the filelog_ui module.
Code
function filelog_ui_overview() {
$output = drupal_get_form('filelog_ui_filter_form');
$filter = $_SESSION['filelog_ui_overview_filter'];
$filter = is_array($filter) ? $filter : array();
$filter = is_array($filter['filter']) ? $filter['filter'] : array();
$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 => 'filelog-ui-debug',
WATCHDOG_INFO => 'filelog-ui-info',
WATCHDOG_NOTICE => 'filelog-ui-notice',
WATCHDOG_WARNING => 'filelog-ui-warning',
WATCHDOG_ERROR => 'filelog-ui-error',
WATCHDOG_CRITICAL => 'filelog-ui-critical',
WATCHDOG_ALERT => 'filelog-ui-alert',
WATCHDOG_EMERG => 'filelog-ui-emerg',
);
$header = array(
' ',
array(
'data' => t('Type'),
'field' => 'f.type',
),
array(
'data' => t('Date'),
'field' => 'f.timestamp',
'sort' => 'desc',
),
t('Message'),
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Operations'),
),
);
$sql = "SELECT f.wid, f.uid, f.severity, f.type, f.timestamp, f.message, f.variables, f.link, u.name FROM {filelog} f INNER JOIN {users} u ON f.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 ($flog = db_fetch_object($result)) {
$rows[] = array(
'data' => array(
// Cells
$icons[$flog->severity],
t($flog->type),
format_date($flog->timestamp, 'small'),
l(truncate_utf8(_filelog_ui_format_message($flog), 56, TRUE, TRUE), 'admin/reports/filelog-entry/' . $flog->wid, array(
'html' => TRUE,
)),
theme('username', $flog),
$flog->link,
),
// Attributes for tr
'class' => "filelog-ui-" . preg_replace('/[^a-z]/i', '-', $flog->type) . ' ' . $classes[$flog->severity],
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No log messages available.'),
'colspan' => 6,
),
);
}
$output .= theme('table', $header, $rows, array(
'id' => 'admin-filelog-ui',
));
$output .= theme('pager', NULL, 50, 0);
return $output;
}