protected function FrxDataSource::loadBlockFromFile in Forena Reports 7.4
Same name and namespace in other branches
- 7.3 FrxDataSource.inc \FrxDataSource::loadBlockFromFile()
1 call to FrxDataSource::loadBlockFromFile()
- FrxDataSource::loadBlock in ./
FrxDataSource.inc - Load blcok data from filesystem
File
- ./
FrxDataSource.inc, line 59 - Class that defines default methods for access control in an FrxDataSource
Class
- FrxDataSource
- @file Class that defines default methods for access control in an FrxDataSource
Code
protected function loadBlockFromFile($block_name) {
$full_name = $this->name . '/' . $block_name;
$php_class = $block_name;
$php_file = $this->block_path . '/' . $php_class . '.php';
if (Frx::DataFile()
->exists($full_name . '.sql')) {
$contents = Frx::DataFile()
->contents($full_name . '.sql');
$block = $this
->parseSQLFile($contents);
$block['type'] = 'sql';
}
elseif (Frx::DataFile()
->exists($full_name . '.xml')) {
$contents = Frx::DataFile()
->contents($full_name . '.xml');
$block = $this
->parseXMLFile($contents);
$block['type'] = 'xml';
}
elseif (Frx::DataFile()
->exists($full_name . '.php')) {
include_once $php_file;
if (class_exists($php_class)) {
$o = new $php_class();
$block['type'] = 'php';
$block['access'] = @$o->access;
$block['object'] = $o;
if (method_exists($o, 'tokens')) {
$block['tokens'] = $o
->tokens();
}
elseif (isset($o->tokens)) {
$block['tokens'] = $o->tokens;
}
else {
$block['tokens'] = array();
}
}
}
else {
return array();
}
$block['locked'] = 1;
return $block;
}