You are here

function _signup_admin_form in Signup 5

Returns the form for the per-node signup settings. This is shared by the settings page and the node edit page.

Related topics

2 calls to _signup_admin_form()
signup_alter_node_form in ./signup.module
Alters the node form to inject the appropriate per-node signup settings.
signup_settings_page in ./signup.module
Form builder for the settings page under admin/setttings/signup

File

./signup.module, line 1295

Code

function _signup_admin_form($node = NULL) {

  // Load the default admin form data for new nodes.
  if (!$node || !$node->signup) {
    $result = db_fetch_object(db_query("SELECT * FROM {signup} WHERE nid = 0"));
    $node->signup_forwarding_email = $result->forwarding_email;
    $node->signup_send_confirmation = $result->send_confirmation;
    $node->signup_confirmation_email = $result->confirmation_email;
    $node->signup_send_reminder = $result->send_reminder;
    $node->signup_reminder_days_before = $result->reminder_days_before;
    $node->signup_reminder_email = $result->reminder_email;
  }
  $signup_token_description = t('Supported string substitutions: %event, %time, %username, %useremail, %info (user signup information).');
  $form['signup_forwarding_email'] = array(
    '#type' => 'textfield',
    '#title' => t('Send signups to'),
    '#default_value' => $node->signup_forwarding_email,
    '#size' => 40,
    '#maxlength' => 64,
    '#description' => t('Email address where notification of new signups will be sent. Leave blank for no notifications.'),
  );
  $form['signup_send_confirmation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send confirmation'),
    '#default_value' => $node->signup_send_confirmation,
  );
  $form['signup_confirmation_email'] = array(
    '#type' => 'textarea',
    '#title' => t('Confirmation email'),
    '#default_value' => $node->signup_confirmation_email,
    '#cols' => 40,
    '#rows' => 6,
    '#description' => t('Email sent to user upon signup.') . ' ' . $signup_token_description,
  );

  // Define a sub-tree to wrap the next 2 form elements together in an
  // inline div for better display.
  $form['signup_reminder'] = array(
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $form['signup_reminder']['signup_send_reminder'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send reminder'),
    '#default_value' => $node->signup_send_reminder,
  );
  $options = array();
  for ($i = 1; $i <= 60; $i++) {
    $options[$i] = $i;
  }
  $form['signup_reminder']['signup_reminder_days_before'] = array(
    '#type' => 'select',
    '#default_value' => $node->signup_reminder_days_before,
    '#options' => $options,
    '#suffix' => t('day(s) before event'),
  );
  $form['signup_reminder_email'] = array(
    '#type' => 'textarea',
    '#title' => t('Reminder email'),
    '#default_value' => $node->signup_reminder_email,
    '#cols' => 40,
    '#rows' => 6,
    '#description' => t('Email sent to user as an event reminder.') . ' ' . $signup_token_description,
  );
  $form['signup'] = array(
    '#type' => 'hidden',
    '#value' => 1,
  );
  return $form;
}