You are here

function webform_results_analysis in Webform 6.3

Same name and namespace in other branches
  1. 5.2 webform_report.inc \webform_results_analysis()
  2. 6.2 webform_report.inc \webform_results_analysis()
  3. 7.4 includes/webform.report.inc \webform_results_analysis()
  4. 7.3 includes/webform.report.inc \webform_results_analysis()

Provides a simple analysis of all submissions to a webform.

Parameters

$node: The webform node on which to generate the analysis.

$sids: An array of submission IDs to which this analysis may be filtered. May be used to generate results that are per-user or other groups of submissions.

$analysis_component: A webform component. If passed in, additional information may be returned relating specifically to that component's analysis, such as a list of "Other" values within a select list.

1 string reference to 'webform_results_analysis'
webform_menu in ./webform.module
Implements hook_menu().

File

includes/webform.report.inc, line 857
This file includes helper functions for creating reports for webform.module

Code

function webform_results_analysis($node, $sids = array(), $analysis_component = NULL) {
  if (!is_array($sids)) {
    $sids = array();
  }

  // If showing a component's details, we don't want to loose the menu tabs.
  if ($analysis_component) {
    $item = menu_get_item('node/' . $node->nid . '/webform-results/analysis');
    menu_set_item(NULL, $item);
  }
  $components = isset($analysis_component) ? array(
    $analysis_component['cid'] => $analysis_component,
  ) : $node->webform['components'];
  $data = array();
  foreach ($components as $cid => $component) {

    // Do component specific call.
    if ($row_data = webform_component_invoke($component['type'], 'analysis', $component, $sids, isset($analysis_component))) {
      $data[$cid] = $row_data;
    }
  }
  return theme('webform_results_analysis', $node, $data, $sids, $analysis_component);
}