diff --git a/booking.helper.inc b/booking.helper.inc index a4c3080..8effa9b 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -1612,44 +1612,56 @@ function _booking_studygroup_email_summary($node) { $rows = array(); //display study session data if enabled - if (variable_get('booking_enable_studygroups', 0) == 1) - { - //look up the titles of the study groups - $studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid", - array(':eid' => $event->eid)); - $studygroups = $studygroups_query->fetchAllAssoc('sid'); + if (variable_get('booking_enable_studygroups', 0) == 0) { + return implode("\n", $rows); + } - //for ($i = 1; $i <= variable_get('booking_studygroup_count','0'); $i++) - foreach ($studygroups as $studygroup) { - //calculate the session references - $sessionid = "session" . $studygroup->sid; - $roleid = $sessionid . "_role"; - - //check that this study group session has been defined for this attendee - if (!empty($node->$sessionid)) { - //$rows[] = t($studygroup->booking_studygroup_descrip . ": Group " . $node->$sessionid . ", " . _booking_studygroup_role_lookup($node->$roleid)); + //look up the titles of the study groups + $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"; + + //check that this study group session has been defined for this attendee + if (!empty($node->$sessionid)) { + //$rows[] = t($studygroup->booking_studygroup_descrip . ": Group " . $node->$sessionid . ", " . _booking_studygroup_role_lookup($node->$roleid)); + + // 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( + '!descrip' => $studygroup->booking_studygroup_descrip, '!weekday' => $studygroup->booking_studygroup_weekday, + '!explan' => $studygroup->booking_studygroup_explanation, '!role' => _booking_studygroup_role_lookup($node->$roleid), + )); + } + // Otherwise just leave things plain + else { $rows[] = t('!role for group !descrip, which will occur on !weekday. !explan', array( '!descrip' => $studygroup->booking_studygroup_descrip, '!weekday' => $studygroup->booking_studygroup_weekday, '!explan' => $studygroup->booking_studygroup_explanation, '!role' => _booking_studygroup_role_lookup($node->$roleid), - )); - } - } - } + )); + } + } // End checking for empty studygroup session + } // End foreach loop foreach ($rows as $key => $value) { $rows[$key] = wordwrap($value); } if(variable_get('booking_enable_html_mail', 0) == 1) { + // Turn the rows into an unordered list $output = "\n