function theme_webform_results_table in Webform 6.2
Same name and namespace in other branches
- 5.2 webform_report.inc \theme_webform_results_table()
- 5 webform_report.inc \theme_webform_results_table()
- 6.3 includes/webform.report.inc \theme_webform_results_table()
- 7.4 includes/webform.report.inc \theme_webform_results_table()
- 7.3 includes/webform.report.inc \theme_webform_results_table()
Theme the results table displaying all the submissions for a particular node.
Parameters
$node: The node whose results are being displayed.
$components: An associative array of the components for this webform.
$submissions: An array of all submissions for this webform.
$total_count: The total number of submissions to this webform.
$pager_count: The number of results to be shown per page.
1 theme call to theme_webform_results_table()
- webform_results_table in ./
webform_report.inc - Create a table containing all submitted values for a webform node.
File
- ./
webform_report.inc, line 207 - This file includes helper functions for creating reports for webform.module
Code
function theme_webform_results_table($node, $components, $submissions, $total_count, $pager_count) {
drupal_add_css(drupal_get_path('module', 'webform') . '/webform.css');
$header = array();
$rows = array();
$cell = array();
// This header has to be generated seperately so we can add the SQL necessary.
// to sort the results.
$header = theme('webform_results_table_header', $node);
// Generate a row for each submission.
foreach ($submissions as $sid => $submission) {
$cell[] = l($sid, 'node/' . $node->nid . '/submission/' . $sid);
$cell[] = format_date($submission->submitted, 'small');
$cell[] = theme('username', $submission);
$cell[] = $submission->remote_addr;
$component_headers = array();
// Generate a cell for each component.
foreach ($node->webform['components'] as $component) {
$table_function = '_webform_table_data_' . $component['type'];
if (function_exists($table_function)) {
$data = isset($submission->data[$component['cid']]) ? $submission->data[$component['cid']] : NULL;
$submission_output = $table_function($data, $component);
if ($submission_output !== NULL) {
$component_headers[] = $component['name'];
$cell[] = $submission_output;
}
}
}
$rows[] = $cell;
unset($cell);
}
if (!empty($component_headers)) {
$header = array_merge($header, $component_headers);
}
if (count($rows) == 0) {
$rows[] = array(
array(
'data' => t('There are no submissions for this form. <a href="!url">View this form</a>.', array(
'!url' => url('node/' . $node->nid),
)),
'colspan' => 4,
),
);
}
$output = '';
$output .= theme('webform_results_per_page', $total_count, $pager_count);
$output .= theme('table', $header, $rows);
return $output;
}