' ', 'format' => filter_default_format(), ); $form = array (); $default_aims_and_rules_text = "
During [booking:eventname] we ask that you consider the following so that each of us can be free from distraction whilst we grow in Christ together. Christ is our ultimate example so in all actions, thoughts and words we ask that you demonstrate behaviour that emulates him.
\n" . "
Hi. Welcome to the booking page for [booking:eventname], God willing.
Bookings are not yet open. Please try again later.
" . "If you have any questions, please use the !contact form.
", array('!contact' => l('contact us', 'contact-us'))); $default_into_regn_closed_text = t("
Hi. Welcome to the booking page for [booking:eventname], God willing.
Bookings for this event are now closed.
" . "If you have any questions, please use the !contact form.
", array('!contact' => l('contact us', 'contact-us'))); $default_intro_text = "
Hi. Welcome to the booking page for [booking:eventname], God willing.
So we can make sure this event is tailored for you, can you please complete ALL of the following details with the correct information.
\n" .
"Upon completing the form we will provide the necessary information to pay for [booking:eventname].
"; $waiting_intro_text = "
Hi. Welcome to the booking page for [booking:eventname], God willing.
" . "We have reached the maximum capacity that the venue can hold, so all bookings are now going directly onto the waiting list.
" . "If you would still like to book into the waiting list, please complete ALL of the following details with the correct information and make the necessary payment." . "Upon completing the form we will provide the necessary information to pay for [booking:eventname].
"; $booking_whoscoming_pre_text = "
The following people are registered to attend [booking:eventname]. Registrations are limited so be sure to get in early!
\nThe following people are registered to attend [booking:eventname]. Registrations are limited so be sure to get in early!
\nEven though our registrations have reached maximum capacity, you can still register to join the waiting list." . " See how many people are on the waiting list here.
\nNobody is coming, because nobody has booked in yet!
\n"; $booking_whoscoming_post_text = "\n"; $booking_waitingpage_pre_text = "The following people are on the waiting list to attend [booking:eventname]. " . "Even though our registrations have reached maximum capacity, you can still register to join the waiting list.
\nThere's no one on the waiting list yet. If you haven't already done so, go ahead and register.
\nThanks for filling out the registration form.
\n" . "To complete your booking, please make a payment of $[booking:payment-required] into the following bank account
\n" .
" Account Name: blah
\n BSB: blah
\n Account Number: blah
Use the following as the transaction description:
[booking:payment-transaction-desc]
Alternatively, you can pay by a cheque payable to blah. Please post the cheque to
Address
Thanks for filling out the registration form.
\n" . "Although you are on the waiting list, you can make a refundable payment of $[booking:payment-required] into the following bank account
\n" .
" Account Name: blah
\n BSB: blah
\n Account Number: blah
Use the following as the transaction description:
[booking:payment-transaction-desc]
Alternatively, you can pay by a cheque payable to blah. Please post the cheque to
Address
In your registration details, you indicated that you were married. Please note that both you and your spouse must book in and pay indivdually.
"; $form['tokens'] = array( '#theme' => 'token_tree', '#token_types' => array('booking'), ); $form['registration'] = array( '#type' => 'fieldset', '#title' => 'Registration Page Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['registration']['default_into_regn_not_opened_text'] = array( '#title' => t('Text to use at the start of the registration form if registrations haven\'t opened yet'), '#description' => t(''), '#type' => 'textarea', '#default_value' => variable_get('default_into_regn_not_opened_text', $default_into_regn_not_opened_text), ); /* $booking_registration_intro_text = variable_get('booking_registration_intro_text', array('value' => '', 'format' => NULL)); $form['registration']['booking_registration_intro_text'] = array( '#title' => t('Text to use at the start of the registration form'), '#type' => 'text_format', '#format' => isset($edit['format']) ? $edit['format'] : NULL, '#description' => t(''), '#default_value' => $booking_registration_intro_text['value'], ); */ /* $booking_registration_intro_text = variable_get('booking_registration_intro_text', $defaults); */ $form['registration']['booking_registration_intro_text'] = array( '#title' => t('Text to use at the start of the registration form'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_registration_intro_text', $default_intro_text), //'#type' => 'text_format', //'#format' => 'full_html', //'#default_value' => $booking_registration_intro_text['value'], ); $form['registration']['booking_registration_waiting_intro_text'] = array( '#title' => t('Text to use at the start of the registration form if the venue has reached capacity'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_registration_waiting_intro_text', $waiting_intro_text), ); $form['registration']['default_into_regn_closed_text'] = array( '#title' => t('Text to use at the start of the registration form if registrations have closed'), '#description' => t(''), '#type' => 'textarea', '#default_value' => variable_get('default_into_regn_closed_text', $default_into_regn_closed_text), ); $form['registration']['booking_registration_aims_rules_checkbox'] = array( '#title' => t('The text next to the aims and rules checkbox'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_registration_aims_rules_checkbox', $default_aims_and_rules_checkbox), ); $form['registration']['booking_registration_aims_rules_text'] = array( '#title' => t('The aims and rules attendees must agree to'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_registration_aims_rules_text', $default_aims_and_rules_text), ); /*Text for the confirmation page*/ $form['confirmation'] = array( '#type' => 'fieldset', '#title' => 'Confirmation Page Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['confirmation']['booking_regn_confirm_page'] = array( '#title' => t('Text to use on the confirmation page if the person has booked in and is not on the waiting list'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_regn_confirm_page', $booking_confirmation_text), ); $form['confirmation']['booking_regn_confirm_waiting_page'] = array( '#title' => t('Text to use on the confirmation page if the person is on the waiting list'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_regn_confirm_waiting_page', $booking_confirmation_waitinglist_text), ); $form['confirmation']['booking_regn_confirm_married_text'] = array( '#title' => t('Optional text to add to the confirmaton page if the person indicated they were married.'), '#type' => 'textarea', '#rows' => 1, '#description' => t(''), '#default_value' => variable_get('booking_regn_confirm_married_text', $booking_regn_confirm_married_text), ); $form['confirmation']['booking_regn_completed_page'] = array( '#title' => t('Text to use for landing page on return from paypal website'), '#type' => 'textarea', '#description' => t(''), '#default_value' => (variable_get('booking_regn_completed_page'))['value'], '#type' => 'text_format', '#format' => 'full_html', ); /*Text for the balance payment page*/ $form['balance'] = array( '#type' => 'fieldset', '#title' => 'Balance Payment Page Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); //$booking_regn_balance_page_paid = variable_get('booking_regn_balance_page_paid', $defaults); $form['balance']['booking_regn_balance_page_paid'] = array( '#title' => t('Text to use on the balance payment page if registration is fully paid.'), '#type' => 'textarea', '#default_value' => variable_get('booking_regn_balance_page_paid', ''), '#description' => t(''), //'#type' => 'text_format', //'#format' => 'full_html', //'#default_value' => $booking_regn_balance_page_paid['value'], ); //$booking_regn_balance_page = variable_get('booking_regn_balance_page',$defaults); $form['balance']['booking_regn_balance_page'] = array( '#title' => t('Text to use on the balance payment page.'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_regn_balance_page', ''), //'#type' => 'text_format', //'#format' => 'full_html', //'#default_value' => $booking_regn_balance_page['value'], ); //$booking_regn_balance_married_text = variable_get('booking_regn_balance_married_text', $defaults); $form['balance']['booking_regn_balance_married_text'] = array( '#title' => t('Optional text to add to the balance payment page if the person indicated they were married.'), '#type' => 'textarea', '#rows' => 1, '#description' => t(''), '#default_value' => variable_get('booking_regn_balance_married_text', ''), //'#type' => 'text_format', //'#format' => 'full_html', //'#default_value' => $booking_regn_balance_married_text['value'], ); $form['balance']['booking_regn_partial_balance_page'] = array( '#title' => t('Text to use on the partial balance payment page.'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_regn_partial_balance_page', ''), ); /*People reporting pages*/ $form['people_lists'] = array( '#type' => 'fieldset', '#title' => 'Who\'s Coming and Waiting List Page Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); /*Text for the Who's coming page*/ $form['people_lists']['booking_whoscoming_pre_noregistrations_text'] = array( '#title' => t('Text to use at the start of the Who\'s Coming page if there are no registrations'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_whoscoming_pre_noregistrations_text', $booking_whoscoming_pre_noregistrations_text), ); $form['people_lists']['booking_whoscoming_pre_text'] = array( '#title' => t('Text to use at the start of the Who\'s Coming page if there is no waiting list'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_whoscoming_pre_text', $booking_whoscoming_pre_text), ); $form['people_lists']['booking_whoscoming_pre_waitlist_text'] = array( '#title' => t('Text to use at the start of the Who\'s Coming page if there is a waiting list'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_whoscoming_pre_waitlist_text', $booking_whoscoming_pre_waitlist_text), ); $form['people_lists']['booking_whoscoming_post_text'] = array( '#title' => t('Text to use at the end of the Who\'s Coming page'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_whoscoming_post_text', $booking_whoscoming_post_text), ); /*Text for the Waiting List page*/ $form['people_lists']['booking_waitingpage_pre_text'] = array( '#title' => t('Text to use at the start of the Waiting List page'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_waitingpage_pre_text', $booking_waitingpage_pre_text), ); $form['people_lists']['booking_waitingpage_pre_nowaitlist_text'] = array( '#title' => t('Text to use at the start of the Waiting List page if there is no-one on the waiting list yet'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_waitingpage_pre_nowaitlist_text', $booking_waitingpage_pre_nowaitlist_text), ); $form['people_lists']['booking_waitingpage_post_text'] = array( '#title' => t('Text to use at the end of the Waiting List page'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_waitingpage_post_text', $booking_waitingpage_post_text), ); /*Text for the Travel Form page*/ $form['travel'] = array( '#type' => 'fieldset', '#title' => 'Travel Form Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['travel']['booking_travelform_page'] = array( '#title' => t('Text to use at the start of the travel form for a non-married person.'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_travelform_page', ''), ); $form['travel']['booking_travelform_married_page'] = array( '#title' => t('Text to use at the start of the travel form for a married couple. Only applies if combined pricing is enabled.'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_travelform_married_page', ''), ); $form['travel']['booking_travelform_completed_page'] = array( '#title' => t('Text to use on the travel form if the form has already been submitted.'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_travelform_completed_page', ''), ); /*Text for emails*/ $form['emails'] = array( '#type' => 'fieldset', '#title' => 'Built-In Workflow Email Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['emails']['booking_email_notification_text'] = array( '#title' => t('Notification Email'), '#type' => 'textarea', //'#format' => 'full_html', '#description' => t('Email to send to the notification email address (defined in general configuration) when a person has registered'), '#default_value' => variable_get('booking_email_notification_text', '[booking:regn-summary]'), ); $form['emails']['booking_email_bookedin_text'] = array( '#title' => t('Registration Successful Email'), '#type' => 'textarea', //'#format' => 'full_html', '#description' => t('Text to use in an email indicating the person has booked in, paid their deposit and is not on the waiting list'), '#default_value' => variable_get('booking_email_bookedin_text', $default_email_text), ); $form['emails']['booking_email_regn_complete_text'] = array( '#title' => t('Payment Complete Email'), '#type' => 'textarea', //'#format' => 'full_html', '#description' => t('Email text to indicate a person has booked in, fully paid and is not on the waiting list. ' . 'This will be sent either at initial registration if the full amount is paid, or when the balance is paid.'), '#default_value' => variable_get('booking_email_regn_complete_text', $booking_email_regn_complete_text), ); $form['emails']['booking_email_waitinglist_text'] = array( '#title' => t('Registration on Waiting List Email'), '#description' => t('Email text to indicate a person has registered but is on the waiting list. ' . 'This will be sent instead of the Registration Successful or Registration Complete emails if the person is on the waiting list.'), '#type' => 'textarea', //'#format' => 'full_html', '#default_value' => variable_get('booking_email_waitinglist_text', $booking_email_waitinglist_text), ); $form['emails']['booking_email_partialpayment_received_text'] = array( '#title' => t('Email text to send a person thanking them for their partial payment'), '#type' => 'textarea', //'#format' => 'full_html', '#description' => t(''), '#default_value' => variable_get('booking_email_partialpayment_received_text', ''), ); $form['emails']['booking_email_paymentoutstanding_subject'] = array ( '#type' => 'textfield', '#title' => t('Balance Outstanding Email Subject'), '#description' => t('Subject line for email advising attendee they missed the payment deadline'), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get('booking_email_paymentoutstanding_subject','[booking:eventname] payment required'), ); $form['emails']['booking_email_paymentoutstanding_text'] = array( '#description' => t('Email text to send a person reminding them of how much they owe'), '#type' => 'textarea', //'#format' => 'full_html', '#title' => t('Balance Outstanding Email Text'), '#default_value' => variable_get('booking_email_paymentoutstanding_text', $booking_email_paymentoutstanding_text), ); $form['emails']['booking_email_paymentoutstanding_married_text'] = array( '#title' => t('Email text to send a married couple reminding them of how much they both owe (only applies when combined pricing enabled)'), '#type' => 'textarea', //'#format' => 'full_html', '#description' => t(''), '#default_value' => variable_get('booking_email_paymentoutstanding_married_text', $booking_email_paymentoutstanding_married_text), ); $form['emails']['booking_email_waitinglistpromotion'] = array( '#title' => t('Email text to send a person on the waiting list when a spot opens up for them'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion), ); $form['emails']['booking_email_notcoming_demotion_subject'] = array ( '#type' => 'textfield', '#title' => t('Withdrawal Processed Email'), '#description' => t('Subject line for email advising attendee their withdrawal has been processed'), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get('booking_email_notcoming_demotion_subject','[booking:eventname] withdrawal processed'), ); $form['emails']['booking_email_notcoming_demotion'] = array( '#title' => t('Email text to send a person who withdraws their registration'), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get('booking_email_notcoming_demotion', $booking_email_notcoming_demotion), ); $form['emails']['booking_email_missedpayment_subject'] = array ( '#type' => 'textfield', '#title' => t('Missed Payment Email Subject'), '#description' => t('Subject line for email advising attendee they missed the payment deadline'), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get('booking_email_missedpayment_subject','[booking:eventname] payment deadline missed'), ); $form['emails']['booking_email_missedpayment'] = array( '#title' => t('Missed Payment Email Text'), '#type' => 'textarea', '#description' => t('Email text to send a person who missed the payment deadline'), '#default_value' => variable_get('booking_email_missedpayment', ''), ); $form['emails']['booking_email_travel_required_subject'] = array ( '#type' => 'textfield', '#title' => t('Travel Form Required Subject'), '#description' => t('Subject line for email requesting attendee to complete the travel form'), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get('booking_email_travel_required_subject','[booking:eventname] Travel Details Required'), ); $form['emails']['booking_email_travel_required_text'] = array( '#title' => t('Travel Form Required Text'), '#description' => t('Email text requesting attendee to complete the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))), '#type' => 'textarea', '#default_value' => variable_get('booking_email_travel_required_text', ''), ); $form['emails']['booking_email_travel_complete_subject'] = array ( '#type' => 'textfield', '#title' => t('Travel Form Complete Subject'), '#description' => t('Subject line for email indicating a person has completed the travel form'), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get('booking_email_travel_complete_subject','[booking:eventname] Travel Details Received'), ); $form['emails']['booking_email_travel_complete_text'] = array( '#title' => t('Travel Form Complete Text'), '#description' => t('Email text to indicate a person has completed the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))), '#type' => 'textarea', '#default_value' => variable_get('booking_email_travel_complete_text', ''), ); /*Text for emails*/ $form['custom-emails'] = array( '#type' => 'fieldset', '#title' => 'Custom Email Text Definitions', '#collapsible' => TRUE, '#collapsed' => TRUE, ); //add a bunch of custom emails for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) { $subject_fieldname = 'booking_email_subject_custom' . $i; $body_fieldname = 'booking_email_custom' . $i; $form['custom-emails'][$subject_fieldname] = array ( '#type' => 'textfield', '#title' => t('Subject line for Custom Email ' . $i), '#size' => 150, '#maxlength' => 300, '#default_value' => variable_get($subject_fieldname,'[booking:eventname]'), ); $form['custom-emails'][$body_fieldname] = array( '#title' => t('Email text for custom email ' . $i), '#type' => 'textarea', '#description' => t(''), '#default_value' => variable_get($body_fieldname, ''), ); } //see http://drupal.org/node/820816#comment-3100356 //and http://drupal.org/node/823362 /* $booking_email_test_text = variable_get('booking_email_test_text', array('value' => '', 'format' => NULL)); $form['booking_email_test_text'] = array( '#title' => t('Test email text'), '#type' => 'text_format', '#format' => isset($edit['format']) ? $edit['format'] : NULL, '#description' => t(''), '#default_value' => $booking_email_test_text['value'], ); */ return system_settings_form($form, FALSE); } function booking_tokens_admin_validate($form, $form_state) { } /** * Provide information about our custom placeholder/token. * * @see http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_token_info/7 * @see http://api.lullabot.com/token_example_token_info/7 * @return array * An associative array of available tokens and token types. */ function booking_token_info() { $info['types']['booking'] = array( 'name' => t('Booking Tokens'), 'description' => t('Tokens related to bookings module.'), 'needs-data' => 'booking', ); $info['tokens']['booking']['eventname'] = array( 'name' => t('Event Name'), 'description' => t('Name of the current event.') ); $info['tokens']['booking']['regn-count'] = array( 'name' => t('Registration Count'), 'description' => t('Number of people registered for the current event.') ); $info['tokens']['booking']['regn-max'] = array( 'name' => t('Registration Limit'), 'description' => t('Maximum allowed number of people for the current event.') ); $info['tokens']['booking']['contact-email'] = array( 'name' => t('Event Contact Email'), 'description' => t('Contact email address for the current event.') ); $info['tokens']['booking']['eventdates'] = array( 'name' => t('Event Dates'), 'description' => t('Dates of the current event.') ); $info['tokens']['booking']['fname'] = array( 'name' => t('First Name'), 'description' => t('First Name of the attendee.') ); $info['tokens']['booking']['lname'] = array( 'name' => t('Last Name'), 'description' => t('Last Name of the attendee.') ); $info['tokens']['booking']['team-colour'] = array( 'name' => t('Team Colour'), 'description' => t('Reading group team of attendee.') ); $info['tokens']['booking']['dietary'] = array( 'name' => t('Dietary Requirements'), 'description' => t('Specified dietary requirements of the attendee') ); $info['tokens']['booking']['payment-required'] = array( 'name' => t('Payment Required'), 'description' => t('The total amount required to complete the registration.') ); $info['tokens']['booking']['balance-payment-link'] = array( 'name' => t('Balance Payment Link'), 'description' => t('If using paypal, the link to the balance payment page.') ); $info['tokens']['booking']['confirm-payment-link'] = array( 'name' => t('Confirm Payment Link'), 'description' => t('If using paypal, the link to the booking confirmation page to complete a registration.') ); $info['tokens']['booking']['paypal-deposit-amount'] = array( 'name' => t('Paypal Deposit Only'), 'description' => t('The deposit amount required to confirm the registration including paypal fees.') ); $info['tokens']['booking']['paypal-total-amount'] = array( 'name' => t('Paypal Outstanding Balance'), 'description' => t('The total amount required to complete the registration including paypal fees.') ); $info['tokens']['booking']['paypal-deposit-form'] = array( 'name' => t('Paypal Deposit Form Button'), 'description' => t('The paypal form for the deposit amount.') ); $info['tokens']['booking']['paypal-total-form'] = array( 'name' => t('Paypal Total Form Button'), 'description' => t('The paypal form for the total amount.') ); $info['tokens']['booking']['booking-id'] = array( 'name' => t('Booking ID'), 'description' => t('ID of the user\'s registration.') ); $info['tokens']['booking']['waitinglist-position'] = array( 'name' => t('Waiting List Position'), 'description' => t('Position of the registrant on the waiting list.') ); $info['tokens']['booking']['payment-transaction-desc'] = array( 'name' => t('Transaction Decsription'), 'description' => t('Text description to use for a direct deposit transaction.') ); $info['tokens']['booking']['regn-summary'] = array( 'name' => t('Registration Summary'), 'description' => t('Summary of details from user registration.') ); $info['tokens']['booking']['travel-summary'] = array( 'name' => t('Registration Travel Summary'), 'description' => t('Summary of travel details from user registration.') ); $info['tokens']['booking']['studygroup-summary'] = array( 'name' => t('Registration Study Group Summary'), 'description' => t('Summary of allocated study groups.') ); $info['tokens']['booking']['leaderhelper-pair'] = array( 'name' => t('Registration Study Group Leader-Helper Pair'), 'description' => t('List out the leader and helper pairs, with intro text.') ); $info['tokens']['booking']['room-allocation'] = array( 'name' => t('Room Allocation'), 'description' => t('Details of room allocated to attendee.') ); $info['tokens']['booking']['bed-type'] = array( 'name' => t('Bed Type'), 'description' => t('The bed type allocated to attendee.') ); $info['tokens']['booking']['travel-link'] = array( 'name' => t('Travel form Link'), 'description' => t('Link to the person\'s travel form.') ); return $info; } /** * Provide replacement values for placeholder tokens. * * @see http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_tokens/7 * @see http://api.lullabot.com/token_example_tokens/7 * @param string $type * The machine-readable name of the type (group) of token being replaced, such * as 'node', 'user', or another type defined by a hook_token_info() * implementation. * @param array $tokens * An array of tokens to be replaced. The keys are the machine-readable token * names, and the values are the raw [type:token] strings that appeared in the * original text. * @param array $data (optional) * An associative array of data objects to be used when generating replacement * values, as supplied in the $data parameter to token_replace(). * @param array $options (optional) * An associative array of options for token replacement; see token_replace() * for possible values. * @return array * An associative array of replacement values, keyed by the raw [type:token] * strings from the original text. */ function booking_tokens($type, $tokens, array $data = array(), array $options = array()) { //watchdog('booking', 'Processing token request'); $replacements = array(); $sanitize = !empty($options['sanitize']); if ($type == 'booking') { foreach ($tokens as $name => $original) { if (array_key_exists($name, $data)) { $replacements[$original] = $data[$name]; } } } return $replacements; } function booking_define_tokens() { global $event; $booking_times = db_query("SELECT booking_event_start, booking_event_end FROM {booking_event} where eid = :eid", array(':eid' => $event->eid))->fetchObject(); $regncount_query = db_query("SELECT count(*) as num_ppl FROM {booking_person} where booking_eventid = :eventid and booking_status = 1", array(':eventid' => $event->eid)) ->fetchObject(); $tokens = array(); $tokens['eventname'] = $event->booking_eventname; $tokens['eventdates'] = _date_range_to_string(date("Y-m-d", $booking_times->booking_event_start), date("Y-m-d", $booking_times->booking_event_end)); $tokens['contact-us'] = l('contact us', 'contact-us'); $tokens['contact-email'] = variable_get('booking_contact_email'); $tokens['regn-count'] = $regncount_query->num_ppl; $tokens['regn-limit'] = variable_get('booking_regn_limit',0); return $tokens; } function booking_define_personspecific_tokens($node) { global $event; $amount_paid = 0; //get a count of the total number of people booked in to this event //but don't include people who haven't paid or have withdrawn their booking $result = db_query("SELECT count(*) as num_ppl FROM {booking_person} where booking_eventid = :eventid and (booking_status = 1 or booking_status = 2)", array(':eventid' => $event->eid)) ->fetchObject(); //calcalate a new temp id to be configured for this user if required if ($node->booking_tempid == '') { $tempid = _booking_uuidSecure(); //update the user with this tempid db_update('booking_person') ->fields(array( 'booking_tempid' => $tempid )) ->condition('nid', $node->nid) ->execute(); } else $tempid = $node->booking_tempid; //check how much has been paid by this person $amount_paid = _booking_amount_paid($node->nid); //generate the tokens $tokens = array(); $tokens['eventname'] = $event->booking_eventname; $tokens['contact-email'] = variable_get('booking_contact_email'); $tokens['team-colour'] = ucwords($node->booking_readinggroup); $tokens['fname'] = ucwords(trim($node->booking_firstname)); $tokens['lname'] = ucwords(trim($node->booking_lastname)); $tokens['dietary'] = ucwords(trim($node->booking_dietary)); $tokens['booking-id'] = $node->nid; //$tokens['payment-required'] = $node->booking_total_pay_reqd - $amount_paid; //$tokens['payment-required'] = _booking_amount_owing($node->nid, $amount_paid, FALSE); $tokens['payment-required'] = _booking_amount_owing($node, $amount_paid, FALSE); $tokens['waitinglist-position'] = $result->num_ppl - variable_get('booking_regn_limit',350) + 1; $tokens['payment-transaction-desc'] = $node->nid . ' ' . $node->booking_lastname; $tokens['balance-payment-link'] = url('balance/' . $tempid, array('absolute' => TRUE)); $tokens['confirm-payment-link'] = url('confirm/' . $tempid, array('absolute' => TRUE)); $tokens['paypal-total-amount'] = _booking_amount_owing($node, $amount_paid); //$tokens['paypal-total-amount'] = _booking_amount_owing($node->nid, $amount_paid); $tokens['paypal-deposit-amount'] = _booking_deposit_amount($node, TRUE); $tokens['regn-summary'] = _booking_details_email_summary($node); if (variable_get('booking_enable_travelform', 0) == 1) { $tokens['travel-link'] = url('travel/' . $tempid, array('absolute' => TRUE)); $tokens['travel-summary'] = _booking_travelform_email_summary($node); } if (variable_get('booking_enable_studygroups', 0) == 1) { $tokens['studygroup-summary'] = _booking_studygroup_email_summary($node); $tokens['leaderhelper-pair'] = _booking_leader_helper_email_summary($node); } if (variable_get('booking_enable_roomallocations', 0) == 1) { $tokens['room-allocation'] = _booking_room_email_summary($node); $tokens['bed-type'] = _booking_room_bedtype_lookup(empty($node->booking_room_bedtype) ? '0' : $node->booking_room_bedtype); } return $tokens; }