You are here

function FrxReportGenerator::report in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 FrxReportGenerator.inc \FrxReportGenerator::report()
  2. 7.2 FrxReportGenerator.inc \FrxReportGenerator::report()
  3. 7.4 FrxReportGenerator.inc \FrxReportGenerator::report()

Load and render a report based on a drupal path. In this function the arglist is used to get the full path to the report.

Return value

unknown

File

./FrxReportGenerator.inc, line 215
Common functions used throughout the project but loaded in this file to keep the module file lean.

Class

FrxReportGenerator

Code

function report($name_in, $parms = array(), $print = TRUE) {
  $output = '';
  $desc = Frx::Menu()
    ->parseURL($name_in);
  $name = $desc['name'];
  $format = isset($desc['format']) ? $desc['format'] : '';
  $filename = $desc['filename'];

  // Determine the data to get.
  if (!$parms) {
    $parms = array_merge($_GET, $_POST);
    unset($parms['q']);
  }
  else {
    $parms = (array) $parms;
  }
  if ($name) {
    $r = @$this
      ->get_report($name, $parms);
    if (!$r || !$r->rpt_xml) {
      $this->app
        ->error('Could not load report. Check for invalid XML in ' . $name);
      return '';
    }

    //check for default parameters
    $r
      ->processParameters();
    Frx::Skin()
      ->load($r->skin);
    Frx::Skin()
      ->loadSkinFiles($name);
    $r
      ->render($format, $print);
    $o = Frx::Document($format);
    if ($o) {
      $output .= $o
        ->render($r, $format, array());

      //$output = check_markup($output, variable_get('forena_input_format', 'full_html'));
      if ($print) {
        $printed = $o
          ->output($output);
      }
      else {
        $printed = FALSE;
      }
      if (!$printed) {
        return $output;
      }
    }
  }
}