function forena_get_data_block_params in Forena Reports 7
Same name and namespace in other branches
- 6 forena.common.inc \forena_get_data_block_params()
1 call to forena_get_data_block_params()
- forena_parameter_form in ./
forena.common.inc - Form to edit parameters Extra features: In the parameters section of the report are new attributes frx:parm: @data_source = data block for the parameter to values from @data_field = specific field of the data block to recieve values from. if no field…
File
- ./
forena.common.inc, line 609 - Common functions used throughout the project but loaded in this file to keep the module file lean.
Code
function forena_get_data_block_params($data_block, $field, $label, $params = array(), $clause = '') {
$xml = forena_invoke_data_provider($data_block, $params, $clause);
$list = array();
if ($xml) {
$path = $field ? $field : '*[1]';
$label_path = $label ? $label : '*[2]';
drupal_set_message(check_markup($label));
//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;
}