You are here

public function ReportFile::allReports in Forena Reports 7.5

List all the reports for a language.

Return value

unknown

1 call to ReportFile::allReports()
ReportFile::reportsByCategory in src/File/ReportFile.php
Generate an ordered list of reports by category

File

src/File/ReportFile.php, line 32

Class

ReportFile

Namespace

Drupal\forena\File

Code

public function allReports() {
  global $language;
  $reports = array();
  $this
    ->validateAllCache();
  $data = $this
    ->getCache('frx');
  $def_language = language_default('language');
  if ($data) {
    foreach ($data as $base_name => $obj) {
      if ($obj->cache) {
        if ($obj->cache['language'] != 'en') {
          $rpt_name = substr($base_name, strlen($obj->cache['language']) + 1);
        }
        else {
          $rpt_name = $base_name;
        }
        if ($obj->cache['language'] == $language->language) {
          $reports[$rpt_name] = $obj;
        }
        elseif ($obj->cache['language'] == $def_language && (!isset($reports[$rpt_name]) || $reports[$rpt_name]->cache['language'] == 'en')) {
          $reports[$rpt_name] = $obj;
        }
        elseif ($obj->cache['language'] == 'en' && !isset($reports[$rpt_name])) {
          $reports[$rpt_name] = $obj;
        }
      }
    }
  }
  uasort($reports, '\\Drupal\\forena\\File\\ReportFile::reportCompare');
  return $reports;
}