You are here

function FrxTemplate::addNode in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 templates/FrxTemplate.inc \FrxTemplate::addNode()
  2. 7.3 templates/FrxTemplate.inc \FrxTemplate::addNode()
6 calls to FrxTemplate::addNode()
FrxEmailMerge::generate in templates/FrxEmailMerge.inc
* * Enter description here ... *
FrxFieldTable::generate in templates/FrxFieldTable.inc
* * Enter description here ... *
FrxGraphTemplate::generate in templates/FrxGraphTemplate.inc
* * Enter description here ... *
FrxRptInclude::generate in templates/FrxRptInclude.inc
* * Enter description here ... *
FrxTable::generate in templates/FrxTable.inc
* * Enter description here ... *

... See full list

File

templates/FrxTemplate.inc, line 84

Class

FrxTemplate

Code

function addNode($cur_node, $indent = 0, $tag = 'div', $value = '', $attributes = array(), $frx_attributes = array()) {
  $dom = $this->dom;
  if (!$cur_node) {
    return;
  }
  if ($indent !== FALSE) {
    $tnode = $dom
      ->createTextNode("\n" . str_repeat(' ', $indent));
    $cur_node
      ->appendChild($tnode);
  }
  $pnode = $dom
    ->createElement($tag, $value);
  if ($attributes) {
    foreach ($attributes as $key => $value) {
      if ($value) {
        $attr = $dom
          ->createAttribute($key);
        $attr->value = $value;
        $pnode
          ->appendChild($attr);
      }
    }
  }
  if ($frx_attributes) {
    foreach ($frx_attributes as $key => $value) {
      if ($value) {
        $attr = $dom
          ->createAttributeNS($this->xmlns, $key);
        $attr->value = htmlentities($value);
        $pnode
          ->appendChild($attr);
      }
    }
  }
  $cur_node
    ->appendChild($pnode);
  return $pnode;
}