You are here

public function FrxTable::scrapeConfig in Forena Reports 7.4

Extract table configuration from the HTML

Overrides FrxRenderer::scrapeConfig

See also

FrxRenderer::scrapeConfig()

File

renderers/FrxTable.inc, line 13
FrxTable Template that lays out a report in a particular table format.

Class

FrxTable
@file FrxTable Template that lays out a report in a particular table format.

Code

public function scrapeConfig() {
  $config = array();
  $caption = $this
    ->extractXPath('*//caption', $this->reportDocDomNode);
  $this
    ->extractTemplateHTML($this->reportDocDomNode, $config, array(
    'table',
  ));
  $tds = $this
    ->extractXPathInnerHTML('*//td', $this->reportDocDomNode, FALSE);
  $ths = $this
    ->extractXPathInnerHTML('*//th', $this->reportDocDomNode, FALSE);
  $columns = array_combine($ths, $tds);
  $weight = 0;
  foreach ($columns as $label => $token) {
    $key = trim($token, '{}');
    $weight++;
    $config['columns'][$key] = array(
      'contents' => $token,
      'label' => $label,
      'include' => 1,
      'weight' => $weight,
    );
  }
  return $config;
}