You are here

function theme_wordstream_stats_report in WordStream Keyword Tools 7

Same name and namespace in other branches
  1. 6 wordstream.module \theme_wordstream_stats_report()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 call to theme_wordstream_stats_report()
wordstream_keyword_stats_report_page in ./wordstream.module
Displays keyword stats report

File

./wordstream.module, line 400

Code

function theme_wordstream_stats_report($analysis) {

  // TODO: Should this theme wordstream_stats_report be declared in hook_theme()?
  $hdrs = array(
    t('Term'),
    t('Frequency'),
  );
  $rows = array();
  foreach ($analysis['analysis'] as $v) {
    $row = array(
      $v[0],
      number_format($v[1]),
    );
    $rows[] = array(
      'data' => $row,
      'id' => 'kid-' . (isset($v['kid']) ? $v['kid'] : 'n'),
    );
  }
  $attr = array(
    'id' => 'kwresearch-result-table-' . check_plain(str_replace(' ', '-', isset($analysis['inputs']['keyword']) ? $analysis['inputs']['keyword'] : '')),
    'class' => array(
      'kwresearch-result-table',
    ),
  );
  $output = '<div id="kwresearch-result-block-' . check_plain(str_replace(' ', '-', isset($analysis['inputs']['keyword']) ? $analysis['inputs']['keyword'] : '')) . '" class="kwresearch-result-block">';
  $vars = array(
    'header' => $hdrs,
    'rows' => $rows,
    'attributes' => $attr,
  );
  $output .= theme('table', $vars);
  return $output;
}