function statistics_node_tracker in Drupal 6
Same name and namespace in other branches
- 4 modules/statistics.module \statistics_node_tracker()
- 5 modules/statistics/statistics.module \statistics_node_tracker()
- 7 modules/statistics/statistics.pages.inc \statistics_node_tracker()
@file User page callbacks for the statistics module.
1 string reference to 'statistics_node_tracker'
- statistics_menu in modules/
statistics/ statistics.module - Implementation of hook_menu().
File
- modules/
statistics/ statistics.pages.inc, line 8 - User page callbacks for the statistics module.
Code
function statistics_node_tracker() {
if ($node = node_load(arg(1))) {
$header = array(
array(
'data' => t('Time'),
'field' => 'a.timestamp',
'sort' => 'desc',
),
array(
'data' => t('Referrer'),
'field' => 'a.url',
),
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Operations'),
),
);
$result = pager_query("SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path = 'node/%d' OR a.path LIKE 'node/%d/%%'" . tablesort_sql($header), 30, 0, NULL, $node->nid, $node->nid);
$rows = array();
while ($log = db_fetch_object($result)) {
$rows[] = array(
array(
'data' => format_date($log->timestamp, 'small'),
'class' => 'nowrap',
),
_statistics_link($log->url),
theme('username', $log),
l(t('details'), "admin/reports/access/{$log->aid}"),
);
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No statistics available.'),
'colspan' => 4,
),
);
}
drupal_set_title(check_plain($node->title));
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
}
else {
drupal_not_found();
}
}