move custom emails to their own page

This commit is contained in:
2017-07-02 09:12:35 +10:00
parent 899fd83499
commit 8444477ab2
2 changed files with 66 additions and 3 deletions

View File

@@ -1,6 +1,12 @@
<?php
function booking_emails_admin() {
/**
* Function to allow admin user to define contents of workflow emails that can be sent by Bookings module
*
* @param
* @return form render array
*/
function booking_emails_workflow_admin() {
global $event;
$form = array();
//some initial workflow email definitions
@@ -225,6 +231,7 @@ function booking_emails_admin() {
);
/*Text for emails*/
/*
$form['custom-emails'] = array(
'#type' => 'fieldset',
'#title' => 'Custom Email Text Definitions',
@@ -251,6 +258,7 @@ function booking_emails_admin() {
'#format' => $form_format,
);
}
*/
/*Text for logistics emails*/
$form['custom-logistics-emails'] = array(
@@ -285,6 +293,60 @@ function booking_emails_admin() {
return system_settings_form($form, FALSE);
}
/**
* Function to allow admin user to define custom emails that can be sent by Bookings module
*
* @param
* @return form render array
*/
function booking_emails_custom_admin() {
global $event;
$form = array();
if(variable_get('booking_enable_html_mail', 0) == 1) {
$form_type = 'text_format';
$form_format = 'full_html';
}
else {
$form_type = 'textarea';
$form_format = NULL;
}
//include the token definitions
$form['tokens'] = array(
'#theme' => 'token_tree',
'#token_types' => array('booking'),
);
/*Text for emails*/
$form['custom-emails'] = array(
'#type' => 'fieldset',
'#title' => 'Custom Email Text Definitions',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
//add a bunch of custom emails
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) {
$subject_fieldname = 'booking_email_subject_custom' . $i;
$body_fieldname = 'booking_email_custom' . $i;
$form['custom-emails'][$subject_fieldname] = array (
'#type' => 'textfield',
'#title' => t('Subject line for Custom Email ' . $i),
'#size' => 150,
'#maxlength' => 300,
'#default_value' => variable_get($subject_fieldname,'[booking:eventname]'),
);
$form['custom-emails'][$body_fieldname] = array(
'#title' => t('Email text for custom email ' . $i),
'#description' => t(''),
'#default_value' => isset(variable_get($body_fieldname)['value']) ? variable_get($body_fieldname)['value'] : variable_get($body_fieldname, ''),
'#type' => $form_type,
'#format' => $form_format,
);
}
}
/**
* Function to allow admin user to manually generate and send a workflow or custom email
*