You are here

public function FrxEmailMerge::generate in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 templates/FrxEmailMerge.inc \FrxEmailMerge::generate()
  2. 7.2 templates/FrxEmailMerge.inc \FrxEmailMerge::generate()
  3. 7.4 renderers/FrxEmailMerge.inc \FrxEmailMerge::generate()

Enter description here ...

Parameters

string $data_block:

SimpleXMLElement $xml:

array $config:

Overrides FrxTemplate::generate

File

templates/FrxEmailMerge.inc, line 37

Class

FrxEmailMerge

Code

public function generate($xml, $config) {
  $from = $this
    ->extract('from', $config);
  $to = $this
    ->extract('to', $config);
  $subject = $this
    ->extract('subject', $config);
  $body = $this
    ->extract('body', $config);
  $config['foreach'] = "*";
  $div = $this
    ->blockDiv($config);
  $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', $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', $to, array(
    'class' => 'email-header-to',
  ));
  $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
    ->addNode($email_body, 8, 'p', $body);
}