You are here

function FrxReportGenerator::repository in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 FrxReportGenerator.inc \FrxReportGenerator::repository()
3 calls to FrxReportGenerator::repository()
FrxReportGenerator::get_formatter in ./FrxReportGenerator.inc
Load the formatters for all initialized repositories.
FrxReportGenerator::invoke_data_provider in ./FrxReportGenerator.inc
Extract the data by running a block
FrxReportGenerator::load_block in ./FrxReportGenerator.inc
Returns an array of information about the data block

File

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

Class

FrxReportGenerator

Code

function repository($name = '') {
  static $repos = '';
  global $_forena_repositories;

  // Empty repository so we need to initialize
  if (!$repos) {

    // Build the default sample one
    $path = $this->app
      ->forena_path();
    $repos = array();

    // Load the repository list from the global settings.php file.
    $repos = $this->app
      ->repositories();
    if ($_forena_repositories) {
      array_merge($repos, $_forena_repositories);
    }
  }

  // Now determine if the object exists
  if ($name) {
    if (isset($repos[$name])) {
      if (@(!is_object($repos[$name]['data']))) {
        $this
          ->load_repository($repos[$name]);
      }
      return $repos[$name];
    }
    else {
      $this->app
        ->error('Undefined repository' . $name, "Undefined Repository: {$name} ");
    }
  }
  else {
    return $repos;
  }
}