View source
<?php
class FrxRenderer {
public $teng;
public $reportDocDomNode;
public $reportDocNode;
public $frxAttributes;
public $htmlAttributes;
public $dataProvider;
public $name;
public $id;
public function __construct($domNode = null, $teng = null, $frxReport = null) {
if ($domNode) {
$this
->initReportNode($domNode, $teng);
}
}
public function initReportNode($domNode, $frxReport) {
$this->reportDocDomNode = $domNode;
$this->dataProvider = FrxData::instance();
$this->reportDocNode = simplexml_import_dom($domNode);
$node = $this->reportDocNode;
$this->name = $node
->getName();
$this->htmlAttributes = $node
->attributes();
$this->id = (string) $this->htmlAttributes['id'];
$this->frxAttributes = $node
->attributes(FRX_NS);
$this->teng = $frxReport->teng;
$this->frxReport = $frxReport;
}
public function replaceTokens($text, $raw_mode = FALSE) {
return $this->teng
->replace($text, $raw_mode);
}
public function render() {
$this
->initNode($domNode, $teng);
$xml = $this->dataProvider
->getCurrentContext();
$node = $this->nodes;
$text = $this->xmlNode
->asXML();
$o = $this->teng
->replace($text);
return $o;
}
public function mergedAttributes() {
$attributes = array();
if (isset($this->frxAttributes)) {
foreach ($this->frxAttributes as $key => $data) {
$attributes[$key] = (string) $data;
}
}
if (isset($this->htmlAttributes)) {
foreach ($this->htmlAttributes as $key => $data) {
$attributes[$key] = (string) $data;
}
}
return $attributes;
}
}