Added tokens for studygroups and rooms
This commit is contained in:
@@ -1117,6 +1117,70 @@ function _booking_travelform_email_summary($node) {
|
|||||||
return implode("\n", $rows);
|
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.
|
* @brief Generates a Universally Unique IDentifier, version 4.
|
||||||
*
|
*
|
||||||
|
@@ -1706,7 +1706,10 @@ function booking_view($node, $view_mode) {
|
|||||||
//display study session data if enabled
|
//display study session data if enabled
|
||||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||||
{
|
{
|
||||||
|
$studygroup_heading = t("<h2>Study Groups</h2><p>!link</p>",
|
||||||
|
array('!link' => l(t('Edit Groups'), t('admin/booking/!id/edit-studygroup', array('!id' => $node->nid)))
|
||||||
|
));
|
||||||
|
|
||||||
//look up the titles of the study groups
|
//look up the titles of the study groups
|
||||||
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid",
|
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid",
|
||||||
array(':eid' => $event->eid));
|
array(':eid' => $event->eid));
|
||||||
@@ -1725,7 +1728,7 @@ function booking_view($node, $view_mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$node->content['group-heading'] = array(
|
$node->content['group-heading'] = array(
|
||||||
'#markup' => "<h2>Study Groups</h2>",
|
'#markup' => $studygroup_heading,
|
||||||
'#weight' => 6,
|
'#weight' => 6,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -500,6 +500,10 @@ function booking_token_info() {
|
|||||||
'name' => t('Last Name'),
|
'name' => t('Last Name'),
|
||||||
'description' => t('Last Name of the attendee.')
|
'description' => t('Last Name of the attendee.')
|
||||||
);
|
);
|
||||||
|
$info['tokens']['booking']['team-colour'] = array(
|
||||||
|
'name' => t('Team Colour'),
|
||||||
|
'description' => t('Reading group team of attendee.')
|
||||||
|
);
|
||||||
$info['tokens']['booking']['dietary'] = array(
|
$info['tokens']['booking']['dietary'] = array(
|
||||||
'name' => t('Dietary Requirements'),
|
'name' => t('Dietary Requirements'),
|
||||||
'description' => t('Specified dietary requirements of the attendee')
|
'description' => t('Specified dietary requirements of the attendee')
|
||||||
@@ -552,6 +556,14 @@ function booking_token_info() {
|
|||||||
'name' => t('Registration Travel Summary'),
|
'name' => t('Registration Travel Summary'),
|
||||||
'description' => t('Summary of travel details from user registration.')
|
'description' => t('Summary of travel details from user registration.')
|
||||||
);
|
);
|
||||||
|
$info['tokens']['booking']['studygroup-summary'] = array(
|
||||||
|
'name' => t('Registration Study Group Summary'),
|
||||||
|
'description' => t('Summary of allocated study groups.')
|
||||||
|
);
|
||||||
|
$info['tokens']['booking']['room-allocation'] = array(
|
||||||
|
'name' => t('Room Allocation'),
|
||||||
|
'description' => t('Listing of room allocated to attendee.')
|
||||||
|
);
|
||||||
$info['tokens']['booking']['travel-link'] = array(
|
$info['tokens']['booking']['travel-link'] = array(
|
||||||
'name' => t('Travel form Link'),
|
'name' => t('Travel form Link'),
|
||||||
'description' => t('Link to the person\'s travel form.')
|
'description' => t('Link to the person\'s travel form.')
|
||||||
@@ -654,6 +666,7 @@ function booking_define_personspecific_tokens($node)
|
|||||||
$tokens = array();
|
$tokens = array();
|
||||||
$tokens['eventname'] = $event->booking_eventname;
|
$tokens['eventname'] = $event->booking_eventname;
|
||||||
$tokens['contact-email'] = variable_get('booking_contact_email');
|
$tokens['contact-email'] = variable_get('booking_contact_email');
|
||||||
|
$tokens['team-colour'] = ucwords($node->booking_readinggroup);
|
||||||
$tokens['fname'] = ucwords(trim($node->booking_firstname));
|
$tokens['fname'] = ucwords(trim($node->booking_firstname));
|
||||||
$tokens['lname'] = ucwords(trim($node->booking_lastname));
|
$tokens['lname'] = ucwords(trim($node->booking_lastname));
|
||||||
$tokens['dietary'] = ucwords(trim($node->booking_dietary));
|
$tokens['dietary'] = ucwords(trim($node->booking_dietary));
|
||||||
@@ -671,5 +684,8 @@ function booking_define_personspecific_tokens($node)
|
|||||||
$tokens['paypal-deposit-amount'] = _booking_deposit_amount();
|
$tokens['paypal-deposit-amount'] = _booking_deposit_amount();
|
||||||
$tokens['regn-summary'] = _booking_details_email_summary($node);
|
$tokens['regn-summary'] = _booking_details_email_summary($node);
|
||||||
$tokens['travel-summary'] = _booking_travelform_email_summary($node);
|
$tokens['travel-summary'] = _booking_travelform_email_summary($node);
|
||||||
|
$tokens['studygroup-summary'] = _booking_studygroup_email_summary($node);
|
||||||
|
$tokens['room-allocation'] = _booking_room_email_summary($node);
|
||||||
|
|
||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
Reference in New Issue
Block a user