You are here

function signup_token_values in Signup 6.2

Same name and namespace in other branches
  1. 6 signup.module \signup_token_values()
  2. 7 signup.module \signup_token_values()

Implement hook_token_values() (from token.module)

File

./signup.module, line 1740
The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…

Code

function signup_token_values($type = 'all', $object = NULL) {
  $values = array();
  if ($type == 'node') {
    if (empty($object->signup)) {
      $values['node-signup-enabled'] = t('disabled');
      $values['node-signup-status'] = '';
      $values['node-signup-limit'] = '';
    }
    else {
      $values['node-signup-enabled'] = t('enabled');
      $values['node-signup-status'] = $object->signup_status ? t('open') : t('closed');
      $values['node-signup-limit'] = (int) $object->signup_close_signup_limit;
    }
  }
  elseif ($type == 'signup') {
    $signup_data = array();
    if (!empty($object->form_data)) {
      if (is_array($object->form_data)) {
        $signup_data = $object->form_data;
      }
      else {
        $signup_data = unserialize($object->form_data);
      }
    }
    $values['signup-user-data'] = theme('signup_custom_data', $signup_data);
    $values['signup-user-data-raw'] = theme('signup_email_token_custom_data', $signup_data);
    $values['signup-date-short'] = format_date($object->signup_time, 'small');
    $values['signup-date-medium'] = format_date($object->signup_time, 'medium');
    $values['signup-date-long'] = format_date($object->signup_time, 'large');
    '';
    $values['signup-cancel-url'] = _signup_get_cancel_link($object->sid);
    if (!empty($object->anon_mail)) {
      $values['signup-email'] = $object->anon_mail;
    }
    elseif (!empty($object->mail)) {
      $values['signup-email'] = $object->mail;
    }
    else {
      $values['signup-email'] = '';
    }
    $values['signup-anonymous-email'] = !empty($object->anon_mail) ? $object->anon_mail : '';
    $attended = isset($signup->attended) ? $signup->attended : NULL;
    $values['signup-attendence'] = check_plain(theme('signup_attended_text', $attended));
    $values['signup-id'] = $object->sid;
  }
  return $values;
}