public function FrxRepoMan::__construct in Forena Reports 7.4
Same name and namespace in other branches
- 7.3 FrxRepoMan.inc \FrxRepoMan::__construct()
File
- ./
FrxRepoMan.inc, line 15 - FrxRepoMan.inc Enter description here ... @author davidmetzler
Class
- FrxRepoMan
- @file FrxRepoMan.inc Enter description here ... @author davidmetzler
Code
public function __construct() {
global $_forena_repositories;
// Empty repository so we need to initialize
// Build the default sample one
$repos = array();
// Load the repository list from the global settings.php file.
if ($_forena_repositories) {
$repos = $_forena_repositories;
}
// Overide difinitions of the sample and drupal repositories.
$path = drupal_get_path('module', 'forena');
$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',
);
drupal_alter('forena_repos', $repos);
// 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;
}
if ($_forena_repositories) {
array_merge($repos, $_forena_repositories);
}
$this->repositories = $repos;
}