You are here

public function FrxInclude::render in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 plugins/FrxInclude.inc \FrxInclude::render()
  2. 7.3 renderers/FrxInclude.inc \FrxInclude::render()
  3. 7.4 renderers/FrxInclude.inc \FrxInclude::render()

Overrides FrxRenderer::render

File

plugins/FrxInclude.inc, line 3

Class

FrxInclude

Code

public function render() {

  // Get data from source
  $attributes = $this
    ->mergedAttributes();
  $output = '';

  // Determine data type
  $include = @$attributes['src'];
  $include = $this->teng
    ->replace($include);
  @(list($url, $query_str) = @explode('?', $include));
  $parts = @explode('/', $url);
  $file = @$parts[count($parts) - 1];
  $parts = explode('.', $file);

  // Determine file extention
  $ext = count($parts) > 1 ? $parts[count($parts) - 1] : '';
  $query = array();
  parse_str($query_str, $query);
  $options = array(
    'query' => $query,
  );
  $url = FrxReportGenerator::instance()
    ->url($url, $options);
  $doc_types = FrxReportGenerator::instance()
    ->configuration('doc_formats');
  if (@$doc_types[$ext]) {
    $output = $this
      ->render_reference($url, $ext, $attributes);
  }
  else {
    $output = $this->teng
      ->replace($this->reportDocNode
      ->asXML());
  }
  return $output;
}