public function FrxDataProvider::load_block in Forena Reports 6.2
Same name and namespace in other branches
- 6 FrxDataProvider.inc \FrxDataProvider::load_block()
- 7 FrxDataProvider.inc \FrxDataProvider::load_block()
- 7.2 FrxDataProvider.inc \FrxDataProvider::load_block()
Default block load Loads the data block based on the block name from the file system. The classes that are derived from this will set the block_ext property, which in most cases is .sql but might be something different. The load of the block file should return data, access and probably parameters to.
Parameters
unknown_type $block_name:
Return value
unknown
6 calls to FrxDataProvider::load_block()
- FrxDrupal::data in plugins/
FrxDrupal.inc - Get data based on file data block in the repository.
- FrxFiles::data in plugins/
FrxFiles.inc - FrxMSSQL::data in plugins/
FrxMSSQL.inc - Get data based on file data block in the repository.
- FrxOracle::data in plugins/
FrxOracle.inc - Get data based on file data block in the repository.
- FrxPDO::data in plugins/
FrxPDO.inc - Get data based on file data block in the repository.
File
- ./
FrxDataProvider.inc, line 58 - 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 load_block($block_name, $clause = '') {
$filename = $this->block_path . '/' . $block_name . '.' . $this->block_ext;
$contents = FrxReportGenerator::instance()
->load_block_file($filename);
if ($this->block_ext == 'sql') {
$block = $this
->parseSQLFile($contents);
}
else {
$block = $this
->parseXMLFile($contents);
}
// If we have a regular expression token parser, then get the tokens out of the block.
if ($this->te) {
$tokens = @$this->te
->tokens($block['source']);
$tokens = array_diff($tokens, array(
'current_user',
));
//drupal_set_message("tokens: ". print_r($tokens, 1));
//check tokens in the where clause
if ($clause) {
$clause_tokens = $this->te
->tokens($clause);
//drupal_set_message("clause tokens: ". print_r($clause_tokens, 1));
$temp = array();
$temp = array_merge($tokens, $clause_tokens);
//check for duplicates in block tokens
if ($clause_tokens) {
foreach ($clause_tokens as $ct) {
if (!isset($temp[$ct])) {
array_push($tokens, $ct);
}
}
}
}
$block['tokens'] = $tokens;
}
return $block;
}