You are here

class FrxEmailMerge in Forena Reports 7.4

Same name and namespace in other branches
  1. 6.2 templates/FrxEmailMerge.inc \FrxEmailMerge
  2. 7.2 templates/FrxEmailMerge.inc \FrxEmailMerge
  3. 7.3 templates/FrxEmailMerge.inc \FrxEmailMerge

@file FrxEmailMerge Email merge template.

Hierarchy

Expanded class hierarchy of FrxEmailMerge

1 string reference to 'FrxEmailMerge'
forena_forena_controls in ./forena.module
Self register controls with forena.

File

renderers/FrxEmailMerge.inc, line 6
FrxEmailMerge Email merge template.

View source
class FrxEmailMerge extends FrxRenderer {
  public $templateName = 'Mail Merge';
  public $email_input_format;
  public function __construct() {
    parent::__construct();
    $this->email_input_format = variable_get('forena_email_input_format', filter_default_format());
    $this->doc_types = array(
      'email',
    );
  }
  public function scrapeConfig() {
    $config = array();
    $config['class'] = get_class($this);
    $config['from'] = html_entity_decode($this
      ->extractXPathInnerHTML("*//*[@class='email-header-from']", $this->reportDocDomNode));
    $config['to'] = html_entity_decode($this
      ->extractXPathInnerHTML("*//*[@class='email-header-to']", $this->reportDocDomNode));
    $config['cc'] = html_entity_decode($this
      ->extractXPathInnerHTML("*//*[@class='email-header-cc']", $this->reportDocDomNode));
    $config['bcc'] = html_entity_decode($this
      ->extractXPathInnerHTML("*//*[@class='email-header-bcc']", $this->reportDocDomNode));
    $config['subject'] = $this
      ->extractXPathInnerHTML("*//*[@class='email-header-subject']", $this->reportDocDomNode);
    $config['body']['value'] = $this
      ->extractXPathInnerHTML("*//*[@class='email-body']", $this->reportDocDomNode);
    return $config;
  }
  public function configForm($config) {
    $form_ctl['from'] = array(
      '#type' => 'textfield',
      '#title' => t('From'),
      '#default_value' => @$config['from'],
    );
    $form_ctl['to'] = array(
      '#type' => 'textfield',
      '#title' => t('To'),
      '#default_value' => @$config['to'],
    );
    $form_ctl['cc'] = array(
      '#type' => 'textfield',
      '#title' => t('Cc'),
      '#default_value' => @$config['cc'],
    );
    $form_ctl['bcc'] = array(
      '#type' => 'textfield',
      '#title' => t('Bcc'),
      '#default_value' => @$config['bcc'],
    );
    $form_ctl['subject'] = array(
      '#type' => 'textfield',
      '#title' => t('Subject'),
      '#default_value' => @$config['subject'],
    );
    $form_ctl['body'] = array(
      '#type' => 'text_format',
      '#title' => t('Message'),
      "#format" => $this->email_input_format,
      '#default_value' => @$config['body']['value'],
    );
    return $form_ctl;
  }
  public function configValidate(&$config) {
    $this
      ->validateTextFormats($config, array(
      'body',
    ));
  }
  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, NULL, 'UTF-8'), 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, NULL, 'UTF-8'), 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, NULL, 'UTF-8'), 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, NULL, 'UTF-8'), 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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FrxEmailMerge::$email_input_format public property
