You are here

function signup_node_admin_multiple_submit in Signup 6.2

Submit handler for updating multiple signups via node/N/signups.

If the operation is non-destructive (recording attendance), do the deed. For cancelling multiple users, this just saves the selected users into SESSION and redirects to a confirm form which is registered at node/N/signups/confirm.

1 string reference to 'signup_node_admin_multiple_submit'
signup_node_admin_details_form in includes/node_admin.inc

File

includes/node_admin.inc, line 144
Code related to the signup administration tab on each node.

Code

function signup_node_admin_multiple_submit($form, &$form_state) {
  $users = array_filter($form_state['values']['users']);
  switch ($form_state['values']['operation']) {
    case 'cancel':
      if (user_access('cancel signups')) {
        $_SESSION['signup_cancel_multiple_users'] = $users;
        $form_state['redirect'] = 'node/' . $form_state['values']['nid'] . '/signups/confirm';
        return;
      }
      else {
        drupal_set_message(t('You do not have permission to cancel signups.'), 'error');
        return;
      }
    case 'attend_yes':
      $attend = 1;
      break;
    case 'attend_no':
      $attend = 0;
      break;
  }
  $placeholders = db_placeholders($users);
  db_query("UPDATE {signup_log} SET attended = %d WHERE sid IN ({$placeholders})", array(
    $attend,
  ) + $users);
}