You are here

function forena_settings_submit in Forena Reports 7.3

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

Added submit handler to create directories and clear menu cache

_state

Parameters

unknown_type $form:

1 string reference to 'forena_settings_submit'
forena_settings in ./forena.admin.inc
Forena admin settings form

File

./forena.admin.inc, line 218

Code

function forena_settings_submit($form, &$form_state) {
  $values = $form_state['values'];
  $path = $values['forena_report_repos'];
  $src_dir = drupal_get_path('module', 'forena') . '/repos/reports';
  if ($path != $values['forena_last_report_path']) {
    if (!file_exists($path)) {
      try {
        if (file_exists($path)) {
          drupal_set_message(t('Created directory %s', array(
            $path,
          )));
        }
        mkdir($path);
      } catch (Exception $e) {
        forena_error(t('Unable to create report directory'), $e
          ->getMessage());
        return;
      }
    }
  }
  forena_sync_reports();
}