function forena_layout_form_submit in Forena Reports 7.3
Same name and namespace in other branches
- 6.2 forena.admin.inc \forena_layout_form_submit()
- 6 forena.admin.inc \forena_layout_form_submit()
- 7 forena.admin.inc \forena_layout_form_submit()
- 7.2 forena.admin.inc \forena_layout_form_submit()
builds a string of the xml document, submits it to forena_save_report.
1 string reference to 'forena_layout_form_submit'
- forena_layout_form in ./
forena.admin.inc - Form function for the edit report form
File
- ./
forena.admin.inc, line 553
Code
function forena_layout_form_submit($form, &$form_state) {
$nodes = array();
$rebuild_menu = FALSE;
$values = $form_state['values'];
$report_name = $values['report_name'];
$r = forena_get_report_editor($report_name);
// Title and category
$r
->setTitle($values['title']);
$r
->setCategory($values['category']);
// Form options
$options = array(
'hidden' => $values['hidden'],
);
$r
->setOptions($options);
$menu = $r
->getMenu();
if ($values['menu'] != $menu) {
$r
->setMenu($values['menu']);
$rebuild_menu = TRUE;
}
// Body
$r
->setBody($values['body']['value']);
// CSS
$r
->setStyle($values['css']);
// If there are no frx attributes in the body then replace them with the old values.
$frx_nodes = $r->simplexml
->xpath('body//*[@frx:*]');
if (!$frx_nodes) {
$r
->save_attributes_by_id($values['attributes']);
}
//determine redirection.
$report_path = forena_report_path();
$filename = $report_path . '/' . $report_name . '.frx';
if (forena_save_report($report_name, $r
->asXML(), TRUE) == 1) {
drupal_set_message(t('Your report, %s has been saved.', array(
'%s' => $report_name,
)));
}
// If we changed the menu we need to rebuild it.
if ($rebuild_menu) {
menu_rebuild();
}
}