statistics_block_view

Versions
7
statistics_block_view($delta = '')

Implement hook_block_view().

Code

modules/statistics/statistics.module, line 334

<?php
function statistics_block_view($delta = '') {
  if (user_access('access content')) {
    $content = array();

    $daytop = variable_get('statistics_block_top_day_num', 0);
    if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && ($node_title_list = node_title_list($result, t("Today's:")))) {
      $content[] = $node_title_list;
    }

    $alltimetop = variable_get('statistics_block_top_all_num', 0);
    if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
      $content[] = $node_title_list;
    }

    $lasttop = variable_get('statistics_block_top_last_num', 0);
    if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && ($node_title_list = node_title_list($result, t('Last viewed:')))) {
      $content[] = $node_title_list;
    }

    if (count($content)) {
      $block['content'] = implode('<br />', $content);
      $block['subject'] = t('Popular content');
      return $block;
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.