You are here

public function FrxTable::generate in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 templates/FrxTable.inc \FrxTable::generate()
  2. 7.3 templates/FrxTable.inc \FrxTable::generate()
  3. 7.4 renderers/FrxTable.inc \FrxTable::generate()

* * Enter description here ... *

Parameters

string $data_block: * @param SimpleXMLElement $xml * @param array $config

Overrides FrxTemplate::generate

File

templates/FrxTable.inc, line 4

Class

FrxTable

Code

public function generate($xml, $config) {
  $block = $config['block'];
  $id = $this
    ->idFromBlock($block);
  $config['id'] = $id . '_block';
  $config['class'] = 'FrxTable';
  $div = $this
    ->blockDiv($config);
  $columns = $this
    ->columns($xml);
  $table = $this
    ->addNode($div, 4, 'table');
  $thead = $this
    ->addNode($table, 6, 'thead');
  $throw = $this
    ->addNode($thead, 8, 'tr');
  $tbody = $this
    ->addNode($table, 6, 'tbody');
  $tdrow = $this
    ->addNode($tbody, 8, 'tr', null, array(
    'id' => $id,
  ), array(
    'foreach' => '*',
  ));
  if ($columns) {
    foreach ($columns as $col) {
      $this
        ->addNode($throw, 10, 'th', $col);
      $this
        ->addNode($tdrow, 10, 'td', '{' . $col . '}');
    }
  }
}