You are here

function webform_submission_page in Webform 6.3

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

Menu callback; Present a Webform submission page for display or editing.

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

File

includes/webform.submissions.inc, line 368
This file is loaded when handling submissions, either submitting new, editing, or viewing. It also contains all CRUD functions for submissions.

Code

function webform_submission_page($node, $submission, $format) {
  global $user;

  // Add admin CSS.
  drupal_add_css(drupal_get_path('module', 'webform') . '/css/webform-admin.css', 'module', 'all', FALSE);

  // Render the admin UI breadcrumb.
  webform_set_breadcrumb($node, $submission);

  // Set the correct page title.
  drupal_set_title(webform_submission_title($node, $submission));
  if ($format == 'form') {
    $output = drupal_get_form('webform_client_form_' . $node->nid, $node, $submission);
  }
  else {
    $output = webform_submission_render($node, $submission, NULL, $format);
  }

  // Determine the mode in which we're displaying this submission.
  $mode = $format != 'form' ? 'display' : 'form';
  if (strpos(request_uri(), 'print/') !== FALSE) {
    $mode = 'print';
  }
  if (strpos(request_uri(), 'printpdf/') !== FALSE) {
    $mode = 'pdf';
  }

  // Add navigation for administrators.
  if (webform_results_access($node)) {
    $navigation = theme('webform_submission_navigation', $node, $submission, $mode);
    $information = theme('webform_submission_information', $node, $submission, $mode);
  }
  else {
    $navigation = NULL;
    $information = NULL;
  }

  // Actions may be shown to all users.
  $actions = theme('links', module_invoke_all('webform_submission_actions', $node, $submission), array(
    'class' => 'links inline webform-submission-actions',
  ));

  // Disable the page cache for anonymous users viewing or editing submissions.
  if (!$user->uid) {
    webform_disable_page_cache();
  }
  return theme('webform_submission_page', $node, $submission, $output, $navigation, $information, $actions, $mode);
}