You are here

function apachesolr_stats_block in Apache Solr Statistics 6

Same name and namespace in other branches
  1. 6.3 apachesolr_stats.module \apachesolr_stats_block()

Implementation of hook_block().

File

./apachesolr_stats.module, line 1044
Keeps and reports statistics about Apache Solr usage and performance.

Code

function apachesolr_stats_block($op = 'list', $delta = 0) {
  switch ($op) {
    case 'list':

      // Default block settings.
      $blocks = array(
        0 => array(
          'info' => t('Apache Solr Statistics: popular searches'),
          // Start out disabled
          'status' => 0,
          'region' => 'right',
          // Should be cached equally across paths and roles.
          'cache' => BLOCK_CACHE_GLOBAL,
        ),
      );
      return $blocks;
    case 'view':
      $links = apachesolr_stats_block_frequent_keywords();
      if ($links) {

        // Return a block array.
        $block = array(
          'subject' => t('Popular searches'),
          'content' => theme('apachesolr_stats_block', $links),
        );
        return $block;
      }
  }
}