You are here

function theme_webform_results_analysis in Webform 6.3

Same name and namespace in other branches
  1. 7.4 includes/webform.report.inc \theme_webform_results_analysis()
  2. 7.3 includes/webform.report.inc \theme_webform_results_analysis()

Output the content of the Analysis page.

See also

webform_results_analysis()

1 theme call to theme_webform_results_analysis()
webform_results_analysis in includes/webform.report.inc
Provides a simple analysis of all submissions to a webform.

File

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

Code

function theme_webform_results_analysis($node, $data, $sids = array(), $analysis_component = NULL) {
  $rows = array();
  $question_number = 0;
  $single = isset($analysis_component);
  $header = array(
    $single ? $analysis_component['name'] : t('Q'),
    array(
      'data' => $single ? ' ' : t('responses'),
      'colspan' => '10',
    ),
  );
  foreach ($data as $cid => $row_data) {
    $question_number++;
    if (is_array($row_data)) {
      $row = array();
      if (!$single) {
        $row['data'][] = array(
          'data' => '<strong>' . $question_number . '</strong>',
          'rowspan' => count($row_data) + 1,
          'valign' => 'top',
        );
        $row['data'][] = array(
          'data' => '<strong>' . check_plain($node->webform['components'][$cid]['name']) . '</strong>',
          'colspan' => '10',
        );
        $row['class'] = 'webform-results-question';
      }
      $rows = array_merge($rows, array_merge(array(
        $row,
      ), $row_data));
    }
  }
  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' => 20,
      ),
    );
  }
  return theme('table', $header, $rows, array(
    'class' => 'webform-results-analysis',
  ));
}