- Patch #139979 by asimmonds: Display consistent message for unavailable statistics.

6.x
Dries Buytaert 2007-04-30 11:26:06 +00:00
parent 38d22252b9
commit e9ffe24f8e
1 changed files with 28 additions and 5 deletions

View File

@ -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;