You are here

public function DriverBase::data in Forena Reports 8

Return data based on block definition.

Parameters

array $block: Block definition.

bool|FALSE $raw_mode: True to reutrn raw record/states or data structures

Return value

string

Overrides DriverInterface::data

File

src/FrxPlugin/Driver/DriverBase.php, line 145
Class that defines default methods for access control in an DriverBase

Class

DriverBase

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function data(array $block, $raw_mode = FALSE) {
  $xml = '';
  $right = @$block['access'];
  if ($block && $this
    ->access($right)) {
    if ($raw_mode) {
      $block['options']['return_type'] = 'raw';
    }
    switch ($block['type']) {
      case 'sql':
        $xml = $this
          ->sqlData($block['source'], @$block['options']);
        break;
      case 'xml':
        $xml = $this
          ->xmlData($block['source']);
        break;
      case 'php':
        $data = $this
          ->dataManager()->dataSvc
          ->currentContextArray();
        $xml = $this
          ->phpData($block['object'], $data);
        break;
    }
  }
  return $xml;
}