function modr8_log_overview in modr8 7
Same name and namespace in other branches
- 5 modr8_admin.inc \modr8_log_overview()
- 6 modr8_admin.inc \modr8_log_overview()
Moderation log overview.
1 call to modr8_log_overview()
- modr8_log_view in ./
modr8_admin.inc - menu callback for moderation log.
File
- ./
modr8_admin.inc, line 693 - Admin pages for moderation
Code
function modr8_log_overview($nid = 0) {
$header = array(
array(
'data' => t('Action'),
),
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Date'),
'field' => 'ml.modid',
'sort' => 'desc',
),
array(
'data' => t('Title (view event)'),
),
);
$events = db_select('modr8_log', 'ml')
->extend('TableSort')
->extend('PagerDefault')
->limit(variable_get('modr8_logs_per_page', 15))
->addTag('node_access')
->addMetaData('base_table', 'modr8_log');
$events
->leftJoin('users', 'u', 'ml.uid = u.uid');
$events
->fields('ml', array(
'modid',
'action',
'title',
'timestamp',
))
->fields('u', array(
'name',
'uid',
))
->orderByHeader($header);
//If nid is present show the logs for that node alone
if ($nid) {
$events
->condition('ml.nid', $nid);
}
$events = $events
->execute();
foreach ($events as $event) {
$rows[] = array(
t($event->action),
theme('username', array(
'account' => $event,
)),
format_date($event->timestamp, 'short'),
l(truncate_utf8($event->title, 50, TRUE, TRUE), 'admin/reports/modr8/event/' . $event->modid, array(), NULL, NULL, FALSE, TRUE),
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No log messages available.'),
'colspan' => 4,
),
);
}
$output = '';
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
$output .= theme('pager', array(
'tags' => NULL,
'element' => 0,
));
return $output;
}