You are here

function activity_settings_form in Activity 6.2

Same name and namespace in other branches
  1. 7 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
Implementation of hook_menu().

File

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

Code

function activity_settings_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),
  );

  // get all the  modules and their realms
  $api_info = activity_get_module_info();
  $realms = array();
  foreach ($api_info as $module => $info) {
    foreach ($info->realms as $realm => $nice_name) {
      $realms[$realm] = t('@module: @name', array(
        '@module' => drupal_ucfirst($module),
        '@name' => $nice_name,
      ));
    }
  }
  $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' => activity_access_realms(),
  );
  $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);
}