You are here

function elasticsearch_connector_statistics_block_view in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module \elasticsearch_connector_statistics_block_view()
  2. 7.2 modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module \elasticsearch_connector_statistics_block_view()

Implements hook_block_view().

File

modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module, line 475
Logs and displays access statistics for a site.

Code

function elasticsearch_connector_statistics_block_view($delta = '') {
  if (user_access('access content')) {
    $content = array();
    $daytop = variable_get('elasticsearch_connector_statistics_block_top_day_num', 0);
    if ($daytop && ($result = elasticsearch_connector_statistics_title_list_today($daytop)) && ($node_title_list = node_title_list($result, t("Today's:")))) {
      $content['top_day'] = $node_title_list;
      $content['top_day']['#suffix'] = '<br />';
    }
    $alltimetop = variable_get('elasticsearch_connector_statistics_block_top_all_num', 0);
    if ($alltimetop && ($result = elasticsearch_connector_statistics_title_list_alltime($alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
      $content['top_all'] = $node_title_list;
      $content['top_all']['#suffix'] = '<br />';
    }
    if (count($content)) {
      $block['content'] = $content;
      $block['subject'] = t('Popular content');
      return $block;
    }
  }
}