public function FrxReport::save_attributes_by_id in Forena Reports 7.2
Same name and namespace in other branches
- 6.2 FrxReport.inc \FrxReport::save_attributes_by_id()
- 6 FrxReport.inc \FrxReport::save_attributes_by_id()
- 7 FrxReport.inc \FrxReport::save_attributes_by_id()
- 7.3 FrxReport.inc \FrxReport::save_attributes_by_id()
- 7.4 FrxReport.inc \FrxReport::save_attributes_by_id()
Save attributes based on id match
Parameters
array $attributes:
The attributes array should be of the form array( element_id => array( key1 => value1, key2 => value2) The function restores the attributes based on the element id.
File
- ./
FrxReport.inc, line 458 - Basic report provider. Controls the rendering of the report.
Class
Code
public function save_attributes_by_id($attributes) {
$rpt_xml = $this->rpt_xml;
if ($attributes) {
foreach ($attributes as $id => $att_list) {
$id_search_path = '//*[@id="' . $id . '"]';
$fnd = $rpt_xml
->xpath($id_search_path);
if ($fnd) {
$node = $fnd[0];
// Start attribute replacement
$frx_attributes = $node
->Attributes(FRX_NS);
foreach ($att_list as $key => $value) {
if (!$frx_attributes[$key]) {
$node['frx:' . $key] = $value;
}
else {
unset($frx_attributes[$key]);
$node['frx:' . $key] = $value;
}
}
}
}
}
}