function statistics_recent_hits in Drupal 6
Same name and namespace in other branches
- 4 modules/statistics.module \statistics_recent_hits()
- 5 modules/statistics/statistics.module \statistics_recent_hits()
- 7 modules/statistics/statistics.admin.inc \statistics_recent_hits()
Menu callback; presents the "recent hits" page.
1 string reference to 'statistics_recent_hits'
- statistics_menu in modules/
statistics/ statistics.module - Implementation of hook_menu().
File
- modules/
statistics/ statistics.admin.inc, line 11 - Admin page callbacks for the statistics module.
Code
function statistics_recent_hits() {
$header = array(
array(
'data' => t('Timestamp'),
'field' => 'a.timestamp',
'sort' => 'desc',
),
array(
'data' => t('Page'),
'field' => 'a.path',
),
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Operations'),
),
);
$sql = 'SELECT a.aid, a.path, a.title, a.uid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {users} u ON u.uid = a.uid' . tablesort_sql($header);
$result = pager_query($sql, 30);
$rows = array();
while ($log = db_fetch_object($result)) {
$rows[] = array(
array(
'data' => format_date($log->timestamp, 'small'),
'class' => 'nowrap',
),
_statistics_format_item($log->title, $log->path),
theme('username', $log),
l(t('details'), "admin/reports/access/{$log->aid}"),
);
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No statistics available.'),
'colspan' => 4,
),
);
}
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
}