You are here

public function Report::__construct in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/Report.php \Drupal\forena\Report::__construct()

File

src/Report.php, line 52
Basic report provider. Controls the rendering of the report.

Class

Report

Namespace

Drupal\forena

Code

public function __construct($xhtml = '', $data = array(), $edit = FALSE) {
  $this->access = array();
  $this->parameters = array();
  $this->options = array();
  $this->teng = new ReportReplacer($this);
  $this
    ->setParameters($data);
  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
    try {
      $success = $dom
        ->loadXML($xhtml);
    } catch (Exception $e) {
      return;
    }
    if (!$success) {
      return;
    }
    $this->xpathQuery = new DOMXPath($dom);
    $this
      ->setReport($dom, $this->xpathQuery);
  }
}