You are here

public function Report::__construct in Forena Reports 8

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

File

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

Class

Report

Namespace

Drupal\forena

Code

public function __construct($xhtml = '') {
  $this->renderers = AppService::instance()
    ->getRendererPlugins();
  $this->access = array();
  $this->parameterDefinitions = array();
  $this->options = array();
  $this->replacer = new ReportReplacer($this);
  $this->input_format = AppService::instance()->input_format;
  $this->skin = AppService::instance()->default_skin;
  if ($xhtml) {
    $dom = $this->dom = new DOMDocument('1.0', 'UTF-8');

    // Load document and simplexml representation
    try {
      $success = $dom
        ->loadXML($xhtml);
    } catch (\Exception $e) {
      return NULL;
    }
    if (!$success) {
      return NULL;
    }
    $this->xpathQuery = new DOMXPath($dom);
    $this
      ->setReport($dom, $this->xpathQuery);
  }
}