rsvp_message_form

Definition

rsvp_message_form($rid, $hash = NULL)
rsvp/rsvp.module, line 825

Description

  • Displays the rsvp send list message form.
*
  • *

Parameters

$rid The id of the rsvp to send the message to.

  • @return html formatted rsvp send list message form.

Code

<?php
function rsvp_message_form($rid, $hash = NULL) {
  $rsvp = rsvp_load($rid);
  drupal_set_title($rsvp->name);

  $form = array();
  $form['status'] =  array(
       '#type' => 'select',
       '#title' => t('Message audience'),
       '#default_value' => 'all',
       '#options' => array('all' => t('Entire RSVP List'), 'yes' => t('Attending'), 'no' =>  t('Not attending'), 'maybe' =>  t('Might attend'), 'none' =>  t('No reply')),
       );
  $form['subject'] = array(
      '#type' => 'textfield',
      '#title' => t('Message Subject'),
      '#default_value' => '',
      '#size' => 40,
      '#maxlength' => 40,
      '#description' => t('This is the subject for your email message')
      );
  $form['body'] = array(
      '#type' => 'textarea',
      '#title' => t('Message Body'),
      '#default_value' => '',
      '#cols' => 60,
      '#rows' => 5,
      '#description' => t('This is the body of the email message')
      );
  $form['rid'] = array(
      '#type' => 'hidden',
      '#value' => $rid
      );
  if (!is_null($hash)) {
    $form['hash'] = array(
        '#type' => 'hidden',
        '#value' => $hash
      );
  }

  $form['op'] = array(
      '#type' => 'submit',
      '#value' => t('Send Message'),
      );

  // make sure that we won't send to none:
  $attendees = _rsvp_get_attendees($rid);
  if (!db_num_rows($attendees)) {
    drupal_set_message(t('No invitees in this RSVP.'));
    $form['op']['#disabled'] = TRUE;
  }

  return $form;
}
?>