function kwresearch_stats_report_form in Keyword Research 6
Same name and namespace in other branches
- 7 includes/stats_report.inc \kwresearch_stats_report_form()
Generates main keyword research report
Parameters
$form_state:
analysis struc $analysis:
bool $ajax:
2 string references to 'kwresearch_stats_report_form'
- kwresearch_analyzer in includes/
contentanalysis.inc - Implementation of hook_analyzer() via custom define callback
- kwresearch_keyword_stats_report_page in includes/
stats_report.inc - Displays keyword stats report
File
- includes/
stats_report.inc, line 81 - Functions to generate the keyword stats report
Code
function kwresearch_stats_report_form($form_state, $analysis, $ajax = FALSE) {
$form['pre_inputs'] = array(
'#type' => 'markup',
'#value' => '<div id="kwresearch-form-inputs">',
);
$form['kwresearch_keyword'] = array(
'#type' => 'textfield',
'#title' => t('Keyword'),
'#default_value' => $analysis && $analysis['inputs']['keyword'] ? $analysis['inputs']['keyword'] : '',
);
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
/*
$form_e = kwresearch_stats_report_params_form_elements($analysis);
$form['options'] = array_merge($form['options'], $form_e);
*/
$sources = module_invoke_all('kwresearch_sources');
if (is_array($sources)) {
foreach ($sources as $aid => $source) {
if ($source['form_options']) {
//$form['options'][$aid . '_stats_report_options'] = array(
// '#type' => 'item',
// '#title' => $source['title'] . ' ' . t('filters'),
// );
$form['options'][$aid . '_stats_report_options'] = array(
'#type' => 'fieldset',
'#title' => $source['title'] . ' ' . 'filters',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['options'][$aid . '_stats_report_options'] = array_merge($form['options'][$aid . '_stats_report_options'], call_user_func($source['form_options'], $analysis));
}
}
}
$form['post_inputs'] = array(
'#type' => 'markup',
'#value' => '</div>',
);
if ($ajax) {
$submit_btn = l(t('Submit'), base_path() . 'kwresearch/analyze_js', array(
'attributes' => array(
'id' => 'kwresearch-submit-button',
'class' => "contentanalysis-analyze-content contentanalysis-button",
"onclick" => "kwresearch_analyze(); return (false);",
),
));
$back_btn = l(t('Back'), base_path() . '#', array(
'attributes' => array(
'class' => "contentanalysis-analyze-content contentanalysis-button",
"onclick" => "contentanalysis_back(); return (false);",
),
));
$form['submit'] = array(
'#type' => 'markup',
'#value' => '<div id="kwresearch-form-buttons">' . $submit_btn . ' ' . $back_btn . '</div>',
);
}
else {
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
}
return $form;
}