public function RendererBase::xmlToValues in Forena Reports 7.5
Convert XML to key value pairs. This is used in support of graping to get specific key/value pairs in an array format suitable for passing off to php libraries.
Parameters
unknown $path:
unknown $data_path:
string $label_path:
string $pairs:
Return value
multitype:multitype:number Ambigous <unknown_type, text, mixed, string, unknown>
File
- src/
Renderer/ RendererBase.php, line 863 - FrxRenderer.php Base class for Frx custom Renderer @author davidmetzler
Class
Namespace
Drupal\forena\RendererCode
public function xmlToValues($path, $data_path, $label_path = '', $pairs = FALSE) {
$do = Frx::Data();
$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->frxReport
->replace($data_path, TRUE);
if ($label_path) {
$key = strip_tags($this->frxReport
->replace($label_path, FALSE));
}
else {
$key = $i;
}
if ($pairs && $label_path) {
$values[] = array(
floatval($key),
floatval($val),
);
}
else {
$values[$key] = $val;
}
$do
->pop();
}
}
}
return $values;
}