initial work for reading group token
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
@@ -707,6 +707,7 @@ function booking_define_personspecific_tokens($node)
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1) {
|
||||
$tokens['studygroup-summary'] = _booking_studygroup_email_summary($node);
|
||||
$tokens['leaderhelper-pair'] = _booking_leader_helper_email_summary($node);
|
||||
$tokens['readinggroup-listing'] = _booking_readinggroup_email_listing($node);
|
||||
}
|
||||
else {
|
||||
$tokens['studygroup-summary'] = "";
|
||||
|
Reference in New Issue
Block a user