00001 <?php
00002
00003
00009 function statistics_node_tracker() {
00010 if ($node = node_load(arg(1))) {
00011
00012 $header = array(
00013 array('data' => t('Time'), 'field' => 'a.timestamp', 'sort' => 'desc'),
00014 array('data' => t('Referrer'), 'field' => 'a.url'),
00015 array('data' => t('User'), 'field' => 'u.name'),
00016 array('data' => t('Operations')));
00017
00018 $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 LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
00019 $rows = array();
00020 while ($log = db_fetch_object($result)) {
00021 $rows[] = array(
00022 array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
00023 _statistics_link($log->url),
00024 theme('username', $log),
00025 l(t('details'), "admin/reports/access/$log->aid"));
00026 }
00027
00028 if (empty($rows)) {
00029 $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
00030 }
00031
00032 drupal_set_title(check_plain($node->title));
00033 $output = theme('table', $header, $rows);
00034 $output .= theme('pager', NULL, 30, 0);
00035 return $output;
00036 }
00037 else {
00038 drupal_not_found();
00039 }
00040 }
00041
00042 function statistics_user_tracker() {
00043 if ($account = user_load(array('uid' => arg(1)))) {
00044
00045 $header = array(
00046 array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
00047 array('data' => t('Page'), 'field' => 'path'),
00048 array('data' => t('Operations')));
00049
00050 $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), 30, 0, NULL, $account->uid);
00051 $rows = array();
00052 while ($log = db_fetch_object($result)) {
00053 $rows[] = array(
00054 array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
00055 _statistics_format_item($log->title, $log->path),
00056 l(t('details'), "admin/reports/access/$log->aid"));
00057 }
00058
00059 if (empty($rows)) {
00060 $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3));
00061 }
00062
00063 drupal_set_title(check_plain($account->name));
00064 $output = theme('table', $header, $rows);
00065 $output .= theme('pager', NULL, 30, 0);
00066 return $output;
00067 }
00068 else {
00069 drupal_not_found();
00070 }
00071 }