protected function DriverBase::loadBlockFromFile in Forena Reports 8
1 call to DriverBase::loadBlockFromFile()
- DriverBase::loadBlock in src/
FrxPlugin/ Driver/ DriverBase.php - Load blcok data from filesystem
File
- src/
FrxPlugin/ Driver/ DriverBase.php, line 67 - Class that defines default methods for access control in an DriverBase
Class
Namespace
Drupal\forena\FrxPlugin\DriverCode
protected function loadBlockFromFile($block_name) {
$full_name = $this->name . '/' . $block_name;
$php_class = $block_name;
if ($this->fileSvc
->exists($block_name . '.sql')) {
$contents = $this->fileSvc
->contents($block_name . '.sql');
$block = $this
->parseSQLFile($contents);
$block['type'] = 'sql';
}
elseif ($this->fileSvc
->exists($block_name . '.xml')) {
$contents = $this->fileSvc
->contents($block_name . '.xml');
$block = $this
->parseXMLFile($contents);
$block['type'] = 'xml';
}
elseif ($this->fileSvc
->exists($block_name . '.php')) {
$php_file = $this->fileSvc
->path($php_class . '.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;
}