diff --git a/booking.admin.inc b/booking.admin.inc index 1c1b168..5b093a1 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -701,22 +701,35 @@ function booking_admin() { $booking_view_fields = _booking_get_person_fields(); $form['management']['booking_export_include_fields_dynamic'] = array( - '#type' => 'select', - '#multiple' => TRUE, - '#title' => t('Not In Use - Select database fields'), - '#description' => t('Select database fields to export to CSV. Ensure you hold down control/command when selecting multiple options.'), - '#options' => $booking_view_fields, - '#default_value' => variable_get('booking_export_include_fields_dynamic', ''), -); -$form['management']['booking_import_include_fields_dynamic'] = array( - '#type' => 'select', - '#multiple' => TRUE, - '#title' => t('Not In Use - Select database fields'), - '#description' => t('Select database fields to import from an uploaded CSV file. Ensure you hold down control/command when selecting multiple options.'), - '#options' => $booking_view_fields, - '#default_value' => variable_get('booking_import_include_fields_dynamic', ''), -); - + '#type' => 'select', + '#multiple' => TRUE, + '#title' => t('Not In Use - Select database fields'), + '#description' => t('Select database fields to export to CSV. Ensure you hold down control/command when selecting multiple options.'), + '#options' => $booking_view_fields, + '#default_value' => variable_get('booking_export_include_fields_dynamic', ''), + ); + $form['management']['booking_import_include_fields_dynamic'] = array( + '#type' => 'select', + '#multiple' => TRUE, + '#title' => t('Not In Use - Select database fields'), + '#description' => t('Select database fields to import from an uploaded CSV file. Ensure you hold down control/command when selecting multiple options.'), + '#options' => $booking_view_fields, + '#default_value' => variable_get('booking_import_include_fields_dynamic', ''), + ); + + $form['meta-tokens'] = array( + '#type' => 'fieldset', + '#title' => 'Meta Token Definitions', + '#collapsible' => TRUE, + ); + $form['meta-tokens']['booking_studygroup_summary_li_text'] = array ( + '#type' => 'textfield', + '#title' => t('Study Group Summary Format'), + '#default_value' => variable_get('booking_studygroup_summary_li_text', + '[meta-booking:studygroup-role] for group [meta-booking:studygroup-descrip], which will occur on [meta-booking:studygroup-weekday]. [meta-booking:studygroup-explan]'), + '#description' => 'List element definition (using tokens) for study group summary in emails.', + ); + //return system_settings_form($form); //make sure we update our custom sql view every time we change something on the admin page $form = system_settings_form($form); diff --git a/booking.helper.inc b/booking.helper.inc index 8effa9b..fa9c2f1 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -1630,6 +1630,16 @@ function _booking_studygroup_email_summary($node) { if (!empty($node->$sessionid)) { //$rows[] = t($studygroup->booking_studygroup_descrip . ": Group " . $node->$sessionid . ", " . _booking_studygroup_role_lookup($node->$roleid)); + $tokens = array( + 'studygroup-descrip' => $studygroup->booking_studygroup_descrip, + 'studygroup-weekday' => $studygroup->booking_studygroup_weekday, + 'studygroup-explan' => $studygroup->booking_studygroup_explanation, + 'studygroup-role' => _booking_studygroup_role_lookup($node->$roleid), + ); + + $li_text = variable_get('booking_studygroup_summary_li_text', ''); + $rows[] = token_replace($li_text, $tokens); + /* // Add some boldness if we're using html email if(variable_get('booking_enable_html_mail', 0) == 1) { $rows[] = t('!role for group !descrip, which will occur on !weekday. !explan', array( @@ -1644,6 +1654,7 @@ function _booking_studygroup_email_summary($node) { '!explan' => $studygroup->booking_studygroup_explanation, '!role' => _booking_studygroup_role_lookup($node->$roleid), )); } + */ } // End checking for empty studygroup session } // End foreach loop diff --git a/booking.tokens.inc b/booking.tokens.inc index 2f9a57b..7a2d46a 100644 --- a/booking.tokens.inc +++ b/booking.tokens.inc @@ -370,10 +370,10 @@ function booking_tokens_admin_validate($form, $form_state) { function booking_token_info() { $info['types']['booking'] = array( - 'name' => t('Booking Tokens'), - 'description' => t('Tokens related to bookings module.'), - 'needs-data' => 'booking', - ); + 'name' => t('Booking Tokens'), + 'description' => t('Tokens related to bookings module.'), + 'needs-data' => 'booking', + ); $info['tokens']['booking']['eventname'] = array( 'name' => t('Event Name'), 'description' => t('Name of the current event.') @@ -510,6 +510,28 @@ function booking_token_info() { 'name' => t('Travel form Link'), 'description' => t('Link to the person\'s travel form.') ); + + $info['types']['meta-booking'] = array( + 'name' => t('Meta Booking Tokens'), + 'description' => t('Sub-tokens for the booking module that are used by other booking module tokens. They will only work in a very limited context.'), + 'needs-data' => 'booking', + ); + $info['tokens']['meta-booking']['studygroup-descrip'] = array( + 'name' => t('Study Group Description'), + 'description' => t('Used in the studygroup-summary token.') + ); + $info['tokens']['meta-booking']['studygroup-weekday'] = array( + 'name' => t('Study Group Weekday'), + 'description' => t('Used in the studygroup-summary token.') + ); + $info['tokens']['meta-booking']['studygroup-explan'] = array( + 'name' => t('Study Group Explanation'), + 'description' => t('Used in the studygroup-summary token.') + ); + $info['tokens']['meta-booking']['studygroup-role'] = array( + 'name' => t('Study Group Role'), + 'description' => t('Used in the studygroup-summary token.') + ); return $info; } @@ -542,7 +564,7 @@ function booking_tokens($type, $tokens, array $data = array(), array $options = $replacements = array(); $sanitize = !empty($options['sanitize']); - if ($type == 'booking') { + if ($type == 'booking' || $type == 'meta-booking') { foreach ($tokens as $name => $original) { if (array_key_exists($name, $data)) { $replacements[$original] = $data[$name]; @@ -646,7 +668,6 @@ function booking_define_personspecific_tokens($node) $tokens['confirm-payment-link'] = url('confirm/' . $tempid, array('absolute' => TRUE)); } - //if payment processor is set to manual then don't populate these tokens //if paypal is enabled if ($payment_processor_type == 0) {