diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-12-15 21:19:42 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-12-15 21:19:42 +0000 |
commit | 2b17b3a96693d74d81f212b330a5ea89c6db0c26 (patch) | |
tree | 46a3ef3aff0b2ff7c40e1b0afc617941be1a36d7 /modules/statistics | |
parent | 5628256e6979335a58e7f9f873037873f24dae27 (diff) | |
download | brdo-2b17b3a96693d74d81f212b330a5ea89c6db0c26.tar.gz brdo-2b17b3a96693d74d81f212b330a5ea89c6db0c26.tar.bz2 |
- Patch #13907 by Neil: less ways to set the page title.
* Less logic in theme code.
* Encourages use of the menu system.
* Easier to find where a title or breadcrumb comes from in other people's code because there are less places to look. Look in menu and then grep for the appropriate set function. Looking for calls to theme_page() is hard because there are too many of them.
* Very slightly more efficient.
Diffstat (limited to 'modules/statistics')
-rw-r--r-- | modules/statistics/statistics.module | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index d5b9f1546..7e9204f20 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -184,7 +184,8 @@ function statistics_node_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), $node->title); + drupal_set_title($node->title); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -211,7 +212,8 @@ function statistics_user_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $account->name); + drupal_set_title($account->name); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -222,7 +224,6 @@ function statistics_user_tracker() { * Menu callback; presents the "Recent hits" page. */ function statistics_recent_hits($type = 'all', $id = 0) { - $header = array( array('data' => t('Timestamp'), 'field' => 'a.timestamp', 'sort' => 'desc'), array('data' => t('Page'), 'field' => 'a.path'), @@ -245,7 +246,7 @@ function statistics_recent_hits($type = 'all', $id = 0) { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), t('Recent hits')); + print theme('page', theme('table', $header, $rows)); } /** @@ -269,7 +270,8 @@ function statistics_top_pages() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -294,7 +296,8 @@ function statistics_top_users() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -303,7 +306,7 @@ function statistics_top_users() { function statistics_top_referrers() { $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%' AND url <> '' GROUP BY url"; $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%'"; - $title = t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))); + drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $header = array( array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'), @@ -321,7 +324,7 @@ function statistics_top_referrers() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $title); + print theme('page', theme('table', $header, $rows)); } /** |