You are here

function FrxReportGenerator::report_js in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 FrxReportGenerator.inc \FrxReportGenerator::report_js()

Determines which js files need to be loaded.

Parameters

array $desc Report descriptor from forena_rport_desc:

string $form The report "form" to be used. From the report:

string $format Document format that will be used for the report.:

Return value

array A list of css files that should be applied to the report.

1 call to FrxReportGenerator::report_js()
FrxReportGenerator::report in ./FrxReportGenerator.inc
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.

File

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

Class

FrxReportGenerator

Code

function report_js($desc, $form, $format = '') {
  $js_files = array();

  // First check for the form file
  $path = $this->app
    ->configuration('report_repos');
  if (file_exists($path . '/' . $form . '.js')) {
    $js_files[] = $path . '/' . $form . '.js';
  }
  if ($format && file_exists($path . '/' . $form . '-' . $format . '.js')) {
    $js_files[] = $path . '/' . $form . '-' . $format . '.js';
  }

  // Now check for a report specific file
  $base_file = $path . '/' . $desc['name'];
  if ($format && file_exists($base_file . '-' . $format . '.js')) {
    $js_files[] = $base_file . '-' . $format . '.js';
  }
  elseif (file_exists($base_file . '.js')) {
    $js_files[] = $base_file . '.js';
  }
  return $js_files;
}