Added tokens for studygroups and rooms

This commit is contained in:
2014-06-03 13:41:19 +10:00
parent 802d38c63f
commit 9aef5c23ed
3 changed files with 85 additions and 2 deletions

View File

@@ -1117,6 +1117,70 @@ function _booking_travelform_email_summary($node) {
return implode("\n", $rows);
}
/**
* Helper function to format summary of studygroup sessions to be used as a token
*/
function _booking_studygroup_email_summary($node) {
global $event;
$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');
for ($i = 1; $i <= variable_get('booking_studygroup_count','0'); $i++)
{
//calculate the session references
$sessionid = "session" . $i;
$roleid = $sessionid . "_role";
//check that this study group session has been defined for this attendee
if (!empty($node->$sessionid))
{
$rows[] = t($studygroups[$i]->booking_studygroup_descrip . " session number:\t" . $node->$sessionid);
$rows[] = t("Role:\t" . _booking_studygroup_role_lookup($node->$roleid));
}
}
}
foreach ($rows as $key => $value)
$rows[$key] = wordwrap($value);
return implode("\n", $rows);
}
/**
* Helper function to format summary of room allocation to be used as a token
*/
function _booking_room_email_summary($node) {
global $event;
$rows = array();
//display study session data if enabled
if (variable_get('booking_enable_roomallocations', 0) == 1)
{
//check that this attendee has had a room allocated
if (! empty($node->rid))
{
$rows[] = t("Room Location\t" . _booking_room_location_lookup($node->booking_room_location_id));
$rows[] = t("Room Number\t" . $node->booking_room_number);
$rows[] = t("Bed Type\t" . _booking_room_bedtype_lookup($node->booking_room_bedtype));
}
else
$rows[] = t("No room currently allocated.");
}
foreach ($rows as $key => $value)
$rows[$key] = wordwrap($value);
return implode("\n", $rows);
}
/**
* @brief Generates a Universally Unique IDentifier, version 4.
*