You are here

public function FrxDrupalApplication::repositories in Forena Reports 7.4

Same name and namespace in other branches
  1. 6.2 FrxDrupalApplication.inc \FrxDrupalApplication::repositories()
  2. 7.2 FrxDrupalApplication.inc \FrxDrupalApplication::repositories()
  3. 7.3 FrxDrupalApplication.inc \FrxDrupalApplication::repositories()

Return the repositories configured for this applicaiton.

File

./FrxDrupalApplication.inc, line 162
HostApp.inc Defines all the interface points between the host application and Forena. Each of these methods must be specified in order for Forena to function properly. The base class here is drupal, so those

Class

FrxDrupalApplication

Code

public function repositories() {
  global $_forena_repositories;
  $repos = array();

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

  // Overide difinitions of the sample and drupal repositories.
  $repos['forena_help'] = array(
    'path' => $path . '/repos/forena_help',
    'title' => 'Forena Help Reports',
  );
  $repos['drupal'] = array(
    'path' => $path . '/repos/drupal',
    'title' => 'Drupal Reports',
  );
  $repos['sampledb'] = array(
    'path' => $path . '/repos/sample',
    'title' => 'Sample DB Repository',
  );

  // Retrieve the repositories defined in the database;
  $results = db_query('SELECT * FROM {forena_repositories}');
  foreach ($results as $r) {
    if ($r->config) {
      $new_r = unserialize($r->config);
    }
    else {
      $new_r = array();
    }
    $r_name = $r->repository;
    if (is_array(@$repos[$r_name])) {
      $new_r = array_merge($new_r, $repos[$r_name]);
    }
    else {
      $new_r['source'] = 'user';
    }
    $new_r['title'] = $r->title;
    $new_r['enabled'] = $r->enabled;
    $repos[$r_name] = $new_r;
  }
  drupal_alter('forena_repos', $repos);
  return $repos;
}