FrxEmailMerge::$templateName public property
FrxEmailMerge::configForm public function Returns the section Enter description here ... Overrides FrxRenderer::configForm
FrxEmailMerge::configValidate public function Default configuration validator. Simply validates header and footer attributes. Overrides FrxRenderer::configValidate
FrxEmailMerge::generate public function Generate the template from the configuration. Overrides FrxRenderer::generate
FrxEmailMerge::scrapeConfig public function Default method for extracting configuration information from the template. This just scrapes teh current child html as the template. Overrides FrxRenderer::scrapeConfig
FrxEmailMerge::__construct public function Overrides FrxRenderer::__construct
FrxRenderer::$blockName public property
FrxRenderer::$blockParms public property
FrxRenderer::$columns public property
FrxRenderer::$dataProvider public property
FrxRenderer::$doc_types public property
FrxRenderer::$dom public property
FrxRenderer::$format public property
FrxRenderer::$frxAttributes public property
FrxRenderer::$frxReport public property @var FrxReport
FrxRenderer::$htmlAttributes public property
FrxRenderer::$id public property
FrxRenderer::$input_format public property
FrxRenderer::$name public property
FrxRenderer::$numeric_columns public property
FrxRenderer::$reportDocDomNode public property
FrxRenderer::$reportDocNode public property
FrxRenderer::$teng public property
FrxRenderer::$xmlns public property
FrxRenderer::$xpathQuery public property
FrxRenderer::addAttributes public static function Helper function for convergint methods to a standard associated array.
FrxRenderer::addFragment function Append a textual XHTML fragment to the dom. We do not use the DOMDocumentFragment optioin because they don't properly import namespaces. .
FrxRenderer::addNode function Add a node to the existing dom element with attributes
FrxRenderer::addText function Add a text node to the current dom node.
FrxRenderer::arrayAttributes public function Puts attributes back in array format prior to rendering.
FrxRenderer::blockDiv public function Generate generic div tag.
FrxRenderer::columns public function Extract a list of columns from the data context.
FrxRenderer::configAjax public function Generate ajax configuration attributes for use in template configurtion forms.
FrxRenderer::drupalRender public function Render a drupal form in a forena template
FrxRenderer::extract public function Extract a configuration var removing it from the array
FrxRenderer::extractChildSource public function Get the textual representations of html for the configuration engine.
FrxRenderer::extractSource public function Get the textual representations of html for the configuration engine.
FrxRenderer::extractTemplateHTML public function Get the textual representations of html for the configuration engine.
FrxRenderer::extractXPath public function Extracts the inner html of all nodes that match a particular xpath expression.
FrxRenderer::extractXPathInnerHTML public function Extracts the inner html of all nodes that match a particular xpath expression.
FrxRenderer::idFromBlock public function Simple function to get id from node.
FrxRenderer::initReportNode public function This function is called to give the renderer the current conetxt in report rendering. It makes sure the renderer has the current DOM nodes dom documnent, and other attributes.
FrxRenderer::innerXML public function Return the inside xml of the current node
FrxRenderer::mergedAttributes public function Standard php array containing merged attributes Enter description here ...
FrxRenderer::removeChildren public function Rmove all the children of a dom node in the current report.
FrxRenderer::removeChildrenExcept public function Removes all chidren from the dome node expect those with a tagname specified by the the $tags argurment
FrxRenderer::render public function Default Render action, which simply does normal forena rendering. You can use renderDomNode at any time to generate the default forena rendering methods. 9
FrxRenderer::renderChildren public function
FrxRenderer::renderDomNode public function Recursive report renderer Walks the nodes rendering the report.
FrxRenderer::replacedAttributes public function Gives the token replaced attributes of a node.
FrxRenderer::replaceTokens public function A helper function to allow replacement of tokens from inside a renderer wihout needing to understand the object
FrxRenderer::resetTemplate public function Starting at the current report node, this function removes all child nodes. It aso removes any FRX attributes on the current as well.
FrxRenderer::setAttributes public function Set FRX attributes.
FrxRenderer::setFirstNode public function Sets the first child element to a node and returns it. IF the node
FrxRenderer::validateTextFormats public function Helper funciton for validating text_format type controls.
FrxRenderer::weight_sort public function Sort a column list by weight.
FrxRenderer::weight_sort_comp public static function
FrxRenderer::xmlToValues public function Convert XML to key value pairs. This is used in support of graping to get specific key/value pairs in an array format suitable for passing off to php libraries.