function forena_user_data_blocks in Forena Reports 6.2
Same name and namespace in other branches
- 6 forena.admin.inc \forena_user_data_blocks()
- 7 forena.admin.inc \forena_user_data_blocks()
- 7.2 forena.admin.inc \forena_user_data_blocks()
- 7.3 forena.admin.inc \forena_user_data_blocks()
Provides list of blocks that a user has access to that are in any repository matching a specified search string
Parameters
string $search block to search for.:
Return value
array list of blocks the user has access to.
1 call to forena_user_data_blocks()
- forena_data_block_autocomplete in ./
forena.module - Auto complete for data blocks
File
- ./
forena.admin.inc, line 2263
Code
function forena_user_data_blocks($search) {
$repos = FrxReportGenerator::instance()->app
->repositories();
foreach ($repos as $name => $r) {
// Make really sure the data provider objects have been instantiated
$provider = $r;
if (!@$provider['data']) {
$provider = FrxReportGenerator::instance()
->repository($name);
}
$repos[$name] = $provider;
// Invoke the list block function to find out all of the block names
$o = $provider['data'];
if (method_exists($o, 'list_blocks')) {
$blocks = $o
->list_blocks($search);
foreach ($blocks as $block) {
$block_info = $o
->load_block($block);
if (method_exists($o, 'access')) {
$allow = $o
->access($block_info['access']);
if ($allow) {
$user_blocks[] = $name . '/' . $block;
}
}
}
}
}
return $user_blocks;
}