You are here

public function FrxDataFile::__construct in Forena Reports 7.4

Constructor Sets the initial reort directory

Overrides FrxFile::__construct

File

./FrxDataFile.inc, line 11

Class

FrxDataFile

Code

public function __construct() {

  // Load default directory from configuration.
  $report_path = variable_get('forena_query_data_path', '');
  if (!$report_path) {
    $report_path = drupal_realpath('private://data');
    if ($report_path) {
      if (!file_exists($report_path)) {
        @mkdir($report_path);
      }
    }
    if (!$report_path) {
      $report_path = conf_path() . '/data';
    }
  }

  // Add directories for data  repos.
  $default_directory = rtrim($report_path, '/');
  $repositories = Frx::RepoMan()->repositories;
  $directories = array();
  foreach ($repositories as $k => $repos) {
    $directories[$k] = $repos['path'];
  }
  foreach ($directories as $dir) {
    $this->includes[$k] = rtrim($dir, '/');
  }

  // Parent constructor.
  parent::__construct($default_directory, $directories, array(
    'sql',
    'xml',
    'inc',
  ));
}