add human-readable studygroup names for CSV headings if option is enabled in admin page

This commit is contained in:
2016-06-22 23:03:21 +10:00
parent f26af4a0fb
commit 7847afcf5d
2 changed files with 10 additions and 2 deletions

View File

@@ -232,6 +232,14 @@ function booking_admin()
'#default_value' => variable_get('booking_publish_readinggroups', 0) '#default_value' => variable_get('booking_publish_readinggroups', 0)
); );
$form['features']['booking_friendly_csv_groupnames'] = array(
'#type' => 'radios',
'#title' => t('Use human-friendly study group names in CSV export?'),
'#description' => t('Select whether to use descriptions for study group columns when exporting CSV. If No, internal database field names are used.'),
'#options' => array(0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_friendly_csv_groupnames', 0),
);
$form['misc'] = array( $form['misc'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Configuration Options' '#title' => 'Configuration Options'

View File

@@ -677,7 +677,7 @@ function booking_csv_report() {
} }
//Replace headings for study group sessions and roles with the name of the study group rather than just sessionN and sessionN_role etc //Replace headings for study group sessions and roles with the name of the study group rather than just sessionN and sessionN_role etc
if (array_key_exists($key, $studygroup_descriptions)) { if (variable_get('booking_friendly_csv_groupnames','0') == 1 && array_key_exists($key, $studygroup_descriptions)) {
$header_array[] = $studygroup_descriptions[$key]; $header_array[] = $studygroup_descriptions[$key];
continue; continue;
} }