public function FrxEmailMerge::generate in Forena Reports 7.5
Generate the template from the configuration.
Parameters
string $data_block:
SimpleXMLElement $xml:
array $config:
Overrides RendererBase::generate
File
- src/
Renderer/ FrxEmailMerge.php, line 74 - FrxEmailMerge Email merge template.
Class
Namespace
Drupal\forena\RendererCode
public function generate($xml, &$config) {
$from = @$config['from'];
$to = @$config['to'];
$cc = @$config['cc'];
$bcc = @$config['bcc'];
$subject = @$config['subject'];
$body = @$config['body'];
$body = $body['value'];
$config['foreach'] = "*";
$div = $this
->blockDiv($config);
$this
->removeChildren($div);
$doc = $this
->addNode($div, 4, 'div', NULL, array(
'class' => 'email-document',
));
$header = $this
->addNode($doc, 6, 'div', NULL, array(
'class' => 'email-header',
));
$table = $this
->addNode($header, 8, 'table');
$tr = $this
->addNode($table, 10, 'tr');
$td = $this
->addNode($tr, 12, 'th', 'From');
$td = $this
->addNode($tr, 12, 'td', htmlentities($from), array(
'class' => 'email-header-from',
));
$tr = $this
->addNode($table, 10, 'tr');
$td = $this
->addNode($tr, 12, 'th', 'To');
$td = $this
->addNode($tr, 12, 'td', htmlentities($to), array(
'class' => 'email-header-to',
));
if ($cc) {
$tr = $this
->addNode($table, 10, 'tr');
$td = $this
->addNode($tr, 12, 'th', 'Cc');
$td = $this
->addNode($tr, 12, 'td', htmlentities($cc), array(
'class' => 'email-header-cc',
));
}
if ($bcc) {
$tr = $this
->addNode($table, 10, 'tr');
$td = $this
->addNode($tr, 12, 'th', 'Bcc');
$td = $this
->addNode($tr, 12, 'td', htmlentities($bcc), array(
'class' => 'email-header-bcc',
));
}
$tr = $this
->addNode($table, 10, 'tr');
$td = $this
->addNode($tr, 12, 'th', 'Subject');
$td = $this
->addNode($tr, 12, 'td', $subject, array(
'class' => 'email-header-subject',
));
$email_body = $this
->addNode($doc, 6, 'div', NULL, array(
'class' => 'email-body',
));
$p = $this
->addFragment($email_body, $body);
}