You are here

private function FrxCrosstab::defaultHeaders in Forena Reports 7.5

Generate default headers from Embedded xml.

1 call to FrxCrosstab::defaultHeaders()
FrxCrosstab::render in src/Renderer/FrxCrosstab.php
Render the crosstab

File

src/Renderer/FrxCrosstab.php, line 139

Class

FrxCrosstab

Namespace

Drupal\forena\Renderer

Code

private function defaultHeaders() {
  $node = $this->reportDocNode;
  if ($node->thead && $node->thead->tr) {
    foreach ($node->thead->tr
      ->children() as $name => $cell) {
      $hcol = array();
      $hcol['data'] = forena_inner_xml($cell, $name);
      $hcol['depth'] = 1;
      foreach ($cell
        ->attributes() as $k => $v) {
        $hcol[$k] = (string) $v;
      }
      if ($name == 'th') {
        $this->group_headers[] = $hcol;
      }
      else {
        $this->dim_headers[] = $hcol;
      }
    }
  }
  if ($node->tbody && $node->tbody->tr) {
    foreach ($node->tbody->tr
      ->children() as $name => $cell) {
      $col = array();
      $col['data'] = forena_inner_xml($cell, $name);
      foreach ($cell
        ->attributes() as $k => $v) {
        $col[$k] = (string) $v;
      }
      if ($name == 'th') {
        $this->group_columns[] = $col;
      }
      else {
        $this->dim_columns[] = $col;
      }
    }
  }
}