You are here

function forena_report_css in Forena Reports 6

Same name and namespace in other branches
  1. 7 forena.common.inc \forena_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 forena_report_css()
forena_report in ./forena.module
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

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

Code

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

  // First check for the form file
  $path = forena_report_path();
  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';
  }

  //drupal_set_message("desc: <pre>". print_r($desc, 1) ."</pre>");

  //drupal_set_message("css files: <pre>". print_r($css_files, 1) ."</pre>");
  return $css_files;
}