function kwresearch_keyword_stats_report_page in Keyword Research 6
Same name and namespace in other branches
- 7 includes/stats_report.inc \kwresearch_keyword_stats_report_page()
Displays keyword stats report
Parameters
str $keyword:
1 string reference to 'kwresearch_keyword_stats_report_page'
- kwresearch_menu in ./
kwresearch.module - Implementation of hook_menu().
File
- includes/
stats_report.inc, line 13 - Functions to generate the keyword stats report
Code
function kwresearch_keyword_stats_report_page($keyword = NULL) {
drupal_add_css(drupal_get_path('module', 'kwresearch') . '/kwresearch.css');
drupal_add_js(drupal_get_path('module', 'kwresearch') . '/kwresearch.js');
$analysis = $_SESSION['kwresearch']['analysis'];
$_SESSION['kwresearch']['analysis'] = '';
$stats = TRUE;
if (!$analysis && $keyword) {
$analysis = array();
$analysis['inputs']['keyword'] = $keyword;
$analysis['analysis'] = kwresearch_get_keyword_stats_data($keyword, $msgs);
if (!empty($msgs)) {
$analysis['messages'] = $msgs;
}
}
if ($analysis) {
// turn on keyword operations
$analysis['inputs']['operations'] = TRUE;
}
$output .= drupal_get_form('kwresearch_stats_report_form', $analysis);
//$output = t('Content Analysis.');
if ($analysis) {
$output .= '<div id="kwresearch-popularity-analysis" style="clear: both;">';
$output .= '<h3>' . t('Analysis') . '</h3>';
$output .= theme_keyword_stats_report($analysis);
$output .= '</div>';
// initialize kw data array for javascript
if (is_array($analysis['analysis'])) {
foreach ($analysis['analysis'] as $kw => $v) {
$site_kw[$v['term']] = array(
'kid' => (int) $v['kid'],
'priority' => (int) $v['priority'],
'value' => (int) $v['value'],
'page_count' => (int) $v['page_count'],
);
}
}
}
$site_priority_options = kwresearch_get_priority_options();
drupal_add_js(array(
'kwresearch' => array(
'form' => 'admin_keyword_stats',
'analyze_path' => base_path() . 'admin/content/kwresearch/keyword_report/',
'keyword_edit_path' => base_path() . 'admin/content/kwresearch/keyword_list/edit/',
'return_destination' => 'admin/content/kwresearch/keyword_report/' . $keyword,
'toggle_site_keyword_callback' => base_path() . 'kwresearch/toggle_site_keyword_js',
'module_path' => base_path() . drupal_get_path('module', 'kwresearch'),
'enable_site_keyword_tool' => user_access('kwresearch admin site keywords'),
'site_keywords_data' => $site_kw,
'site_priority_options' => $site_priority_options,
),
), 'setting');
return $output;
}