add more detail to study group definitions and email token
This commit is contained in:
@@ -328,12 +328,12 @@ function _booking_custom_email($nid, $email_type, $sender = 'contact') {
|
|||||||
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||||
));
|
));
|
||||||
// Test email attachments with dummy file
|
// Test email attachments with dummy file
|
||||||
$attachment = array(
|
//$attachment = array(
|
||||||
'filecontent' => file_get_contents(DRUPAL_ROOT . '/README.txt'),
|
// 'filecontent' => file_get_contents(DRUPAL_ROOT . '/README.txt'),
|
||||||
'filename' => 'test.txt',
|
// 'filename' => 'test.txt',
|
||||||
'filemime' => 'text/plain',
|
// 'filemime' => 'text/plain',
|
||||||
);
|
//);
|
||||||
$params['attachment'] = $attachment;
|
//$params['attachment'] = $attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load the node matching this id
|
//load the node matching this id
|
||||||
|
@@ -1620,16 +1620,18 @@ function _booking_studygroup_email_summary($node) {
|
|||||||
$studygroups = $studygroups_query->fetchAllAssoc('sid');
|
$studygroups = $studygroups_query->fetchAllAssoc('sid');
|
||||||
|
|
||||||
//for ($i = 1; $i <= variable_get('booking_studygroup_count','0'); $i++)
|
//for ($i = 1; $i <= variable_get('booking_studygroup_count','0'); $i++)
|
||||||
foreach ($studygroups as $studygroup)
|
foreach ($studygroups as $studygroup) {
|
||||||
{
|
|
||||||
//calculate the session references
|
//calculate the session references
|
||||||
$sessionid = "session" . $studygroup->sid;
|
$sessionid = "session" . $studygroup->sid;
|
||||||
$roleid = $sessionid . "_role";
|
$roleid = $sessionid . "_role";
|
||||||
|
|
||||||
//check that this study group session has been defined for this attendee
|
//check that this study group session has been defined for this attendee
|
||||||
if (!empty($node->$sessionid))
|
if (!empty($node->$sessionid)) {
|
||||||
{
|
//$rows[] = t($studygroup->booking_studygroup_descrip . ": Group " . $node->$sessionid . ", " . _booking_studygroup_role_lookup($node->$roleid));
|
||||||
$rows[] = t($studygroup->booking_studygroup_descrip . ": Group " . $node->$sessionid . ", " . _booking_studygroup_role_lookup($node->$roleid));
|
$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),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1639,7 +1641,13 @@ function _booking_studygroup_email_summary($node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
||||||
return implode("\n<br />", $rows);
|
$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 {
|
else {
|
||||||
return implode("\n", $rows);
|
return implode("\n", $rows);
|
||||||
|
@@ -800,6 +800,17 @@ function booking_update_7255() {
|
|||||||
_booking_node_create_mysqlview();
|
_booking_node_create_mysqlview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add fields for study group definitions
|
||||||
|
*/
|
||||||
|
function booking_update_7256() {
|
||||||
|
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
|
||||||
|
db_add_field('booking_studygroup_list', 'booking_studygroup_weekday', $spec);
|
||||||
|
db_add_field('booking_studygroup_list', 'booking_studygroup_explanation', $spec);
|
||||||
|
//update the view to match the new table definition
|
||||||
|
_booking_node_create_mysqlview();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_install().
|
* Implementation of hook_install().
|
||||||
*/
|
*/
|
||||||
@@ -1118,13 +1129,15 @@ function booking_schema() {
|
|||||||
),
|
),
|
||||||
'primary key' => array('tid'),
|
'primary key' => array('tid'),
|
||||||
);
|
);
|
||||||
|
|
||||||
//This lists all the study groups
|
//This lists all the study groups
|
||||||
$schema['booking_studygroup_list'] = array(
|
$schema['booking_studygroup_list'] = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||||
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||||
'booking_studygroup_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
|
'booking_studygroup_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
|
||||||
|
'booking_studygroup_weekday' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
|
||||||
|
'booking_studygroup_explanation' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
|
||||||
'booking_num_group_sessions' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 1),
|
'booking_num_group_sessions' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 1),
|
||||||
'booking_is_readinggroup' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
'booking_is_readinggroup' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||||
),
|
),
|
||||||
|
@@ -976,11 +976,11 @@ function booking_mail($key, &$message, $params) {
|
|||||||
|
|
||||||
// Add attachment when available.
|
// Add attachment when available.
|
||||||
// From https://drupal.stackexchange.com/questions/101035/send-attachments-with-drupal-mail
|
// From https://drupal.stackexchange.com/questions/101035/send-attachments-with-drupal-mail
|
||||||
if (isset($params['attachment'])) {
|
//if (isset($params['attachment'])) {
|
||||||
$message['params']['attachments'][] = $params['attachment'];
|
// $message['params']['attachments'][] = $params['attachment'];
|
||||||
}
|
//}
|
||||||
|
|
||||||
watchdog('booking_debug', "<pre>Mail hook:\n@info</pre>", array('@info' => print_r( $message, true)));
|
//watchdog('booking_debug', "<pre>Mail hook:\n@info</pre>", array('@info' => print_r( $message, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1011,7 +1011,7 @@ function booking_mail_alter(&$message) {
|
|||||||
foreach($headers as $key => $value) {
|
foreach($headers as $key => $value) {
|
||||||
$message['headers'][$key] = $value;
|
$message['headers'][$key] = $value;
|
||||||
}
|
}
|
||||||
//watchdog('booking_debug', "<pre>Mail alter hook:\n@info</pre>", array('@info' => print_r( $message, true)));
|
watchdog('booking_debug', "<pre>Mail alter hook:\n@info</pre>", array('@info' => print_r( $message, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -112,14 +112,30 @@ function booking_studygroups_define_form($node, &$form_state, $create, $editid =
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($form_state['storage']['confirm'])) {
|
if(!isset($form_state['storage']['confirm'])) {
|
||||||
|
$form['booking_studygroup_weekday'] = array (
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Day of the week this study group will be held (eg Monday)'),
|
||||||
|
'#size' => 60,
|
||||||
|
'#maxlength' => 150,
|
||||||
|
'#required' => TRUE,
|
||||||
|
'#default_value' => !empty($data->booking_studygroup_weekday) ? $data->booking_studygroup_weekday : '',
|
||||||
|
);
|
||||||
$form['booking_studygroup_descrip'] = array (
|
$form['booking_studygroup_descrip'] = array (
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Description of this study group (eg Monday)'),
|
'#title' => t('Description of this study group (eg Study Group 1)'),
|
||||||
'#size' => 60,
|
'#size' => 60,
|
||||||
'#maxlength' => 150,
|
'#maxlength' => 150,
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
'#default_value' => !empty($data->booking_studygroup_descrip) ? $data->booking_studygroup_descrip : '',
|
'#default_value' => !empty($data->booking_studygroup_descrip) ? $data->booking_studygroup_descrip : '',
|
||||||
);
|
);
|
||||||
|
$form['booking_studygroup_explanation'] = array (
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Explanation for this study group (eg Matthew chapter 1)'),
|
||||||
|
'#size' => 60,
|
||||||
|
'#maxlength' => 150,
|
||||||
|
'#required' => TRUE,
|
||||||
|
'#default_value' => !empty($data->booking_studygroup_explanation) ? $data->booking_studygroup_explanation : '',
|
||||||
|
);
|
||||||
|
|
||||||
$form['booking_num_group_sessions'] = array (
|
$form['booking_num_group_sessions'] = array (
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
|
Reference in New Issue
Block a user