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