You are here

public function FrxTemplate::columns in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 templates/FrxTemplate.inc \FrxTemplate::columns()
  2. 7.2 templates/FrxTemplate.inc \FrxTemplate::columns()
4 calls to FrxTemplate::columns()
FrxFieldTable::generate in templates/FrxFieldTable.inc
Enter description here ...
FrxGraphTemplate::generate in templates/FrxGraphTemplate.inc
Enter description here ...
FrxTable::generate in templates/FrxTable.inc
Enter description here ...
FrxTemplate::generate in templates/FrxTemplate.inc
Enter description here ...

File

templates/FrxTemplate.inc, line 36
FrxTemplate Base Class for all tmeplates. By default simply renders a document with all the possible tokens in it. @author davidmetzler

Class

FrxTemplate
@file FrxTemplate Base Class for all tmeplates. By default simply renders a document with all the possible tokens in it. @author davidmetzler

Code

public function columns($xml, $path = '/*/*') {

  //create an array of columns
  if (!is_object($xml)) {
    return array();
  }
  $rows = $xml
    ->xpath($path);
  $column_array = array();
  $this->columns = array();
  foreach ($rows as $columns) {
    foreach ($columns as $name => $value) {
      $column_array[$name] = $name;
      $this->columns[] = $name;
    }
    if (is_object($xml) && method_exists($xml, 'attributes')) {
      foreach ($xml
        ->attributes() as $name => $value) {
        $column_array['@' . $name] = '@' . $name;
      }
    }
  }
  return $column_array;
}