public function FrxDataProvider::list_blocks in Forena Reports 7.2
Same name and namespace in other branches
- 6.2 FrxDataProvider.inc \FrxDataProvider::list_blocks()
- 6 FrxDataProvider.inc \FrxDataProvider::list_blocks()
- 7 FrxDataProvider.inc \FrxDataProvider::list_blocks()
Find all the blocks matching a provided search string
Parameters
string $search part block names to search for:
Return value
unknown
File
- ./
FrxDataProvider.inc, line 100 - Class that defines default methods for access control in an FrxDataProvider
Class
- FrxDataProvider
- @file Class that defines default methods for access control in an FrxDataProvider
Code
public function list_blocks($search, $subdir = '', $this_list = array()) {
$block_list = $this_list;
// First find files that match the search string
$path = $this->block_path . '/';
if ($subdir) {
$path = $subdir . '/';
}
$block_path .= $path . '*' . $search . '*.' . $this->block_ext;
// Find sql files
$d = glob($block_path);
if ($d) {
foreach ($d as $file_name) {
// Split off the extention
$p = strripos($file_name, '.');
if ($p !== FALSE) {
$ext = substr($file_name, $p + 1);
$block_name = substr($file_name, 0, $p);
}
else {
$ext = '';
$block_name = $file_name;
}
$block_list[] = str_replace($this->block_path . '/', '', $block_name);
}
}
// Find directories
$d = glob($path . '*');
if ($d) {
foreach ($d as $dir_name) {
if (is_dir($dir_name)) {
$block_list += $this
->list_blocks($search, $dir_name, $block_list);
}
}
}
return $block_list;
}