function statistics_access_log in Drupal 7
Same name and namespace in other branches
- 4 modules/statistics.module \statistics_access_log()
- 5 modules/statistics/statistics.module \statistics_access_log()
- 6 modules/statistics/statistics.admin.inc \statistics_access_log()
Page callback: Gathers page access statistics suitable for rendering.
Parameters
$aid: The unique accesslog ID.
Return value
A render array containing page access statistics. If information for the page was not found, drupal_not_found() is called.
1 string reference to 'statistics_access_log'
- statistics_menu in modules/
statistics/ statistics.module - Implements hook_menu().
File
- modules/
statistics/ statistics.admin.inc, line 231 - Admin page callbacks for the Statistics module.
Code
function statistics_access_log($aid) {
$access = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = :aid', array(
':aid' => $aid,
))
->fetch();
if ($access) {
$rows[] = array(
array(
'data' => t('URL'),
'header' => TRUE,
),
l(url($access->path, array(
'absolute' => TRUE,
)), $access->path),
);
// It is safe to avoid filtering $access->title through check_plain because
// it comes from drupal_get_title().
$rows[] = array(
array(
'data' => t('Title'),
'header' => TRUE,
),
$access->title,
);
$rows[] = array(
array(
'data' => t('Referrer'),
'header' => TRUE,
),
$access->url ? l($access->url, $access->url) : '',
);
$rows[] = array(
array(
'data' => t('Date'),
'header' => TRUE,
),
format_date($access->timestamp, 'long'),
);
$rows[] = array(
array(
'data' => t('User'),
'header' => TRUE,
),
theme('username', array(
'account' => $access,
)),
);
$rows[] = array(
array(
'data' => t('Hostname'),
'header' => TRUE,
),
check_plain($access->hostname),
);
$build['statistics_table'] = array(
'#theme' => 'table',
'#rows' => $rows,
);
return $build;
}
return MENU_NOT_FOUND;
}