function forena_user_data_blocks in Forena Reports 7.3
Same name and namespace in other branches
- 6.2 forena.admin.inc \forena_user_data_blocks()
- 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()
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 2096
Code
function forena_user_data_blocks($search) {
$repos = Frx::RepoMan()->repositories;
$blocks = array();
$user_blocks = array();
foreach ($repos as $name => $r) {
// Make really sure the data provider objects have been instantiated
$o = Frx::RepoMan()
->repository($name);
if (method_exists($o, 'list_blocks')) {
$blocks = array();
$o
->list_blocks($search, $blocks);
foreach ($blocks as $block) {
$block_info = $o
->loadBlock($block);
if (method_exists($o, 'access')) {
$allow = $o
->access(@$block_info['access']);
if ($allow) {
$user_blocks[] = $name . '/' . $block;
}
}
}
}
}
if ($user_blocks) {
asort($user_blocks);
}
return $user_blocks;
}