You are here

private function FrxCrosstab::defaultHeaders in Forena Reports 7.4

Generate default headers from Embedded xml.

1 call to FrxCrosstab::defaultHeaders()
FrxCrosstab::render in renderers/FrxCrosstab.inc
Render the crosstab

File

renderers/FrxCrosstab.inc, line 136

Class

FrxCrosstab

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;
      }
    }
  }
}