You are here

public function FrxDataProvider::load_block in Forena Reports 7

Same name and namespace in other branches
  1. 6.2 FrxDataProvider.inc \FrxDataProvider::load_block()
  2. 6 FrxDataProvider.inc \FrxDataProvider::load_block()
  3. 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.

... See full list

File

./FrxDataProvider.inc, line 57
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;
  $block = forena_load_block_file($filename, $this->comment_prefix, $this->comment_suffix);

  // 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']);

    //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;
}