You are here

function theme_webform_results_submissions in Webform 5

Same name and namespace in other branches
  1. 5.2 webform_report.inc \theme_webform_results_submissions()
  2. 6.2 webform_report.inc \theme_webform_results_submissions()

Theme the submissions tab of the webform results page.

Parameters

$nid: The nid of the node whose results are being displayed.

$submissions: An array of all submissions for this webform.

1 theme call to theme_webform_results_submissions()
_webform_results_submissions in ./webform_report.inc
Retrieve lists of submissions for a given webform.

File

./webform_report.inc, line 47

Code

function theme_webform_results_submissions($nid, $submissions) {
  global $user;

  // This header has to be generated seperately so we can add the SQL necessary
  // to sort the results.
  $header = theme('webform_results_submissions_header', $nid);
  $rows = array();
  foreach ($submissions as $sid => $submission) {
    $row = array(
      $sid,
      format_date($submission->submitted, 'small'),
      theme('username', $submission),
      $submission->remote_addr,
      l(t('View'), "node/{$nid}/results/view/" . $submission->sid, NULL, NULL, NULL, FALSE),
    );
    if (user_access("edit own webform submissions") && $user->uid == $submission->uid || user_access("edit webform submissions")) {
      $row[] = l(t('Edit'), "node/{$nid}/results/edit/" . $submission->sid, NULL, NULL, NULL, FALSE);
    }
    else {
      $row[] = t('Edit');
    }
    if (user_access('clear webform results')) {
      $row[] = l(t('Delete'), "node/{$nid}/results/delete/" . $submission->sid, NULL, NULL, NULL, FALSE);
    }
    $rows[] = $row;
  }
  return theme('table', $header, $rows);
}