function _webform_results_analysis in Webform 5
Provides a simple analysis of all submissions to a webform.
1 call to _webform_results_analysis()
- webform_results in ./
webform.module - Menu callback for all content under admin/content/webform.
File
- ./
webform_report.inc, line 249
Code
function _webform_results_analysis($nid) {
$rows = array();
$question_number = 0;
$node = node_load($nid);
$headers = array(
t('Q'),
array(
'data' => t('responses'),
'colspan' => '10',
),
);
_webform_load_components();
// Load all component types.
foreach ($node->webformcomponents as $component) {
$question_number++;
// Do component specific call.
$analysis_function = "_webform_analysis_rows_" . $component['type'];
if (function_exists($analysis_function)) {
$crows = $analysis_function($component);
if (is_array($crows)) {
$row[0] = array(
'data' => '<strong>' . $question_number . '</strong>',
'rowspan' => count($crows) + 1,
'valign' => 'top',
);
$row[1] = array(
'data' => '<strong>' . $component['name'] . '</strong>',
'colspan' => '10',
);
$rows = array_merge($rows, array_merge(array(
$row,
), $crows));
}
}
}
return theme('table', $headers, $rows);
}