You are here

function signup_user_list_output in Signup 7

Same name and namespace in other branches
  1. 6.2 includes/node_output.inc \signup_user_list_output()
  2. 6 includes/node_output.inc \signup_user_list_output()

Helper function to generate the list of users signed up for a node.

1 call to signup_user_list_output()
signup_node_view in ./signup.module
Implements hook_node_view().
1 string reference to 'signup_user_list_output'
signup_menu in ./signup.module
Implements hook_menu().

File

includes/node_output.inc, line 113
Code used to generate singup-related output when viewing nodes.

Code

function signup_user_list_output($node) {
  $output = '';

  // TODO: This probably shouldn't be here.
  drupal_set_title($node->title);

  // How should the list of signed-up users be displayed, if at all?
  $display_list = variable_get('signup_display_signup_user_list', 'embed-view');

  // Ensure the user has permission to view the signup list for this node.
  if (_signup_menu_access($node, 'list') && ($display_list == 'embed-view' || $display_list == 'embed-view-tab')) {
    $signup_view = variable_get('signup_user_list_view', 'signup_user_list:default');
    $signup_view_parts = explode(':', $signup_view);
    $view_name = $signup_view_parts[0];
    $view_display = $signup_view_parts[1];
    $view = views_get_view($view_name);
    if ($display_list == 'embed-view-tab') {
      $view->override_path = 'node/%/signups/list';
    }
    else {
      $view->override_path = 'node/%';
    }
    $view_args = array(
      $node->nid,
    );
    $output .= $view
      ->preview($view_display, $view_args);
  }
  return $output;
}