You are here

public function FrxReportGenerator::report_desc in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 FrxReportGenerator.inc \FrxReportGenerator::report_desc()

Get name from argument 1 or alterntaively from a file name

Parameters

unknown_type $name:

1 call to FrxReportGenerator::report_desc()
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 43
Common functions used throughout the project but loaded in this file to keep the module file lean.

Class

FrxReportGenerator

Code

public function report_desc($name = '') {
  $app = $this->app;

  // Get defined document types
  $doctypes = $this
    ->supported_doctypes();
  $parts = explode('.', $name);
  $name = '';
  if ($parts) {
    foreach ($parts as $part) {
      if (!isset($doctypes[$part])) {
        $name .= '/' . $part;
      }
      else {
        $desc['format'] = $part;
      }
    }
  }
  $desc['name'] = trim($name, '/');
  $report_path = $app
    ->configuration('report_repos');
  @(list($dir, $name_part) = explode('/', $name_part, -2));
  if (!$name_part) {
    $dir = '';
  }
  $desc['directory'] = $report_path . '/' . $dir;
  $desc['filename'] = $report_path . '/' . trim($name, ' /') . '.frx';
  $desc['link'] = 'reports/' . trim(str_replace('/', '.', $name), '.');
  $desc['exists'] = file_exists($desc['filename']);
  return $desc;
}