code formatting

This commit is contained in:
2016-05-02 17:42:24 +10:00
parent 1c222b87b3
commit b2a057622e
2 changed files with 542 additions and 477 deletions

View File

@@ -1,481 +1,549 @@
<?php <?php
// $Id: booking.admin.inc,v 0.1 2011/07/12
/** /**
* @file * @file
* Helper functions relating to the administration menu implementation for the booking module * The administration menu implementations for the booking module configuration pages
*/ */
function booking_admin() { function booking_admin()
{
//regenerate all our menu hooks when loading this form
menu_rebuild();
//regenerate stuff on this page load $form = array();
menu_rebuild();
$form = array (); $form['email'] = array(
'#type' => 'fieldset',
'#title' => 'Email Addresses'
);
$form['email'] = array ( $form['email']['booking_from_email'] = array(
'#type' => 'fieldset', '#type' => 'textfield',
'#title' => 'Email Addresses', '#title' => t('Sender Email Address'),
); '#description' => t("The email address used as the source of outbound emails."),
'#size' => 60,
'#maxlength' => 150,
'#required' => TRUE,
'#default_value' => variable_get('booking_from_email', variable_get('site_mail', ini_get('sendmail_from')))
);
$form['email']['booking_from_email'] = array ( $form['email']['booking_notify_email'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Sender Email Address'), '#title' => t('Notification Email Address(es)'),
'#description' => t("The email address used as the source of outbound emails."), '#description' => t("The email addresses to which registration notifications are sent."),
'#size' => 60, '#size' => 60,
'#maxlength' => 150, '#maxlength' => 200,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => variable_get('booking_from_email',variable_get('site_mail', ini_get('sendmail_from'))), '#default_value' => variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')))
); );
$form['email']['booking_notify_email'] = array ( $form['email']['booking_contact_email'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Notification Email Address(es)'), '#title' => t('Contact Email Address'),
'#description' => t("The email addresses to which registration notifications are sent."), '#description' => t("The email address attendees are instructed to contact for additional information."),
'#size' => 60, '#size' => 60,
'#maxlength' => 200, '#maxlength' => 150,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => variable_get('booking_notify_email',variable_get('site_mail', ini_get('sendmail_from'))), '#default_value' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from')))
); );
$form['email']['booking_contact_email'] = array ( $form['email']['booking_logistics_email'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Contact Email Address'), '#title' => t('Logistics Email Address'),
'#description' => t("The email address attendees are instructed to contact for additional information."), '#description' => t("The email address used for logistics information."),
'#size' => 60, '#size' => 60,
'#maxlength' => 150, '#maxlength' => 150,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => variable_get('booking_contact_email',variable_get('site_mail', ini_get('sendmail_from'))), '#default_value' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
); );
$form['email']['booking_custom_email_count'] = array(
'#type' => 'textfield',
'#title' => t('Number of custom email definitions'),
'#description' => t("Set to the number of custom email definitions to use."),
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('booking_custom_email_count', '5')
);
$form['email']['booking_logistics_email'] = array ( $form['attendee'] = array(
'#type' => 'textfield', '#type' => 'fieldset',
'#title' => t('Logistics Email Address'), '#title' => 'Attendee restrictions'
'#description' => t("The email address used for logistics information."), );
'#size' => 60,
'#maxlength' => 150,
'#required' => TRUE,
'#default_value' => variable_get('booking_logistics_email',variable_get('site_mail', ini_get('sendmail_from'))),
);
$form['email']['booking_custom_email_count'] = array (
'#type' => 'textfield',
'#title' => t('Number of custom email definitions'),
'#description' => t("Set to the number of custom email definitions to use."),
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('booking_custom_email_count','5'),
);
$form['attendee'] = array ( $form['attendee']['booking_max_dob'] = array(
'#type' => 'fieldset', '#type' => 'date_select',
'#title' => 'Attendee restrictions', '#title' => t('Maximum Date of Birth'),
); '#description' => t("The youngest date of birth you wish to allow into the event."),
'#default_value' => variable_get('booking_max_dob', '1995-04-15 00:00:00'),
'#date_format' => 'd/m/Y',
'#date_label_position' => 'within',
'#date_year_range' => '-60:-10'
);
$form['attendee']['booking_max_dob'] = array ( $form['attendee']['booking_enable_min_age_restriction'] = array(
'#type' => 'date_select', '#type' => 'radios',
'#title' => t('Maximum Date of Birth'), '#title' => t('Enable old age restriction?'),
'#description' => t("The youngest date of birth you wish to allow into the event."), '#description' => t('Set this to Yes if you wish to prevent people over the age defined below from registering.'),
'#default_value' => variable_get('booking_max_dob','1995-04-15 00:00:00'), '#options' => array(
'#date_format' => 'd/m/Y', 0 => t('No'),
'#date_label_position' => 'within', t('Yes')
'#date_year_range' => '-60:-10' ),
); '#default_value' => variable_get('booking_enable_min_age_restriction', 1)
);
$form['attendee']['booking_enable_min_age_restriction'] = array ( $form['attendee']['booking_min_dob'] = array(
'#type' => 'radios', '#type' => 'date_select',
'#title' => t('Enable old age restriction?'), '#title' => t('Minimum Date of Birth'),
'#description' => t('Set this to Yes if you wish to prevent people over the age defined below from registering.'), '#description' => t("The oldest date of birth you wish to allow into the event. Note that only the year is taken into account."),
'#options' => array (0 => t('No'), t('Yes')), '#default_value' => variable_get('booking_min_dob', '1995-04-15 00:00:00'),
'#default_value' => variable_get('booking_enable_min_age_restriction', 1), '#date_format' => 'd/m/Y',
); '#date_label_position' => 'within',
'#date_year_range' => '-60:-10'
);
$form['attendee']['booking_min_dob'] = array ( $form['attendee']['booking_regn_limit'] = array(
'#type' => 'date_select', '#type' => 'textfield',
'#title' => t('Minimum Date of Birth'), '#title' => t('Registration limit'),
'#description' => t("The oldest date of birth you wish to allow into the event. Note that only the year is taken into account."), '#description' => t("Total number of attendees permitted."),
'#default_value' => variable_get('booking_min_dob','1995-04-15 00:00:00'), '#size' => 5,
'#date_format' => 'd/m/Y', '#maxlength' => 5,
'#date_label_position' => 'within', '#required' => TRUE,
'#date_year_range' => '-60:-10' '#default_value' => variable_get('booking_regn_limit', '500')
); );
$form['attendee']['booking_regn_limit'] = array ( $form['paypal'] = array(
'#type' => 'textfield', '#type' => 'fieldset',
'#title' => t('Registration limit'), '#title' => 'Paypal Settings'
'#description' => t("Total number of attendees permitted."), );
'#size' => 5, $form['paypal']['booking_use_paypal'] = array(
'#maxlength' => 5, '#type' => 'radios',
'#required' => TRUE, '#title' => t('Use Paypal?'),
'#default_value' => variable_get('booking_regn_limit','500'), '#description' => t('Select whether to use paypal for automatic payment handling, or process payments manually.'),
); '#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_use_paypal', 0)
);
$form['paypal']['booking_paypal_account'] = array(
'#type' => 'textfield',
'#title' => t('Specify Paypal Account Address'),
'#default_value' => variable_get('booking_paypal_account', ''),
'#description' => '(email address)'
);
$form['paypal']['booking_paypal_sandbox'] = array(
'#type' => 'radios',
'#title' => t('Sandbox/Development mode'),
'#description' => t('When in development mode, the payment gateway will point at sandbox.paypal.com for testing purposes. Leave this as off unless doing testing.'),
'#options' => array(
0 => t('Off'),
t('On')
),
'#default_value' => variable_get('booking_paypal_sandbox', 0)
);
$form['paypal']['booking_paypal_transaction_fee_fixedcost'] = array(
'#type' => 'textfield',
'#title' => t('Paypal fixed cost transaction fee'),
'#default_value' => variable_get('booking_paypal_transaction_fee_fixedcost', '0.3'),
'#field_prefix' => '$',
'#size' => 5,
'#description' => 'Transaction fee is currently $0.3 AUD and is added before the percentage fee is applied.'
);
$form['paypal']['booking_paypal_transaction_fee_percentage'] = array(
'#type' => 'textfield',
'#title' => t('Paypal Percentage Transaction Fee'),
'#default_value' => variable_get('booking_paypal_transaction_fee_percentage', '2.6'),
'#field_prefix' => '%',
'#size' => 5,
'#description' => 'Percentage of transaction charged as paypal fee, currently 2.6% in Australia'
);
$form['paypal']['booking_paypal_transaction_fee_percentage_intl'] = array(
'#type' => 'textfield',
'#title' => t('Paypal Percentage Transaction Fee (International)'),
'#default_value' => variable_get('booking_paypal_transaction_fee_percentage_intl', '3.6'),
'#field_prefix' => '%',
'#size' => 5,
'#description' => 'Percentage of transaction charged as paypal fee for transactions that include currency conversion, currently 3.6% in Australia'
);
$form['paypal'] = array ( $form['features'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Paypal Settings', '#title' => 'Enable/Disable Features'
); );
$form['paypal']['booking_use_paypal'] = array ( $form['features']['booking_enable_roomallocations'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Use Paypal?'), '#title' => t('Enable room allocations?'),
'#description' => t('Select whether to use paypal for automatic payment handling, or process payments manually.'), '#description' => t('Select whether to enable the management and allocation of rooms.'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array(
'#default_value' => variable_get('booking_use_paypal', 0), 0 => t('No'),
); t('Yes')
$form['paypal']['booking_paypal_account'] = array ( ),
'#type' => 'textfield', '#default_value' => variable_get('booking_enable_roomallocations', 0)
'#title' => t('Specify Paypal Account Address'), );
'#default_value' => variable_get('booking_paypal_account', ''), $form['features']['booking_enable_travelform'] = array(
'#description' => '(email address)', '#type' => 'radios',
); '#title' => t('Enable travel details form?'),
$form['paypal']['booking_paypal_sandbox'] = array ( '#description' => t('Select whether to enable the form that allows attendees to enter their travel details.'),
'#type' => 'radios', '#options' => array(
'#title' => t('Sandbox/Development mode'), 0 => t('No'),
'#description' => t('When in development mode, the payment gateway will point at sandbox.paypal.com for testing purposes. Leave this as off unless doing testing.'), t('Yes')
'#options' => array (0 => t('Off'), t('On')), ),
'#default_value' => variable_get('booking_paypal_sandbox', 0), '#default_value' => variable_get('booking_enable_travelform', 0)
); );
$form['paypal']['booking_paypal_transaction_fee_fixedcost'] = array ( $form['features']['booking_enable_studygroups'] = array(
'#type' => 'textfield', '#type' => 'radios',
'#title' => t('Paypal fixed cost transaction fee'), '#title' => t('Enable study group calculations?'),
'#default_value' => variable_get('booking_paypal_transaction_fee_fixedcost', '0.3'), '#description' => t('Select whether to enable the creation and management of study groups.'),
'#field_prefix' => '$', '#options' => array(
'#size' => 5, 0 => t('No'),
'#description' => 'Transaction fee is currently $0.3 AUD and is added before the percentage fee is applied.', t('Yes')
); ),
$form['paypal']['booking_paypal_transaction_fee_percentage'] = array ( '#default_value' => variable_get('booking_enable_studygroups', 0)
'#type' => 'textfield', );
'#title' => t('Paypal Percentage Transaction Fee'), $form['features']['booking_enable_variety_sessions'] = array(
'#default_value' => variable_get('booking_paypal_transaction_fee_percentage', '2.6'), '#type' => 'radios',
'#field_prefix' => '%', '#title' => t('Enable variety session form?'),
'#size' => 5, '#description' => t('Note that this feature is still under development and cannot yet be used.'),
'#description' => 'Percentage of transaction charged as paypal fee, currently 2.6% in Australia', '#options' => array(
); 0 => t('No'),
$form['paypal']['booking_paypal_transaction_fee_percentage_intl'] = array ( t('Yes')
'#type' => 'textfield', ),
'#title' => t('Paypal Percentage Transaction Fee (International)'), '#default_value' => variable_get('booking_enable_variety_sessions', 0)
'#default_value' => variable_get('booking_paypal_transaction_fee_percentage_intl', '3.6'), );
'#field_prefix' => '%',
'#size' => 5,
'#description' => 'Percentage of transaction charged as paypal fee for transactions that include currency conversion, currently 3.6% in Australia',
);
$form['features'] = array ( $form['features']['booking_publish_readinggroups'] = array(
'#type' => 'fieldset', '#type' => 'radios',
'#title' => 'Enable/Disable Features', '#title' => t('Display reading group colours on the Who\'s Coming page?'),
); '#description' => t('Select whether to publish reading group colours. This option is only applicable if study groups are enabled.'),
$form['features']['booking_enable_roomallocations'] = array ( '#options' => array(
'#type' => 'radios', 0 => t('No'),
'#title' => t('Enable room allocations?'), t('Yes')
'#description' => t('Select whether to enable the management and allocation of rooms.'), ),
'#options' => array (0 => t('No'), t('Yes')), '#default_value' => variable_get('booking_publish_readinggroups', 0)
'#default_value' => variable_get('booking_enable_roomallocations', 0), );
);
$form['features']['booking_enable_travelform'] = array (
'#type' => 'radios',
'#title' => t('Enable travel details form?'),
'#description' => t('Select whether to enable the form that allows attendees to enter their travel details.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_travelform', 0),
);
$form['features']['booking_enable_studygroups'] = array (
'#type' => 'radios',
'#title' => t('Enable study group calculations?'),
'#description' => t('Select whether to enable the creation and management of study groups.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_studygroups', 0),
);
/*
//deprecated now, this information is set in the db table
$form['features']['booking_readinggroup_id'] = array (
'#type' => 'textfield',
'#title' => t('Studygroup ID for the reading group'),
'#description' => t("Set the ID for the studygroup that corresponds with the reading group. "
. " This option is only applicable if study groups are enabled. Set to zero if reading groups aren't in use. "
. " If in doubt, leave as zero."),
'#size' => 3,
'#maxlength' => 3,
'#default_value' => variable_get('booking_readinggroup_id','0'),
);
*/
$form['features']['booking_enable_variety_sessions'] = array (
'#type' => 'radios',
'#title' => t('Enable variety session form?'),
'#description' => t('Note that this feature is still under development and cannot yet be used.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_variety_sessions', 0),
);
$form['features']['booking_publish_readinggroups'] = array ( $form['misc'] = array(
'#type' => 'radios', '#type' => 'fieldset',
'#title' => t('Display reading group colours on the Who\'s Coming page?'), '#title' => 'Configuration Options'
'#description' => t('Select whether to publish reading group colours. This option is only applicable if study groups are enabled.'), );
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_publish_readinggroups', 0),
);
$form['misc'] = array ( $form['misc']['booking_auto_confirm_email'] = array(
'#type' => 'fieldset', '#type' => 'radios',
'#title' => 'Configuration Options', '#title' => t('Send An Automatic Registration Email?'),
); '#description' => t('Automatically send a confirmation email to a user when they\'ve registered for an event? Set this to No if using paypal and only showing on the "whos coming" page once a person has paid. Or set to Yes if "Show on lists once booked in" is set to No and paypal is not being used. If set to No, a registration confirmation email will be sent to a user when their registration status changes to Paid, either manually or via paypal plugin. '),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_auto_confirm_email', 0)
);
$form['misc']['booking_auto_workflow_email'] = array(
'#type' => 'radios',
'#title' => t('Send An Automatic Workflow Email?'),
'#description' => t('Automatically send workflow emails to attendee on events such as status changes, travel details received, etc'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_auto_workflow_email', 0)
);
$form['misc']['booking_bcc_notify_email_workflow'] = array(
'#type' => 'radios',
'#title' => t('Include notification email address on outgoing workflow emails?'),
'#description' => t('Send a BCC of any workflow email generated to the notification email address as well'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_bcc_notify_email_workflow', 0)
);
$form['misc']['booking_auto_show_on_lists'] = array(
'#type' => 'radios',
'#title' => t('Show on lists once booked in?'),
'#description' => t('Immediately appear on bookedin/waiting lists even before payment is received?'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_auto_show_on_lists', 0)
);
$form['misc']['booking_auto_confirm_email'] = array ( $form['misc']['booking_enable_combined_pricing'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Send An Automatic Registration Email?'), '#title' => t('Use Combined Pricing?'),
'#description' => t('Automatically send a confirmation email to a user when they\'ve registered for an event? Set this to No if using paypal and only showing on the "whos coming" page once a person has paid. Or set to Yes if "Show on lists once booked in" is set to No and paypal is not being used. If set to No, a registration confirmation email will be sent to a user when their registration status changes to Paid, either manually or via paypal plugin. '), '#description' => t('Select whether to combine pricing for married couples (Yes) or have each spouse pay separately (No).'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array(
'#default_value' => variable_get('booking_auto_confirm_email', 0), 0 => t('No'),
); t('Yes')
$form['misc']['booking_auto_workflow_email'] = array ( ),
'#type' => 'radios', '#default_value' => variable_get('booking_enable_combined_pricing', 0)
'#title' => t('Send An Automatic Workflow Email?'), );
'#description' => t('Automatically send workflow emails to attendee on events such as status changes, travel details received, etc'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_auto_workflow_email', 0),
);
$form['misc']['booking_bcc_notify_email_workflow'] = array (
'#type' => 'radios',
'#title' => t('Include notification email address on outgoing workflow emails?'),
'#description' => t('Send a BCC of any workflow email generated to the notification email address as well'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_bcc_notify_email_workflow', 0),
);
$form['misc']['booking_auto_show_on_lists'] = array (
'#type' => 'radios',
'#title' => t('Show on lists once booked in?'),
'#description' => t('Immediately appear on bookedin/waiting lists even before payment is received?'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_auto_show_on_lists', 0),
);
$form['misc']['booking_enable_combined_pricing'] = array ( $form['regn_options'] = array(
'#type' => 'radios', '#type' => 'fieldset',
'#title' => t('Use Combined Pricing?'), '#title' => 'Registration Form Configuration'
'#description' => t('Select whether to combine pricing for married couples (Yes) or have each spouse pay separately (No).'), );
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_combined_pricing', 0),
);
$form['regn_options'] = array ( $form['regn_options']['booking_default_country'] = array(
'#type' => 'fieldset', '#type' => 'select',
'#title' => 'Registration Form Configuration', '#title' => t('Select Default Country'),
); '#description' => t('Select default country for residential address.'),
'#options' => _booking_country_options(),
'#default_value' => variable_get('booking_default_country', 'Australia')
);
$form['regn_options']['booking_default_state'] = array(
'#type' => 'select',
'#title' => t('Select Default State'),
'#description' => t('Select default state for residential address. Select the last value (blank) in most cases, to ensure attendees choose a value for this field'),
'#options' => _booking_state_options(),
'#default_value' => variable_get('booking_default_state', 'NSW')
);
$form['regn_options']['booking_default_country'] = array ( $form['regn_options']['booking_default_gender'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Select Default Country'), '#title' => t('Select Default Gender'),
'#description' => t('Select default country for residential address.'), '#description' => t('Select default gender for booking form.'),
'#options' => _booking_country_options(), '#options' => _booking_gender_options(),
'#default_value' => variable_get('booking_default_country', 'Australia'), '#default_value' => variable_get('booking_default_gender', 'M')
); );
$form['regn_options']['booking_default_state'] = array (
'#type' => 'select',
'#title' => t('Select Default State'),
'#description' => t('Select default state for residential address. Select the last value (blank) in most cases, to ensure attendees choose a value for this field'),
'#options' => _booking_state_options(),
'#default_value' => variable_get('booking_default_state', 'NSW'),
);
$form['regn_options']['booking_default_gender'] = array ( $form['regn_options']['booking_allow_couples'] = array(
'#type' => 'select', '#type' => 'radios',
'#title' => t('Select Default Gender'), '#title' => t('Allow married couples?'),
'#description' => t('Select default gender for booking form.'), '#description' => t('Select whether to cater for married couples in the registration form'),
'#options' => _booking_gender_options(), '#options' => array(
'#default_value' => variable_get('booking_default_gender', 'M'), 0 => t('No'),
); t('Yes')
),
'#default_value' => variable_get('booking_allow_couples', 0)
);
$form['regn_options']['booking_ask_dependant_children'] = array(
'#type' => 'radios',
'#title' => t('Ask whether a couple has dependant children attending?'),
'#description' => t('Select whether to ask about dependant children of married couples in the registration form'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_ask_dependant_children', 0)
);
$form['regn_options']['booking_dependant_children_text_definition'] = array(
'#type' => 'textfield',
'#title' => t('Text to display about dependant children'),
'#default_value' => variable_get('booking_dependant_children_text_definition', '<b>Please note that only one dependant child under the age of two is allowed.</b>'),
'#description' => 'Text to use on registration form if married couple has said they are bringing children.',
'#size' => 150,
'#maxlength' => 1000,
'#states' => array(
// Only show this field when the 'booking_enable_dietary' radio option is set to No
'visible' => array(
':input[name="booking_ask_dependant_children"]' => array(
'value' => 1
)
)
)
);
$form['regn_options']['booking_allow_couples'] = array ( $form['regn_options']['booking_dependant_children_text'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Allow married couples?'), '#title' => t('Ask whether a couple has dependant children attending?'),
'#description' => t('Select whether to cater for married couples in the registration form'), '#description' => t('Select whether to ask about dependant children of married couples in the registration form'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array(
'#default_value' => variable_get('booking_allow_couples', 0), 0 => t('No'),
); t('Yes')
$form['regn_options']['booking_ask_dependant_children'] = array ( ),
'#type' => 'radios', '#default_value' => variable_get('booking_ask_dependant_children', 0)
'#title' => t('Ask whether a couple has dependant children attending?'), );
'#description' => t('Select whether to ask about dependant children of married couples in the registration form'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_ask_dependant_children', 0),
);
$form['regn_options']['booking_dependant_children_text_definition'] = array (
'#type' => 'textfield',
'#title' => t('Text to display about dependant children'),
'#default_value' => variable_get('booking_dependant_children_text_definition', '<b>Please note that only one dependant child under the age of two is allowed.</b>'),
'#description' => 'Text to use on registration form if married couple has said they are bringing children.',
'#size' => 150,
'#maxlength' => 1000,
'#states' => array(
// Only show this field when the 'booking_enable_dietary' radio option is set to No
'visible' => array(
':input[name="booking_ask_dependant_children"]' => array('value' => 1),
),
),
);
$form['regn_options']['booking_dependant_children_text'] = array ( $form['regn_options']['booking_enable_medicare'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Ask whether a couple has dependant children attending?'), '#title' => t('Enable Medicare requirement?'),
'#description' => t('Select whether to ask about dependant children of married couples in the registration form'), '#description' => t('Select whether to include medicare details on registration form.'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array(
'#default_value' => variable_get('booking_ask_dependant_children', 0), 0 => t('No'),
); t('Yes')
),
'#default_value' => variable_get('booking_enable_medicare', 1)
);
$form['regn_options']['booking_enforce_medicare_verification'] = array(
'#type' => 'radios',
'#title' => t('Force Medicare verification?'),
'#description' => t('Prevent people from registering if they do not enter a valid medicare card? (Only applies if medicare details are enabled).'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enforce_medicare_verification', 1)
);
$form['regn_options']['booking_tshirts_text_definition'] = array(
'#type' => 'textfield',
'#title' => t('Clothes Sizing Text Definition'),
'#default_value' => variable_get('booking_tshirts_text_definition', 'Preferred t-shirt size'),
'#description' => 'Text to use on registration form to request clothing size (eg t-shirt or hoodie).',
'#size' => 150,
'#maxlength' => 2000
);
$form['regn_options']['booking_enable_tshirts'] = array(
'#type' => 'radios',
'#title' => t('Enable sizing information?'),
'#description' => t('Select whether to include clothe sizing in the booking form.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_tshirts', 0)
);
$form['regn_options']['booking_enable_medicare'] = array ( $form['regn_options']['booking_enable_passport'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Enable Medicare requirement?'), '#title' => t('Enable passport information?'),
'#description' => t('Select whether to include medicare details on registration form.'), '#description' => t('Select whether to include passport details in the booking form.'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array(
'#default_value' => variable_get('booking_enable_medicare', 1), 0 => t('No'),
); t('Yes')
$form['regn_options']['booking_enforce_medicare_verification'] = array ( ),
'#type' => 'radios', '#default_value' => variable_get('booking_enable_passport', 0)
'#title' => t('Force Medicare verification?'), );
'#description' => t('Prevent people from registering if they do not enter a valid medicare card? (Only applies if medicare details are enabled).'), $form['regn_options']['booking_enable_helpareas'] = array(
'#options' => array (0 => t('No'), t('Yes')), '#type' => 'radios',
'#default_value' => variable_get('booking_enforce_medicare_verification', 1), '#title' => t('Enable help area questions?'),
); '#description' => t('Select whether to include questions about areas people are willing to help with in the booking form.'),
$form['regn_options']['booking_tshirts_text_definition'] = array ( '#options' => array(
'#type' => 'textfield', 0 => t('No'),
'#title' => t('Clothes Sizing Text Definition'), 1 => t('Yes')
'#default_value' => variable_get('booking_tshirts_text_definition', 'Preferred t-shirt size'), ),
'#description' => 'Text to use on registration form to request clothing size (eg t-shirt or hoodie).', '#default_value' => variable_get('booking_enable_helpareas', 0)
'#size' => 150, );
'#maxlength' => 2000, $form['regn_options']['booking_enabled_helparea_options'] = array(
); '#type' => 'select',
$form['regn_options']['booking_enable_tshirts'] = array ( '#multiple' => TRUE,
'#type' => 'radios', '#title' => t('Select help areas to enable'),
'#title' => t('Enable sizing information?'), '#description' => t('Select which questions to include in the booking form. Ensure you hold down control/command when selecting multiple options.'),
'#description' => t('Select whether to include clothe sizing in the booking form.'), '#options' => _booking_get_help_areas(),
'#options' => array (0 => t('No'), t('Yes')), '#default_value' => variable_get('booking_enabled_helparea_options', ''),
'#default_value' => variable_get('booking_enable_tshirts', 0), '#states' => array(
); // Only show this field when the 'booking_enable_helpareas' radio option is set to true
'visible' => array(
':input[name="booking_enable_helpareas"]' => array(
'value' => 1
)
)
)
);
$form['regn_options']['booking_enable_skills'] = array(
'#type' => 'radios',
'#title' => t('Enable special skills information?'),
'#description' => t('Select whether to include questions about special skills people have in the booking form.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_skills', 0)
);
$form['regn_options']['booking_enable_roommate'] = array(
'#type' => 'radios',
'#title' => t('Enable room-mate selection?'),
'#description' => t('Select whether to allow attendees to list a preferred room-mate in the booking form.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_roommate', 0)
);
$form['regn_options']['booking_enable_dietary'] = array(
'#type' => 'radios',
'#title' => t('Allow attendee to specify dietary requirements?'),
'#description' => t('If set to No, the following text definition will be used instead.'),
'#options' => array(
0 => t('No'),
1 => t('Yes')
),
'#default_value' => variable_get('booking_enable_dietary', 0)
);
$form['regn_options']['booking_dietary_text_definition'] = array(
'#type' => 'textfield',
'#title' => t('Dietary Requirements Text Definition'),
'#default_value' => variable_get('booking_dietary_text_definition', 'Please use the contact us form to indicate what dietary requirements you have.'),
'#description' => 'Text to use on registration form if attendee may not specify dietary requirements.',
'#size' => 150,
'#maxlength' => 2000,
'#states' => array(
// Only show this field when the 'booking_enable_dietary' radio option is set to No
'visible' => array(
':input[name="booking_enable_dietary"]' => array(
'value' => 0
)
)
)
);
$form['regn_options']['booking_enable_medcond'] = array(
'#type' => 'radios',
'#title' => t('Allow attendee to specify medical conditions?'),
'#description' => t('If set to No, the following text definition will be used instead.'),
'#options' => array(
0 => t('No'),
1 => t('Yes')
),
'#default_value' => variable_get('booking_enable_medcond', 0)
);
$form['regn_options']['booking_medcond_text_definition'] = array(
'#type' => 'textfield',
'#title' => t('Medical Condition Text Definition'),
'#default_value' => variable_get('booking_medcond_text_definition', 'Please use the contact us form to indicate what medical condition you have.'),
'#description' => 'Text to use on registration form if attendee may not specify a medical condition.',
'#size' => 150,
'#maxlength' => 2000,
'#states' => array(
// Only show this field when the 'booking_enable_medcond' radio option is set to No
'visible' => array(
':input[name="booking_enable_medcond"]' => array(
'value' => 0
)
)
)
);
$form['regn_options']['booking_enable_passport'] = array ( $form['management'] = array(
'#type' => 'radios', '#type' => 'fieldset',
'#title' => t('Enable passport information?'), '#title' => 'Data Management Options'
'#description' => t('Select whether to include passport details in the booking form.'), );
'#options' => array (0 => t('No'), t('Yes')), $form['management']['booking_csv_exclude_fields'] = array(
'#default_value' => variable_get('booking_enable_passport', 0), '#type' => 'textfield',
); '#title' => t('Fields to exclude from CSV report'),
$form['regn_options']['booking_enable_helpareas'] = array ( '#default_value' => variable_get('booking_csv_exclude_fields', ''),
'#type' => 'radios', '#description' => 'Separate each field with a semi-colon. Field names as per database schema.',
'#title' => t('Enable help area questions?'), '#size' => 150,
'#description' => t('Select whether to include questions about areas people are willing to help with in the booking form.'), '#maxlength' => 2000
'#options' => array (0 => t('No'), 1 => t('Yes')), );
'#default_value' => variable_get('booking_enable_helpareas', 0), $form['management']['booking_import_include_fields'] = array(
); '#type' => 'textfield',
$form['regn_options']['booking_enabled_helparea_options'] = array ( '#title' => t('Fields to import from an uploaded CSV file'),
'#type' => 'select', '#default_value' => variable_get('booking_import_include_fields', ''),
'#multiple' => TRUE, '#description' => 'Separate each field with a semi-colon. Field names as per database schema, case sensitive. Nid and booking_status fields compulsory.',
'#title' => t('Select help areas to enable'), '#size' => 150,
'#description' => t('Select which questions to include in the booking form. Ensure you hold down control/command when selecting multiple options.'), '#maxlength' => 2000
'#options' => _booking_get_help_areas(), );
'#default_value' => variable_get('booking_enabled_helparea_options', ''), return system_settings_form($form);
'#states' => array(
// Only show this field when the 'booking_enable_helpareas' radio option is set to true
'visible' => array(
':input[name="booking_enable_helpareas"]' => array('value' => 1),
),
),
);
$form['regn_options']['booking_enable_skills'] = array (
'#type' => 'radios',
'#title' => t('Enable special skills information?'),
'#description' => t('Select whether to include questions about special skills people have in the booking form.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_skills', 0),
);
$form['regn_options']['booking_enable_roommate'] = array (
'#type' => 'radios',
'#title' => t('Enable room-mate selection?'),
'#description' => t('Select whether to allow attendees to list a preferred room-mate in the booking form.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_roommate', 0),
);
$form['regn_options']['booking_enable_dietary'] = array (
'#type' => 'radios',
'#title' => t('Allow attendee to specify dietary requirements?'),
'#description' => t('If set to No, the following text definition will be used instead.'),
'#options' => array (0 => t('No'), 1 => t('Yes')),
'#default_value' => variable_get('booking_enable_dietary', 0),
);
$form['regn_options']['booking_dietary_text_definition'] = array (
'#type' => 'textfield',
'#title' => t('Dietary Requirements Text Definition'),
'#default_value' => variable_get('booking_dietary_text_definition', 'Please use the contact us form to indicate what dietary requirements you have.'),
'#description' => 'Text to use on registration form if attendee may not specify dietary requirements.',
'#size' => 150,
'#maxlength' => 2000,
'#states' => array(
// Only show this field when the 'booking_enable_dietary' radio option is set to No
'visible' => array(
':input[name="booking_enable_dietary"]' => array('value' => 0),
),
),
);
$form['regn_options']['booking_enable_medcond'] = array (
'#type' => 'radios',
'#title' => t('Allow attendee to specify medical conditions?'),
'#description' => t('If set to No, the following text definition will be used instead.'),
'#options' => array (0 => t('No'), 1 => t('Yes')),
'#default_value' => variable_get('booking_enable_medcond', 0),
);
$form['regn_options']['booking_medcond_text_definition'] = array (
'#type' => 'textfield',
'#title' => t('Medical Condition Text Definition'),
'#default_value' => variable_get('booking_medcond_text_definition', 'Please use the contact us form to indicate what medical condition you have.'),
'#description' => 'Text to use on registration form if attendee may not specify a medical condition.',
'#size' => 150,
'#maxlength' => 2000,
'#states' => array(
// Only show this field when the 'booking_enable_medcond' radio option is set to No
'visible' => array(
':input[name="booking_enable_medcond"]' => array('value' => 0),
),
),
);
$form['management'] = array (
'#type' => 'fieldset',
'#title' => 'Data Management Options',
);
$form['management']['booking_csv_exclude_fields'] = array (
'#type' => 'textfield',
'#title' => t('Fields to exclude from CSV report'),
'#default_value' => variable_get('booking_csv_exclude_fields', ''),
'#description' => 'Separate each field with a semi-colon. Field names as per database schema.',
'#size' => 150,
'#maxlength' => 2000,
);
$form['management']['booking_import_include_fields'] = array (
'#type' => 'textfield',
'#title' => t('Fields to import from an uploaded CSV file'),
'#default_value' => variable_get('booking_import_include_fields', ''),
'#description' => 'Separate each field with a semi-colon. Field names as per database schema, case sensitive. Nid and booking_status fields compulsory.',
'#size' => 150,
'#maxlength' => 2000,
);
return system_settings_form($form);
} }
function booking_admin_validate($form, $form_state) { function booking_admin_validate($form, $form_state)
//TODO: put back in when using booking start and end dates {
/* //TODO: put back in when using booking start and end dates
$booking_start = $form_state['values']['booking_start']; /*
$booking_end = $form_state['values']['booking_end']; $booking_start = $form_state['values']['booking_start'];
$booking_end = $form_state['values']['booking_end'];
//create timestamps for comparison //create timestamps for comparison
$booking_start_ts = _date_to_ts( $booking_start ); $booking_start_ts = _date_to_ts( $booking_start );
$booking_end_ts = _date_to_ts( $booking_end ); $booking_end_ts = _date_to_ts( $booking_end );
//validate main conference start and end dates //validate main conference start and end dates
if ($booking_start_ts > $booking_end_ts) { if ($booking_start_ts > $booking_end_ts) {
form_set_error('booking_date_endbeforestart', t('You have selected a Conference end date that is before the Conference start date.')); form_set_error('booking_date_endbeforestart', t('You have selected a Conference end date that is before the Conference start date.'));
} else { } else {
variable_set('booking_conference_dates', _date_range_to_string($booking_start, $booking_end)); variable_set('booking_conference_dates', _date_range_to_string($booking_start, $booking_end));
drupal_set_message( t('Conference date range: "!date"', array ('!date' => _date_range_to_string($booking_start, $booking_end)))); drupal_set_message( t('Conference date range: "!date"', array ('!date' => _date_range_to_string($booking_start, $booking_end))));
}
*/
} }
*/
}

View File

@@ -14,12 +14,9 @@
* Load module includes * Load module includes
*/ */
//TODO: Dynamic event IDs instead of hard coding it here. Also defined in booking.install
define('EVENTID', 1);
define('BOOKING_PAYPAL_SUBMIT_URL', 'https://www.paypal.com/cgi-bin/webscr'); define('BOOKING_PAYPAL_SUBMIT_URL', 'https://www.paypal.com/cgi-bin/webscr');
define('BOOKING_PAYPAL_SUBMIT_URL_SANDBOX', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); define('BOOKING_PAYPAL_SUBMIT_URL_SANDBOX', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn'); define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn');
define('BOOKING_DEFAULT_STATE', 'NSW');
// Load the include for various constants // Load the include for various constants
module_load_include('inc', 'booking', 'booking.constants'); module_load_include('inc', 'booking', 'booking.constants');