function forena_confirm_email in Forena Reports 7.5
Same name and namespace in other branches
- 8 forena.common.inc \forena_confirm_email()
- 6.2 forena.common.inc \forena_confirm_email()
- 6 forena.common.inc \forena_confirm_email()
- 7 forena.common.inc \forena_confirm_email()
- 7.2 forena.common.inc \forena_confirm_email()
- 7.3 forena.common.inc \forena_confirm_email()
- 7.4 forena.common.inc \forena_confirm_email()
Email confirmation form. Confirms an email send based on mail merge
Parameters
array $docs An array of SimpleXML email documents to send:
integer $count Number of documents to send.:
1 string reference to 'forena_confirm_email'
- EmailMerge::render in src/
DocumentFormats/ EmailMerge.php
File
- ./
forena.common.inc, line 166 - Common functions used throughout the project but loaded in this file to keep the module file lean.
Code
function forena_confirm_email($formid, &$form_state, $docs, $count, $prompt_subject, $prompt_body) {
// Make sure user has permission for email merge.
if (!user_access('perform email merge')) {
drupal_access_denied();
exit;
}
// Save arguments away for rebuild
if (!isset($form_state['storage']['args'])) {
$form_state['storage']['args'] = array(
'docs' => $docs,
'count' => $count,
'prompt_subject' => $prompt_subject,
'prompt_body' => $prompt_body,
);
}
else {
// Retrieve arguements for rebuild case
extract($form_state['storage']['args']);
}
if ($docs) {
$values = @$form_state['values'];
if ($prompt_subject) {
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => @$values['subject'],
);
}
if ($prompt_body) {
$form['body'] = array(
'#type' => 'text_format',
'#title' => t('Message'),
'#default_value' => @$values['body'],
'#format' => variable_get('forena_email_input_format', filter_default_format()),
);
}
if (!variable_get('forena_email_override', FALSE)) {
$form['send'] = array(
'#type' => 'radios',
'#title' => t('Send Email'),
'#options' => array(
'send' => 'email to users',
'test' => 'emails to me (test mode)',
),
'#default_value' => 'test',
);
}
$form['max'] = array(
'#type' => 'textfield',
'#title' => 'Only send first',
'#description' => 'In test mode only, limits the number of messages to send',
'#default_value' => 1,
'#size' => 3,
);
$form_state['storage']['docs'] = $docs;
$form_state['storage']['count'] = $count;
}
return confirm_form($form, t('Send mail to users'), 'forena', t('Send email to %count users?', array(
'%count' => $count,
)));
}