You are here

function forena_create_trans_form_submit in Forena Reports 7.3

Same name and namespace in other branches
  1. 8 forena_ui/forena.admin.inc \forena_create_trans_form_submit()
  2. 6.2 forena.admin.inc \forena_create_trans_form_submit()
  3. 7.5 forena.admin.inc \forena_create_trans_form_submit()
  4. 7.2 forena.admin.inc \forena_create_trans_form_submit()
  5. 7.4 forena.admin.inc \forena_create_trans_form_submit()

File

./forena.admin.inc, line 809

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 = Frx::Menu()
    ->parseURL($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(
      $desc['i_link'] . '/edit/layout',
    );
  }
}