function forena_create_trans_form_submit in Forena Reports 7.2
Same name and namespace in other branches
- 8 forena_ui/forena.admin.inc \forena_create_trans_form_submit()
- 6.2 forena.admin.inc \forena_create_trans_form_submit()
- 7.5 forena.admin.inc \forena_create_trans_form_submit()
- 7.3 forena.admin.inc \forena_create_trans_form_submit()
- 7.4 forena.admin.inc \forena_create_trans_form_submit()
File
- ./
forena.admin.inc, line 994
Code
function forena_create_trans_form_submit($form, &$form_state) {
$values = $form_state['values'];
$base_name = $values['base_name'];
$new_name = $values['save_report_language'] . '.' . $base_name;
$desc = forena_report_desc($new_name);
$filename = $desc['filename'];
$report_name = $desc['name'];
$r = forena_get_report_editor($values['report_name']);
// Title and category
$r
->setTitle($values['title']);
//determine redirection.
if (file_exists($filename)) {
drupal_set_message(t('Report %s already exists', array(
'%s' => $new_name,
)), 'error');
return;
}
if (forena_save_report($report_name, $r
->asXML(), TRUE) == 1) {
drupal_set_message(t('Translation, %s has been created. Switch languages to translate ', array(
'%s' => $values['title'],
)));
//if this is a new report then redirect to data blocks
$form_state['redirect'] = array(
'reports/' . $values['save_report_language'] . '.' . str_replace('/', '.', $base_name) . '/edit/layout',
);
}
}