update form to ask previous sw question
This commit is contained in:
@@ -130,7 +130,19 @@ function _get_tshirt_options() {
|
|||||||
return $options_array;
|
return $options_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to provide a list of options for the previous study week count field of the registration form
|
||||||
|
*/
|
||||||
|
function _get_previous_sw_options() {
|
||||||
|
$options_array = array();
|
||||||
|
$options_array[''] = '';
|
||||||
|
|
||||||
|
for ($i = 0; $i < 6; $i++) {
|
||||||
|
$options_array[$i] = $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options_array;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to look up description of studygroup role
|
* Helper function to look up description of studygroup role
|
||||||
|
@@ -957,6 +957,15 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
'#default_value' => !empty($data->booking_freestyle_text) ? $data->booking_freestyle_text : ''
|
'#default_value' => !empty($data->booking_freestyle_text) ? $data->booking_freestyle_text : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (variable_get('booking_enable_previous_studyweeks', 0) == 1) {
|
||||||
|
$form['misc-areas']['booking_prev_sw_count'] = array(
|
||||||
|
'#type' => 'select',
|
||||||
|
'#title' => t("How many Study Weeks have you been to previously?"),
|
||||||
|
'#required' => FALSE,
|
||||||
|
'#default_value' => variable_get('booking_prev_sw_count', empty($data->booking_prev_sw_count) ? '' : $data->booking_prev_sw_count),
|
||||||
|
'#options' => _get_previous_sw_options(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// https://www.lullabot.com/articles/a-beginners-guide-to-caching-data-in-drupal-7
|
// https://www.lullabot.com/articles/a-beginners-guide-to-caching-data-in-drupal-7
|
||||||
// This code will only cache this one element
|
// This code will only cache this one element
|
||||||
|
@@ -412,7 +412,8 @@ function booking_update($node) {
|
|||||||
'booking_welfare_required', 'booking_payment_complete', 'booking_refund_processed', 'booking_committee_member'
|
'booking_welfare_required', 'booking_payment_complete', 'booking_refund_processed', 'booking_committee_member'
|
||||||
);
|
);
|
||||||
//these fields should be zero if not defined
|
//these fields should be zero if not defined
|
||||||
$default_zero_keys = array('booking_luckynum', 'booking_bf_gf_nid', 'booking_keepseparate_id', 'booking_refund_due', 'booking_earlyaccess_code_id');
|
$default_zero_keys = array('booking_luckynum', 'booking_bf_gf_nid', 'booking_keepseparate_id', 'booking_refund_due', 'booking_earlyaccess_code_id',
|
||||||
|
'booking_prev_sw_count');
|
||||||
|
|
||||||
//some fields are present in $node from the SQL view we use that don't belong in booking_person so exclude them
|
//some fields are present in $node from the SQL view we use that don't belong in booking_person so exclude them
|
||||||
$excluded_keys = array('booking_person_nid', 'booking_transport_type', 'booking_transport_from_morriset_reqd', 'booking_transport_to_morriset_reqd',
|
$excluded_keys = array('booking_person_nid', 'booking_transport_type', 'booking_transport_from_morriset_reqd', 'booking_transport_to_morriset_reqd',
|
||||||
@@ -893,6 +894,9 @@ function booking_view($node, $view_mode) {
|
|||||||
if (variable_get('booking_enable_freestyle', 0) == 1) {
|
if (variable_get('booking_enable_freestyle', 0) == 1) {
|
||||||
$rows[] = array(t('Freestyle:'), t('!song', array('!song' => $node->booking_freestyle_text)));
|
$rows[] = array(t('Freestyle:'), t('!song', array('!song' => $node->booking_freestyle_text)));
|
||||||
}
|
}
|
||||||
|
if (variable_get('booking_enable_previous_studyweeks', 0) == 1) {
|
||||||
|
$rows[] = array(t('Number of previous SW:'), t('!sw', array('!sw' => $node->booking_prev_sw_count)));
|
||||||
|
}
|
||||||
if (variable_get('booking_enable_tshirts', 0) == 1) {
|
if (variable_get('booking_enable_tshirts', 0) == 1) {
|
||||||
$rows[] = array(t('Hoodie Size:'), t('!size', array('!size' => $node->booking_shirt_size)));
|
$rows[] = array(t('Hoodie Size:'), t('!size', array('!size' => $node->booking_shirt_size)));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user