You are here

function webform_submission_view in Webform 5

View-only presentation of the webform filled with a particular submission.

1 call to webform_submission_view()
webform_results in ./webform.module
Menu callback for all content under admin/content/webform.

File

./webform.module, line 2010

Code

function webform_submission_view(&$node, $sid) {
  global $user;
  include_once drupal_get_path('module', 'webform') . "/webform.inc";
  $node->webformcomponents = _webform_components_decode($node->webformcomponents);
  $submission = _webform_fetch_submission($sid, $node->nid);
  if ($sid && is_numeric($sid)) {
    if (user_access("access webform results") || user_access("access own webform submissions") && $user->uid == $submission['uid']) {
      drupal_set_title(t('Submission #@sid', array(
        '@sid' => $sid,
      )));
      $node->body = "";
      return drupal_get_form('webform_client_form_' . $node->nid, $node, $submission);
    }
    else {
      watchdog('webform', t('Unauthorized webform access attempt by %name.', array(
        '%name' => $user->name,
      )), WATCHDOG_WARNING);

      // and log the attempt
      return drupal_access_denied();
    }
  }
}