function FrxRenderer::addFragment in Forena Reports 7.4
Append a textual XHTML fragment to the dom. We do not use the DOMDocumentFragment optioin because they don't properly import namespaces. .
Parameters
DOMNode $node:
unknown $xml_string:
string $ctl_name:
7 calls to FrxRenderer::addFragment()
- FrxCrosstab::generate in renderers/
FrxCrosstab.inc - Generate the template from the configuration.
- FrxEmailMerge::generate in renderers/
FrxEmailMerge.inc - Generate the template from the configuration.
- FrxFieldTable::generate in renderers/
FrxFieldTable.inc - Generate the template from the configuration.
- FrxMergeDocument::generate in renderers/
FrxMergeDocument.inc - Generate the template from the configuration.
- FrxSection::generate in renderers/
FrxSection.inc - Build the template
File
- renderers/
FrxRenderer.inc, line 635 - FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler
Class
- FrxRenderer
- @file FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler
Code
function addFragment(DOMNode $node, $xml_string, $ctl_name = 'Header') {
if (is_array($xml_string) && isset($xml_string['value'])) {
$xml_string = $xml_string['value'];
}
if ($xml_string && !is_array($xml_string)) {
$temp_dom = Frx::tempDOM();
$body_xml = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY nbsp " ">
]><html xmlns:frx="' . $this->xmlns . '"><body>' . $xml_string . '</body></html>';
try {
$temp_dom
->loadXML($body_xml);
} catch (Exception $e) {
Frx::error('Malformed report body', '<pre>' . $e
->getMessage() . $e
->getTraceAsString() . '</pre>');
}
$body = $temp_dom
->getElementsByTagName('body')
->item(0);
foreach ($body->childNodes as $sub) {
$new_node = $this->dom
->importNode($sub, TRUE);
$node
->appendChild($new_node);
}
if ($node->nodeType == XML_ELEMENT_NODE) {
$xmlnode = simplexml_import_dom($node);
$frx_nodes = $xmlnode
->xpath('//*[@frx:*]');
if (!$frx_nodes) {
$this
->frxReportsave_attributes_by_id();
}
}
}
}