initial work for reading group token

This commit is contained in:
Nathan Coad
2018-06-26 09:15:59 +10:00
parent 16b0f6ee76
commit b083776c08
2 changed files with 34 additions and 0 deletions

View File

@@ -1604,6 +1604,39 @@ function _booking_travelform_email_summary($node) {
}
}
/**
* Helper function to format summary of reading group members, to be used as a token
*/
function _booking_readinggroup_email_listing($node) {
global $event;
$rows = array();
//display study session data if enabled
if (variable_get('booking_enable_studygroups', 0) == 0) {
return implode("\n", $rows);
}
// Check for the reading group
$readinggroup_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid AND booking_is_readinggroup = 'Y'",
array(':eid' => $event->eid));
$readinggroups = $readinggroup_query->fetchAllAssoc('sid');
if (! $readinggroups) {
return implode("\n", $rows);
}
foreach ($readinggroups as $readinggroup) {
//calculate the session references
$sessionid = "session" . $readinggroup->sid;
$roleid = $sessionid . "_role";
//check that this reading group session has been defined for this attendee and that they're a leader
if (!empty($node->$sessionid) && $node->$roleid == 1) {
watchdog('booking_debug', "<pre>Person is a leader of reading group \n@info</pre>", array('@info' => print_r($readinggroup, true)));
}
}
}
/**
* Helper function to format summary of studygroup sessions to be used as a token
*/