public function FrxReport::__construct in Forena Reports 7.3
Same name and namespace in other branches
- 6.2 FrxReport.inc \FrxReport::__construct()
- 6 FrxReport.inc \FrxReport::__construct()
- 7 FrxReport.inc \FrxReport::__construct()
- 7.2 FrxReport.inc \FrxReport::__construct()
- 7.4 FrxReport.inc \FrxReport::__construct()
File
- ./
FrxReport.inc, line 37 - Basic report provider. Controls the rendering of the report.
Class
Code
public function __construct($xhtml, $data = array()) {
$this->access = array();
$this->parameters = array();
$this->options = array();
$this->parms = $data;
if ($data) {
$this->data_passed = TRUE;
}
$this->teng = new FrxSyntaxEngine(FRX_TOKEN_EXP, '{}', $this);
if ($xhtml) {
$dom = $this->dom = new DOMDocument('1.0', 'UTF-8');
// Old assumption is an ojbect is a simplexml one
if (is_object($xhtml)) {
$xhtml = $xhtml
->asXML();
}
// Load document and simplexml representation
$dom
->loadXML($xhtml);
$dom->formatOutput = TRUE;
$rpt_xml = $this->rpt_xml = simplexml_import_dom($dom);
// Load header data
$this->body = $rpt_xml->body;
if ($rpt_xml->head) {
$this->title = (string) $rpt_xml->head->title;
$nodes = $rpt_xml
->xpath('//frx:docgen/frx:doc');
$this->formats = array();
if ($nodes) {
foreach ($nodes as $value) {
$arr = $value
->attributes();
$this->formats[] = (string) $arr['type'];
}
}
foreach ($rpt_xml->head
->children(FRX_NS) as $name => $node) {
switch ($name) {
case 'fields':
$this->fields = $node;
break;
case 'category':
$this->category = (string) $node;
break;
case 'descriptor':
$this->descriptor = (string) $node;
break;
case 'options':
foreach ($node
->attributes() as $key => $value) {
$this->options[$key] = (string) $value;
}
break;
case 'title':
$this->frx_title = (string) $node;
break;
case 'form':
$this->form = (string) $value;
break;
case 'parameters':
foreach ($node
->children(FRX_NS) as $key => $node) {
$parm = array();
foreach ($node
->attributes() as $akey => $attr) {
$parm[$akey] = (string) $attr;
}
$id = $parm['id'];
$val = isset($parm['value']) ? $parm['value'] : '';
$parm['value'] = (string) $node ? (string) $node : $val;
$this->parameters[$id] = $parm;
}
break;
case 'doctypes':
$this->doctypes = $value;
break;
}
}
$this->skin = isset($this->options['skin']) ? $this->options['skin'] : @$this->options['form'];
}
}
}