You are here

function forena_invoke_data_provider in Forena Reports 7

Same name and namespace in other branches
  1. 6 forena.common.inc \forena_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

5 calls to forena_invoke_data_provider()
forena_block_access in ./forena.common.inc
Check access control using the block in a data block. In this case public assess returns true.
forena_block_xml in ./forena.common.inc
Send report block XML Enter description here ...
forena_data_block_form_submit in ./forena.admin.inc
The Preview submit handler for forena_add_block_form Renders datablock into a report
forena_get_data_block_params in ./forena.common.inc
FrxReport::get_data in ./FrxReport.inc
Get the data block

File

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

Code

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

  // Get the data
  $repos = forena_repository($provider);
  if (isset($repos['user callback'])) {
    $user_fn = $repos['user callback'];
    if (is_callable($user_fn)) {
      $parameters['current_user'] = $user_fn();
    }
  }
  if ($repos['data']) {
    $provider = $repos['data'];
    $access = TRUE;
    if (method_exists($provider, 'data')) {
      $xml = $provider
        ->data($block, $parameters, $clause);
    }
    return $xml;
  }
}