You are here

public function DataContext::group in Forena Reports 7.5

Iterate the data based on the provided path.

Parameters

$path xpath to iterate xml on:

$group grouping value:

$sort Sort criteria:

File

src/Context/DataContext.php, line 319
DataContext.php The FrxData class holds all of the data contexts during the report rendering process. The general idea is that during the report render, data objects are pushed on the stack with the id's of the block or foreach objects that…

Class

DataContext

Namespace

Drupal\forena\Context

Code

public function group($data, $group = '') {
  $rows = array();
  if (is_array($group)) {
    $group = implode(' ', $group);
  }
  $group = (string) $group;
  if (is_array($data) || is_object($data)) {
    foreach ($data as $row) {
      Frx::Data()
        ->push($row, '_group');
      $gval = $this->teng
        ->replace($group, TRUE);
      Frx::Data()
        ->pop();
      $rows[$gval][] = $row;
    }
  }
  return $rows;
}