You are here

function forena_settings in Forena Reports 7.4

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

Forena admin settings form

1 string reference to 'forena_settings'
forena_menu in ./forena.module
Implementation of hook_menu.

File

./forena.admin.inc, line 134

Code

function forena_settings($form, &$form_state) {
  $skins = Frx::File()
    ->skins();
  $report_path = forena_report_path();
  $form['forena_report_repos'] = array(
    '#type' => 'textfield',
    '#title' => t('Report Repository'),
    '#description' => t('Indicate the directory that you want to use for storing your report sources (frx files). In order for you ' . 'to be able to save report sources, this directory should be writable by the web user. Relative ' . 'paths should be entered relative to the base path of your drupal installation.'),
    '#default_value' => $report_path,
  );
  $form['forena_last_report_path'] = array(
    '#type' => 'value',
    '#value' => variable_get('forena_report_repos', ''),
  );
  if (module_exists('forena_query')) {
    $form['forena_query_data_path'] = array(
      '#type' => 'textfield',
      '#title' => t('Custom Data Block Repository'),
      '#description' => t('Indicate the directory that you want to use to save custom created data blocks (SQLs or
            XMLs) using the forena query builder tool. These will override any module delivered data blocks. This
            needs to be a directory that is writable by the web user but should not be browsable by the web.  If you leave this blank
            Forena will use a data path in your <a href="@file_config">private file system</a>', array(
        '@file_config' => url('admin/config/media/file-system'),
      )),
      '#default_value' => variable_get('fornea_query_data_path', ''),
    );
    $form['forena_last_query_data_path'] = array(
      '#type' => 'value',
      '#value' => variable_get('forena_query_data_path', ''),
    );
  }
  $input_format = variable_get('forena_input_format', 'none');
  $input_format_enabled = isset($form_state['values']['forena_input_format_enabled']) ? $form_state['values']['forena_input_format_enabled'] : $input_format != 'none';
  $form['format'] = array(
    '#prefix' => '<div id="forena-format">',
    '#suffix' => '</div>',
  );
  $form['format']['forena_input_format_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Text Format filtering system'),
    '#description' => t('Checking this allows use of Drupal\' custom markup and automatic URL replacement in reports with a slight performance penalty.'),
    '#default_value' => $input_format_enabled,
    '#ajax' => array(
      'callback' => 'forena_settings_format_callback',
      'wrapper' => 'forena-format',
    ),
  );
  $form['format']['forena_input_format'] = forena_filter_element(variable_get('forena_input_format', filter_default_format()), 'forena_input_format');
  $form['format']['forena_input_format']['#access'] = $input_format_enabled;
  $form['format']['forena_input_format']['#collapsible'] = FALSE;
  $form['forena_default_form'] = array(
    '#type' => 'select',
    '#title' => t('Default report skin'),
    '#options' => $skins,
    '#description' => t('Specify the default skin to be used.   New skins can be created by creating .skinfo files in your reports directory.' . ' Skins are basically css and javascript libraries added to your report.'),
    '#default_value' => variable_get('forena_default_form', ''),
  );
  $form = system_settings_form($form);
  return $form;
}