You are here

function registration_checkin_checkin_action_callback in Entity Registration 7.2

AJAX callback for checking in a specific registrant.

1 string reference to 'registration_checkin_checkin_action_callback'
registration_checkin_checkin_action_form in modules/registration_checkin/registration_checkin.module
Form builder for the checkin action form.

File

modules/registration_checkin/registration_checkin.module, line 149
Entity Registration registrant checkin workflow and UI for registration.

Code

function registration_checkin_checkin_action_callback($form, &$form_state) {
  $rid = $form_state['values']['registration_id'];
  $registration = registration_load($rid);
  if ($registration) {
    $registration->state = 'attended';
    $registration
      ->save();
    $updated_state_form = drupal_get_form('registration_checkin_state_form', $registration);
    return array(
      '#type' => 'ajax',
      '#commands' => array(
        ajax_command_replace('.registration-state--rid' . $rid, render($updated_state_form)),
      ),
    );
  }
  else {
    watchdog('registration_checkin', 'Could not load registration (id: @id) to checkin.', array(
      '@id' => $form['registration_id'],
    ));
  }
}