You are here

function FrxReportGenerator::report_css in Forena Reports 7.2

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

Determines which css 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_css()
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 78
Common functions used throughout the project but loaded in this file to keep the module file lean.

Class

FrxReportGenerator

Code

function report_css($desc, $form, $format = '') {
  $css_files = array();

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

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