You are here

function statspro_settings_form in Statistics Pro 6.2

Same name and namespace in other branches
  1. 6 statspro.module \statspro_settings_form()

Form generating function for report settings.

3 calls to statspro_settings_form()
statspro_main_admin_settings_form in ./statspro_admin_settings.inc
Main admin settings form.
statspro_overview_settings_form in ./statspro_overview.inc
statspro_path_aggregated_report_form in ./statspro_path_aggregated.inc
statspro_path_aggregated_report_form() definition.

File

./statspro_settings.inc, line 45

Code

function statspro_settings_form($default_period, $default_custom_days) {
  $form = array();
  $form['statspro_period'] = array(
    '#type' => 'select',
    '#title' => t('Time period'),
    '#default_value' => $default_period,
    '#options' => statspro_get_period_items(),
    '#required' => TRUE,
  );
  $form['statspro_custom_number_days'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom number of days'),
    '#default_value' => $default_custom_days,
    '#size' => 4,
    '#maxlength' => 4,
    '#description' => t('Number of past days from today to include.'),
  );
  $form['#validate'] = array(
    'statspro_settings_form_validate',
  );
  $form['buttons']['#weight'] = 50;
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  if (!empty($_POST) && form_get_errors()) {
    drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
  }
  $form['#theme'] = 'system_settings_form';
  drupal_add_js(drupal_get_path('module', 'statspro') . '/statspro_common_settings.js');
  return $form;
}