webmaster@1
|
1 <?php |
webmaster@1
|
2 // $Id: statistics.pages.inc,v 1.2 2007/10/20 21:57:50 goba Exp $ |
webmaster@1
|
3 |
webmaster@1
|
4 /** |
webmaster@1
|
5 * @file |
webmaster@1
|
6 * User page callbacks for the statistics module. |
webmaster@1
|
7 */ |
webmaster@1
|
8 |
webmaster@1
|
9 function statistics_node_tracker() { |
webmaster@1
|
10 if ($node = node_load(arg(1))) { |
webmaster@1
|
11 |
webmaster@1
|
12 $header = array( |
webmaster@1
|
13 array('data' => t('Time'), 'field' => 'a.timestamp', 'sort' => 'desc'), |
webmaster@1
|
14 array('data' => t('Referrer'), 'field' => 'a.url'), |
webmaster@1
|
15 array('data' => t('User'), 'field' => 'u.name'), |
webmaster@1
|
16 array('data' => t('Operations'))); |
webmaster@1
|
17 |
webmaster@1
|
18 $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); |
webmaster@1
|
19 $rows = array(); |
webmaster@1
|
20 while ($log = db_fetch_object($result)) { |
webmaster@1
|
21 $rows[] = array( |
webmaster@1
|
22 array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), |
webmaster@1
|
23 _statistics_link($log->url), |
webmaster@1
|
24 theme('username', $log), |
webmaster@1
|
25 l(t('details'), "admin/reports/access/$log->aid")); |
webmaster@1
|
26 } |
webmaster@1
|
27 |
webmaster@1
|
28 if (empty($rows)) { |
webmaster@1
|
29 $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); |
webmaster@1
|
30 } |
webmaster@1
|
31 |
webmaster@1
|
32 drupal_set_title(check_plain($node->title)); |
webmaster@1
|
33 $output = theme('table', $header, $rows); |
webmaster@1
|
34 $output .= theme('pager', NULL, 30, 0); |
webmaster@1
|
35 return $output; |
webmaster@1
|
36 } |
webmaster@1
|
37 else { |
webmaster@1
|
38 drupal_not_found(); |
webmaster@1
|
39 } |
webmaster@1
|
40 } |
webmaster@1
|
41 |
webmaster@1
|
42 function statistics_user_tracker() { |
webmaster@1
|
43 if ($account = user_load(array('uid' => arg(1)))) { |
webmaster@1
|
44 |
webmaster@1
|
45 $header = array( |
webmaster@1
|
46 array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'), |
webmaster@1
|
47 array('data' => t('Page'), 'field' => 'path'), |
webmaster@1
|
48 array('data' => t('Operations'))); |
webmaster@1
|
49 |
webmaster@1
|
50 $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d'. tablesort_sql($header), 30, 0, NULL, $account->uid); |
webmaster@1
|
51 $rows = array(); |
webmaster@1
|
52 while ($log = db_fetch_object($result)) { |
webmaster@1
|
53 $rows[] = array( |
webmaster@1
|
54 array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), |
webmaster@1
|
55 _statistics_format_item($log->title, $log->path), |
webmaster@1
|
56 l(t('details'), "admin/reports/access/$log->aid")); |
webmaster@1
|
57 } |
webmaster@1
|
58 |
webmaster@1
|
59 if (empty($rows)) { |
webmaster@1
|
60 $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3)); |
webmaster@1
|
61 } |
webmaster@1
|
62 |
webmaster@1
|
63 drupal_set_title(check_plain($account->name)); |
webmaster@1
|
64 $output = theme('table', $header, $rows); |
webmaster@1
|
65 $output .= theme('pager', NULL, 30, 0); |
webmaster@1
|
66 return $output; |
webmaster@1
|
67 } |
webmaster@1
|
68 else { |
webmaster@1
|
69 drupal_not_found(); |
webmaster@1
|
70 } |
webmaster@1
|
71 } |