You are here

function activity_settings_form in Activity 7

Same name and namespace in other branches
  1. 6.2 activity.admin.inc \activity_settings_form()

Form builder to dispaly settings for activity module

1 string reference to 'activity_settings_form'
activity_menu in ./activity.module
Implements hook_menu().

File

./activity.admin.inc, line 283
activity.admin.inc Contains administrative forms for activity.module

Code

function activity_settings_form($form, &$form_state = NULL) {
  $form['activity_expiration'] = array(
    '#type' => 'fieldset',
    '#title' => t('Activity Expiration Settings'),
    '#element_validate' => array(
      'activity_expire_validate',
    ),
  );
  $form['activity_expiration']['activity_expire'] = array(
    '#type' => 'select',
    '#title' => t('Activity log purge'),
    '#description' => t("Allows you to set a time limit for storing activity records. Select 0 to keep all activity records."),
    '#options' => drupal_map_assoc(array(
      0,
      3600,
      7200,
      14400,
      21600,
      43200,
      86400,
      604800,
      1209600,
      2419200,
      7257600,
      15724800,
      31536000,
    ), 'format_interval'),
    '#default_value' => variable_get('activity_expire', 0),
  );
  $form['activity_expiration']['activity_min_count'] = array(
    '#type' => 'select',
    '#title' => t('Minimum Activities'),
    '#description' => t('This is the minimum number activities that the user must have created before deleting any old activities.'),
    '#options' => drupal_map_assoc(range(0, 200, 10)),
    '#default_value' => variable_get('activity_min_count', 0),
  );

  // Allow realms provided by modules.
  $realms = array();
  foreach (activity_cache_get('all_realms') as $realm => $information) {
    $realms[$realm] = $information['name'];
  }

  // Set up the default value for this set of checkboxes.
  $enabled = array();
  foreach (activity_cache_get('realms') as $realm => $information) {
    $enabled[$realm] = $realm;
  }
  $form['activity_access'] = array(
    '#type' => 'fieldset',
    '#title' => t('Activity Access Control'),
    '#attributes' => array(
      'id' => 'activity-access-fieldset',
    ),
  );
  $form['activity_access']['activity_access_realms'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Realms'),
    '#description' => t('Select the realms for which Activity access records should be recorded. These realms will allow a View to filter in more then just one users Activity.'),
    '#options' => $realms,
    '#default_value' => $enabled,
  );
  $form['activity_access']['activity_access_rebuild'] = array(
    '#type' => 'submit',
    '#value' => t('Rebuild Activity Access Table'),
    '#submit' => array(
      'activity_access_batch_set',
    ),
  );

  // This tells system_settings_form to use array_filter for the checkboxes.
  $form['array_filter'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  return system_settings_form($form);
}