You are here

function signup_user_signups_form in Signup 5

Prints the signup details for a single node when the signups tab is clicked

1 string reference to 'signup_user_signups_form'
signup_menu in ./signup.module
Implementation of hook_menu().

File

./signup.module, line 1145

Code

function signup_user_signups_form($node) {
  drupal_set_title(check_plain($node->title));

  // Display if signups are open/closed, and print a button to toggle
  $ctrl_row = array();
  if ($node->signup_completed) {
    $ctrl_row[] = array(
      t('Signups <strong>closed</strong> for this event'),
      drupal_get_form('signup_open_signups_form', $node->nid),
    );
  }
  else {
    $ctrl_row[] = array(
      t('Signups <strong>open</strong> for this event'),
      drupal_get_form('signup_close_signups_form', $node->nid),
    );
  }
  $output .= '<div class="signup-admin-row">';
  $output .= theme('table', NULL, $ctrl_row);
  $output .= '</div><br />';

  // Pull all user signed up for this event, and start table creation.
  $result = db_query("SELECT u.uid, u.name, s.anon_mail, s.signup_time, s.form_data FROM {signup_log} s INNER JOIN {users} u ON u.uid = s.uid WHERE s.nid =%d", $node->nid);
  $header = array(
    array(
      'data' => t('!users signed up', array(
        '!users' => format_plural(db_num_rows($result), '1 individual', '@count individuals'),
      )),
      'colspan' => 3,
    ),
  );
  $rows = array();

  // Get default timezone offset for the site.
  $offset = intval(variable_get('date_default_timezone', 0));

  // Loop through the users, unserializing their user data.
  while ($signed_up_user = db_fetch_object($result)) {
    $table_data = array();
    $form_data = unserialize($signed_up_user->form_data);

    // Compose the user data.
    $signup_form_data = theme('signup_custom_data', $form_data);

    // The username and the unique form identifier are different for
    // anon signups and registered user signups.  For registered users,
    // provide a link to the user profile, and use the uid as the
    // identifier.  For anon, use the user's email address as the
    // identifier and name.
    if ($signed_up_user->uid == 0) {
      $username = check_plain($signed_up_user->anon_mail);
      $id = $signed_up_user->anon_mail;
    }
    else {
      $username = theme('username', $signed_up_user);
      $id = $signed_up_user->uid;
    }

    // Build the row for this user.
    $rows[] = array(
      $username . '<br />' . gmdate(variable_get('signup_date_string', 'M jS, g:i A'), $signed_up_user->signup_time + $offset),
      $signup_form_data,
      drupal_get_form('signup_user_cancel_form_' . $id, $id, $node->nid, $signed_up_user->uid, $signed_up_user->anon_mail),
    );
  }
  $output .= theme('table', $header, $rows);
  return $output;
}