function FrxReportGenerator::data_block_params in Forena Reports 6.2
Same name and namespace in other branches
- 7.2 FrxReportGenerator.inc \FrxReportGenerator::data_block_params()
File
- ./
FrxReportGenerator.inc, line 823 - Common functions used throughout the project but loaded in this file to keep the module file lean.
Class
Code
function data_block_params($data_block, $field, $label, $params = array(), $clause = '') {
FrxData::instance()
->push($params);
$xml = $this
->invoke_data_provider($data_block, $params, $clause);
FrxData::instance()
->pop();
$list = array();
if ($xml) {
$path = $field ? $field : '*[1]';
$label_path = $label ? $label : '*[2]';
//walk through the $xml.
$rows = $xml
->xpath('*');
if ($rows) {
foreach ($rows as $row) {
$value = $row
->xpath($path);
$label_field = $row
->xpath($label_path);
$label_value = $label_field ? (string) $label_field[0] : (string) $value[0];
$list[(string) $value[0]] = (string) $label_value;
}
}
}
return $list;
}