You are here

function FrxReportGenerator::invoke_data_provider in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 FrxReportGenerator.inc \FrxReportGenerator::invoke_data_provider()

Extract the data by running a block

Parameters

unknown_type $data_block:

unknown_type $parameters:

string $clause order / where cause:

Return value

unknown

3 calls to FrxReportGenerator::invoke_data_provider()
FrxReportGenerator::block_access in ./FrxReportGenerator.inc
Check access control using the block in a data block. In this case public assess returns true.
FrxReportGenerator::block_xml in ./FrxReportGenerator.inc
Accessor function named more conveniently Enter description here ...
FrxReportGenerator::data_block_params in ./FrxReportGenerator.inc

File

./FrxReportGenerator.inc, line 278
Common functions used throughout the project but loaded in this file to keep the module file lean.

Class

FrxReportGenerator

Code

function invoke_data_provider($data_block, $parameters = array(), $clause = '') {
  list($provider, $block) = explode('/', $data_block, 2);

  // Get the data
  $repos = $this
    ->repository($provider);
  if (isset($repos['enabled']) && !$repos['enabled']) {
    return '';
  }
  if (isset($repos['user callback'])) {
    $user_fn = $repos['user callback'];
    if (is_callable($user_fn)) {
      $current_user = $user_fn();
      FrxData::instance()
        ->setValue('current_user', $current_user);
    }
  }
  if ($repos['data']) {
    $provider = $repos['data'];
    $access = TRUE;
    if (method_exists($provider, 'data')) {
      $xml = $provider
        ->data($block, $parameters, $clause);
    }
    return $xml;
  }
}