Add ability for admin to choose help areas via gui, enhance medical condition field in regn form
This commit is contained in:
@@ -321,9 +321,23 @@ function booking_admin() {
|
|||||||
'#type' => 'radios',
|
'#type' => 'radios',
|
||||||
'#title' => t('Enable help area questions?'),
|
'#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.'),
|
'#description' => t('Select whether to include questions about areas people are willing to help with in the booking form.'),
|
||||||
'#options' => array (0 => t('No'), t('Yes')),
|
'#options' => array (0 => t('No'), 1 => t('Yes')),
|
||||||
'#default_value' => variable_get('booking_enable_helpareas', 0),
|
'#default_value' => variable_get('booking_enable_helpareas', 0),
|
||||||
);
|
);
|
||||||
|
$form['regn_options']['booking_enabled_helparea_options'] = array (
|
||||||
|
'#type' => 'select',
|
||||||
|
'#multiple' => TRUE,
|
||||||
|
'#title' => t('Select help areas to enable'),
|
||||||
|
'#description' => t('Select which questions to include in the booking form.'),
|
||||||
|
'#options' => _booking_get_help_areas(),
|
||||||
|
'#default_value' => variable_get('booking_enabled_helparea_options', ''),
|
||||||
|
'#states' => array(
|
||||||
|
// Only show this field when the 'booking_enable_helpareas' checkbox is enabled.
|
||||||
|
'visible' => array(
|
||||||
|
':input[name="booking_enable_helpareas"]' => array('value' => 1),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
$form['regn_options']['booking_enable_skills'] = array (
|
$form['regn_options']['booking_enable_skills'] = array (
|
||||||
'#type' => 'radios',
|
'#type' => 'radios',
|
||||||
'#title' => t('Enable special skills information?'),
|
'#title' => t('Enable special skills information?'),
|
||||||
|
@@ -53,6 +53,21 @@ function _booking_status_lookup($input)
|
|||||||
return array_search($input, _booking_status_generate());
|
return array_search($input, _booking_status_generate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to provide a list of helping areas for the registration form
|
||||||
|
*/
|
||||||
|
function _booking_get_help_areas() {
|
||||||
|
return array(
|
||||||
|
'booking_help_music' => 'Music',
|
||||||
|
'booking_help_reading' => 'Reading',
|
||||||
|
'booking_help_chairing' => 'Chairing',
|
||||||
|
'booking_help_praying' => 'Praying',
|
||||||
|
'booking_help_meditations' => 'Meditations',
|
||||||
|
'booking_firstaid' => 'First Aid',
|
||||||
|
'booking_nurse' => 'Nurse',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to provide a list of emergency contact types for the registration form
|
* Helper function to provide a list of emergency contact types for the registration form
|
||||||
*/
|
*/
|
||||||
@@ -108,6 +123,7 @@ function _booking_studygroup_role_lookup($input = NULL)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to look up description of room location based on id
|
* Helper function to look up description of room location based on id
|
||||||
|
* DEPRECATED - THIS DATA HAS MOVED TO DATABASE TABLE
|
||||||
* @param $input integer containing room id
|
* @param $input integer containing room id
|
||||||
* @return string for corresponding room location
|
* @return string for corresponding room location
|
||||||
*/
|
*/
|
||||||
|
@@ -491,6 +491,14 @@ function booking_update_7227() {
|
|||||||
db_add_field('booking_person', 'booking_payment_complete', $spec);
|
db_add_field('booking_person', 'booking_payment_complete', $spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increase maximum length of booking_medical_conditions field to 1000 characters
|
||||||
|
*/
|
||||||
|
function booking_update_7228() {
|
||||||
|
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
|
||||||
|
db_change_field('booking_person', 'booking_medical_conditions', 'booking_medical_conditions', $spec);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_install().
|
* Implementation of hook_install().
|
||||||
*/
|
*/
|
||||||
@@ -573,8 +581,8 @@ function booking_schema() {
|
|||||||
'booking_luckynum' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
|
'booking_luckynum' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
|
||||||
'booking_readinggroup' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
'booking_readinggroup' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||||
'booking_shirt_size' => array('type' => 'varchar', 'length' => '20', 'not null' => FALSE),
|
'booking_shirt_size' => array('type' => 'varchar', 'length' => '20', 'not null' => FALSE),
|
||||||
'booking_dietary' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
'booking_dietary' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||||
'booking_medical_conditions' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
'booking_medical_conditions' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
|
||||||
//address details
|
//address details
|
||||||
'booking_street' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
'booking_street' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||||
'booking_suburb' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
'booking_suburb' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||||
|
@@ -58,8 +58,8 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
|||||||
date_default_timezone_set(date_default_timezone(FALSE));
|
date_default_timezone_set(date_default_timezone(FALSE));
|
||||||
|
|
||||||
//calculate what years to show in the date of birth field
|
//calculate what years to show in the date of birth field
|
||||||
$min_dob_years = _booking_year_offset(variable_get('booking_min_dob','1970-01-01 00:00:00'));
|
$min_dob_years = _booking_year_offset(variable_get('booking_min_dob','1970-01-01 00:00:00')) + 1;
|
||||||
$max_dob_years = _booking_year_offset(variable_get('booking_max_dob','1970-01-01 00:00:00'));
|
$max_dob_years = _booking_year_offset(variable_get('booking_max_dob','1970-01-01 00:00:00')) - 1;
|
||||||
$date_year_range = "-" . $min_dob_years . ':-' . $max_dob_years;
|
$date_year_range = "-" . $min_dob_years . ':-' . $max_dob_years;
|
||||||
|
|
||||||
//determine whether loading saved node or form submission
|
//determine whether loading saved node or form submission
|
||||||
@@ -704,7 +704,62 @@ if (variable_get('booking_enable_passport', 0) == 1)
|
|||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => 'Help Areas',
|
'#title' => 'Help Areas',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//retrieve help areas that have been enabled by admin
|
||||||
|
$enabled_help_areas = variable_get('booking_enabled_helparea_options', NULL);
|
||||||
|
//watchdog('booking', "<pre>Retreiving help area options:\n@info</pre>", array('@info' => print_r( $enabled_help_areas, true)));
|
||||||
|
|
||||||
|
//define help areas
|
||||||
|
$help_areas = array(
|
||||||
|
'booking_help_music' => array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('I can help with music by playing the following musical instrument(s)'),
|
||||||
|
'#maxlength' => 200,
|
||||||
|
'#required' => FALSE,
|
||||||
|
'#default_value' => !empty($data->booking_help_music) ? $data->booking_help_music : '',
|
||||||
|
),
|
||||||
|
'booking_help_reading' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I can help with reading'),
|
||||||
|
'#default_value' => (!empty($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
'booking_help_chairing' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I can help with chairing'),
|
||||||
|
'#default_value' => (!empty($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
'booking_help_praying' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I can help with praying'),
|
||||||
|
'#default_value' => (!empty($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
'booking_help_meditations' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I can help with evening meditations'),
|
||||||
|
'#default_value' => (!empty($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
'booking_firstaid' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I am a qualified First Aid Officer'),
|
||||||
|
'#default_value' => (!empty($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
'booking_nurse' => array(
|
||||||
|
'#type' => 'checkbox',
|
||||||
|
'#title' => t('I am a qualified Nurse'),
|
||||||
|
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
//include enabled help areas in the form
|
||||||
|
foreach ($help_areas as $key => $value)
|
||||||
|
{
|
||||||
|
if (in_array($key, $enabled_help_areas))
|
||||||
|
{
|
||||||
|
$form['help-areas'][$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$form['help-areas']['booking_help_music'] = array(
|
$form['help-areas']['booking_help_music'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('I can help with music by playing the following musical instrument(s)'),
|
'#title' => t('I can help with music by playing the following musical instrument(s)'),
|
||||||
@@ -742,6 +797,8 @@ if (variable_get('booking_enable_passport', 0) == 1)
|
|||||||
'#title' => t('I am a qualified Nurse'),
|
'#title' => t('I am a qualified Nurse'),
|
||||||
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variable_get('booking_enable_skills', 1) == 1)
|
if (variable_get('booking_enable_skills', 1) == 1)
|
||||||
@@ -872,20 +929,23 @@ if (variable_get('booking_enable_passport', 0) == 1)
|
|||||||
|
|
||||||
$form['misc-areas']['booking_medical_conditions_check'] = array(
|
$form['misc-areas']['booking_medical_conditions_check'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('I have special medical condition(s)'),
|
'#title' => t('I have special medical condition(s), including allergies'),
|
||||||
'#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
$form['misc-areas']['booking_medical_conditions'] = array(
|
$form['misc-areas']['booking_medical_conditions'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textarea',
|
||||||
'#title' => t('Please list any medical conditions we need to be aware of.'),
|
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
|
||||||
'#maxlength' => 120,
|
'#cols' => 60,
|
||||||
|
'#rows' => 5,
|
||||||
|
'#resizable' => FALSE,
|
||||||
'#required' => FALSE,
|
'#required' => FALSE,
|
||||||
'#states' => array(
|
'#states' => array(
|
||||||
'visible' => array(
|
'visible' => array(
|
||||||
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
|
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
'#attributes' => array('maxlength' => 1000),
|
||||||
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
|
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '',
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user