enhance formatting of studygroup-summary token

This commit is contained in:
Nathan Coad
2018-06-16 18:57:39 +10:00
parent 48dbb98c32
commit 53d8919064

View File

@@ -1612,14 +1612,15 @@ function _booking_studygroup_email_summary($node) {
$rows = array();
//display study session data if enabled
if (variable_get('booking_enable_studygroups', 0) == 1)
{
if (variable_get('booking_enable_studygroups', 0) == 0) {
return implode("\n", $rows);
}
//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');
//for ($i = 1; $i <= variable_get('booking_studygroup_count','0'); $i++)
foreach ($studygroups as $studygroup) {
//calculate the session references
$sessionid = "session" . $studygroup->sid;
@@ -1628,28 +1629,39 @@ function _booking_studygroup_email_summary($node) {
//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('<b>!role</b> for group <b>!descrip</b>, which will occur on <b>!weekday</b>. <b>!explan</b>', 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<ul>\n";
foreach ($rows as $row) {
$output .= "\t<li>$row</li>\n";
}
$output .= "</ul>\n";
//return implode("\n<br />", $rows);
return $output;
}
else {
// Plain text so just separate by newline
return implode("\n", $rows);
}
}