You are here

public function FrxTemplate::columns in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 templates/FrxTemplate.inc \FrxTemplate::columns()
  2. 7.3 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 37

Class

FrxTemplate

Code

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

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