You are here

public function FrxFieldTable::generate in Forena Reports 7.2

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

* * Enter description here ... *

Parameters

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

Overrides FrxTemplate::generate

File

templates/FrxFieldTable.inc, line 4

Class

FrxFieldTable

Code

public function generate($xml, $config) {
  $config['foreach'] = '*';
  $config['class'] = 'FrxFieldTable';
  $div = $this
    ->blockDiv($config);
  $columns = $this
    ->columns($xml);
  $table = $this
    ->addNode($div, 4, 'table', NULL, NULL, NULL);
  $r = 0;
  if ($columns) {
    foreach ($columns as $col) {
      $r++;
      $tbody = $this
        ->addNode($table, 6, 'tbody');
      $tr = $this
        ->addNode($tbody, 8, 'tr');
      $th = $this
        ->addNode($tr, 10, 'th', $col);
      if ($r == 1) {
        $th
          ->setAttribute('width', '300');
      }
      $td = $this
        ->addNode($tr, 10, 'td', '{' . $col . '}');
    }
  }
}