You are here

public function FrxReport::render in Forena Reports 7.4

Same name and namespace in other branches
  1. 6.2 FrxReport.inc \FrxReport::render()
  2. 6 FrxReport.inc \FrxReport::render()
  3. 7 FrxReport.inc \FrxReport::render()
  4. 7.2 FrxReport.inc \FrxReport::render()
  5. 7.3 FrxReport.inc \FrxReport::render()

Render the report

Return value

unknown_type

File

./FrxReport.inc, line 273
Basic report provider. Controls the rendering of the report.

Class

FrxReport

Code

public function render($format, $render_form = TRUE, $cache_data = array(), $existing_parms = FALSE) {
  $events = $this->commands;
  $this->commands = array();
  if (!$format) {
    $format = 'web';
  }

  // Only push the parameter conte
  if (!$existing_parms) {
    Frx::Data()
      ->push($this->parms, 'parm');
  }
  $this->parameters_form = array();

  // Find the Body of the report.
  $this->format = $format;
  $dom = $this->dom;

  // Trap error condition
  if (!$dom) {
    return '';
  }
  $body = $dom
    ->getElementsByTagName('body')
    ->item(0);
  $this
    ->preloadData();

  // Render the rport.
  $c = $this
    ->getRenderer('FrxRenderer');
  $c
    ->initReportNode($body, $this);
  if (!$this->missing_parms) {
    $c
      ->renderChildren($body, $this->html);
  }

  //$this->collapseParameters();
  if (!$this->parameters_form) {
    $this
      ->parametersForm(array(
      'collapsible' => TRUE,
      'collapsed' => $this->blocks_loaded,
    ));
  }

  // Determine the correct filter.
  $filter = variable_get('forena_input_format', 'none');
  $skinfo = Frx::Data()
    ->getContext('skin');
  if (isset($skinfo['input_format'])) {
    $filter = $skinfo['input_format'];
  }
  if (isset($this->options['input_format'])) {
    $filter = $this->options['input_format'];
  }
  if ($filter && $filter != 'none') {
    $this->html = check_markup($this->html, $filter);
  }

  // Default in dynamic title from head.
  if ($this->frx_title) {
    $title = check_plain($this->teng
      ->replace($this->frx_title));
    if ($title) {
      $title = $this->title = $title;
    }
  }
  if (!$existing_parms) {
    Frx::Data()
      ->pop();
  }

  // Process the commands after the replacement
  if ($events) {
    foreach ($events as $event => $commands) {
      foreach ($commands as $command) {
        $this
          ->addAjaxCommand($command, $event);
      }
    }
  }
  Frx::Data()
    ->pop();
}