diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-04-30 11:26:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-04-30 11:26:06 +0000 |
commit | e9ffe24f8eaaf8440152f6201b76109e98e20b12 (patch) | |
tree | a61e39c62e8d3937ef90d42cc3d05e349260f73a /modules/statistics | |
parent | 38d22252b9fee97e0b1ef8e8dedb3feea77d27f8 (diff) | |
download | brdo-e9ffe24f8eaaf8440152f6201b76109e98e20b12.tar.gz brdo-e9ffe24f8eaaf8440152f6201b76109e98e20b12.tar.bz2 |
- Patch #139979 by asimmonds: Display consistent message for unavailable statistics.
Diffstat (limited to 'modules/statistics')
-rw-r--r-- | modules/statistics/statistics.module | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 6660e2d90..61c089626 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -209,12 +209,14 @@ function statistics_node_tracker() { l(t('details'), "admin/logs/access/$log->aid")); } - drupal_set_title(check_plain($node->title)); - if (!empty($rows)) { - $output = theme('table', $header, $rows); - $output .= theme('pager', NULL, 30, 0); - return $output; + 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(); @@ -230,6 +232,7 @@ function statistics_user_tracker() { array('data' => t('Operations'))); $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d'. tablesort_sql($header), 30, 0, NULL, $account->uid); + $rows = array(); while ($log = db_fetch_object($result)) { $rows[] = array( array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), @@ -237,6 +240,10 @@ function statistics_user_tracker() { l(t('details'), "admin/logs/access/$log->aid")); } + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3)); + } + drupal_set_title(check_plain($account->name)); $output = theme('table', $header, $rows); $output .= theme('pager', NULL, 30, 0); @@ -270,6 +277,10 @@ function statistics_recent_hits() { l(t('details'), "admin/logs/access/$log->aid")); } + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); + } + $output = theme('table', $header, $rows); $output .= theme('pager', NULL, 30, 0); return $output; @@ -296,6 +307,10 @@ function statistics_top_pages() { $rows[] = array($page->hits, _statistics_format_item($page->title, $page->path), t('%time ms', array('%time' => round($page->average_time))), format_interval(round($page->total_time / 1000))); } + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); + } + drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $output = theme('table', $header, $rows); $output .= theme('pager', NULL, 30, 0); @@ -325,6 +340,10 @@ function statistics_top_visitors() { $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), $ban_link); } + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); + } + drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $output = theme('table', $header, $rows); $output .= theme('pager', NULL, 30, 0); @@ -353,6 +372,10 @@ function statistics_top_referrers() { $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(time() - $referrer->last)))); } + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3)); + } + $output = theme('table', $header, $rows); $output .= theme('pager', NULL, 30, 0); return $output; |