You are here

public function FrxChart::xmlToValues in Forena Reports 6.2

Same name and namespace in other branches
  1. 7.2 plugins/FrxChart.inc \FrxChart::xmlToValues()
  2. 7.3 renderers/FrxChart.inc \FrxChart::xmlToValues()
1 call to FrxChart::xmlToValues()
FrxChart::render in plugins/FrxChart.inc

File

plugins/FrxChart.inc, line 59

Class

FrxChart

Code

public function xmlToValues($path, $data_path, $label_path = '') {
  $do = FrxData::instance();
  $data = $do
    ->currentContext();
  $values = array();
  if (is_object($data)) {
    $nodes = $data
      ->xpath($path);
    if ($nodes) {
      foreach ($nodes as $i => $node) {
        $do
          ->push($node, $this->id);
        $val = $this->teng
          ->replace($data_path, TRUE);
        if ($label_path) {
          $key = $this->teng
            ->replace($label_path, TRUE);
        }
        else {
          $key = $i;
        }
        $values[$key] = $val;
        $do
          ->pop();
      }
    }
  }
  return $values;
}