You are here

public function FrxInclude::render in Forena Reports 7.5

Default Render action, which simply does normal forena rendering. You can use renderDomNode at any time to generate the default forena rendering methods.

Return value

Ambigous <string, unknown, unknown_type, text, mixed>

Overrides RendererBase::render

File

src/Renderer/FrxInclude.php, line 11
FrxInclude Include a reference to another report as an asset. @author davidmetzler

Class

FrxInclude

Namespace

Drupal\forena\Renderer

Code

public function render() {

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

  // Determine data type
  $include = @$attributes['src'];

  // Reformat URL
  @(list($url, $query_str) = @explode('?', $include));
  $url = $this->frxReport
    ->replace($url, TRUE);
  $report_url = $url;
  $parts = @explode('/', $url);
  $file = @$parts[count($parts) - 1];
  $parts = explode('.', $file);

  // Determine file extention
  $ext = count($parts) > 1 ? $parts[count($parts) - 1] : '';
  $query = array();
  if ($query_str) {
    parse_str($query_str, $query);
    foreach ($query as $key => $value) {
      $query[$key] = $this->frxReport
        ->replace($value, TRUE);
    }
  }

  // Build URL
  $options = array(
    'query' => $query,
  );
  $url = url($url, $options);
  if ($this->format == 'web') {
    $output = $this
      ->render_reference($url, $ext, $attributes);
  }
  else {
    $output = forena_report_include(str_replace('reports/', '', $report_url), $query);
  }
  return $output;
}