Replace internal column names with descriptive names for study groups in csv report
This commit is contained in:
@@ -14,6 +14,7 @@ function booking_import_data_admin()
|
||||
$prefix = t("<p>Upload csv file containing data to import. Minimum fields present should be <strong>nid and booking_status</strong>, " .
|
||||
" along with user-specified fields of <strong>!config</strong>. CSV Column names should match exactly (case sensitive).</p>",
|
||||
array('!config' => variable_get('booking_import_include_fields', '')));
|
||||
$prefix .= "<p>Note that only registration specific data like phone numbers, barcodes, etc can be updated. Study group data cannot be imported via this page.</p>"
|
||||
|
||||
$form = array();
|
||||
|
||||
|
@@ -639,21 +639,38 @@ function booking_csv_report() {
|
||||
$delimiter_esc = preg_quote($delimiter, '/');
|
||||
$enclosure_esc = preg_quote($enclosure, '/');
|
||||
|
||||
$readinggroup = "session" . variable_get('booking_readinggroup_id','7');
|
||||
//$readinggroup = "session" . variable_get('booking_readinggroup_id','7');
|
||||
|
||||
/*
|
||||
$fields_to_skip = array('booking_payment_id', 'booking_event_id', 'booking_skills_childminding', 'booking_passport_issue_date',
|
||||
'booking_passport_expiry_date', 'booking_passport_num', 'booking_passport_num', 'booking_mission_experience_details',
|
||||
'booking_passport_issue_location', 'booking_passport_issue_name', 'booking_skills_builder', 'booking_skills_cooking',
|
||||
'booking_skills_language', 'booking_skills_language_details', 'booking_skills_other', 'booking_skills_other_details');
|
||||
*/
|
||||
//calculate fields to ignore in the output csv file
|
||||
$builtin_fields_to_skip = array('booking_event_id');
|
||||
$custom_fields_to_skip = explode(";", variable_get('booking_csv_exclude_fields', ''));
|
||||
$fields_to_skip = array_merge($builtin_fields_to_skip, $custom_fields_to_skip);
|
||||
|
||||
//keep a list of any fields that we need to handle as dates
|
||||
$datetime_fields = array('booking_outflight_origin_ts', 'booking_outflight_destination_ts', 'booking_rtrnflight_origin_ts',
|
||||
'booking_rtrnflight_destination_ts', 'booking_timestamp', 'booking_flight_datetime_inbound', 'booking_flight_datetime_outbound');
|
||||
|
||||
//look up the titles of the study groups and add to array for updating in the header
|
||||
$studygroup_descriptions = array();
|
||||
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid",
|
||||
array(':eid' => $event->eid));
|
||||
$studygroups = $studygroups_query->fetchAllAssoc('sid');
|
||||
foreach ($studygroups as $studygroup)
|
||||
{
|
||||
//calculate the session references
|
||||
$sessionid = "session" . $studygroup->sid;
|
||||
$roleid = $sessionid . "_role";
|
||||
$description = $studygroup->booking_studygroup_descrip;
|
||||
|
||||
$studygroup_descriptions[$sessionid] = $description;
|
||||
$studygroup_descriptions[$roleid] = $description . " Role";
|
||||
|
||||
if ($studygroup->booking_is_readinggroup == 'Y')
|
||||
{
|
||||
$readinggroup_id = $sessionid;
|
||||
}
|
||||
}
|
||||
|
||||
//query the db
|
||||
/*
|
||||
$query = db_select('booking_person', 'p');
|
||||
@@ -694,6 +711,14 @@ function booking_csv_report() {
|
||||
{
|
||||
if (in_array($key, $fields_to_skip))
|
||||
continue;
|
||||
|
||||
//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))
|
||||
{
|
||||
$header_array[] = $studygroup_descriptions[$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
$header_array[] = $key;
|
||||
//add in a special column for a processed version of the date of birth
|
||||
if (strcmp($key,"booking_dob") == 0)
|
||||
@@ -772,7 +797,7 @@ function booking_csv_report() {
|
||||
}
|
||||
|
||||
//reading group team colour
|
||||
if ($key == $readinggroup) {
|
||||
if ($key == $readinggroup_id) {
|
||||
$output[] = _booking_readinggroup_colour_lookup($value);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user