You are here

function activity_admin_settings in Activity 5.4

Same name and namespace in other branches
  1. 5 activity.module \activity_admin_settings()
  2. 5.2 activity.module \activity_admin_settings()
  3. 5.3 activity.module \activity_admin_settings()
  4. 6 activity.module \activity_admin_settings()

Activity admin main settings page.

1 string reference to 'activity_admin_settings'
activity_menu in ./activity.module
Implementation of hook_menu().

File

./activity.module, line 117
activity.module

Code

function activity_admin_settings() {
  $form['general_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
    '#collapsible' => FALSE,
  );
  $form['general_settings']['activity_page_pager'] = array(
    '#type' => 'select',
    '#title' => t('Activity Page Results per Page'),
    '#description' => t('Select the number of activity records to show on activity pages such as <a href="@activity">this one</a>.', array(
      '@activity' => url('activity'),
    )),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      20,
      25,
      30,
      50,
    )),
    '#default_value' => variable_get('activity_page_pager', 20),
  );
  $form['general_settings']['activity_user_profile_records'] = array(
    '#type' => 'select',
    '#title' => t('Activity Results per User Profile'),
    '#description' => t('Select the number of activity records to show on a user\'s profile page. Selecting 0 will disable activity from showing on user profile pages.'),
    '#options' => drupal_map_assoc(array(
      0,
      5,
      10,
      20,
      25,
      30,
      50,
    )),
    '#default_value' => variable_get('activity_user_profile_records', 5),
  );
  $form['general_settings']['activity_time_limit'] = array(
    '#type' => 'select',
    '#title' => t('Activity time limiter'),
    '#description' => t("Allows you to set a time limit for recording activity so repeated actions don't flood your activity feed. If the same action is submitted within X seconds of the last activity record of the same type from the same user then the activity is not logged."),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      20,
      30,
      60,
      120,
      300,
      600,
      1800,
    ), format_interval),
    '#default_value' => variable_get('activity_time_limit', 30),
  );
  $form['general_settings']['activity_purge'] = 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_purge', 0),
  );
  $form['general_settings']['activity_user_optout'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow user privacy opt-out'),
    '#description' => t('If you wish to allows users to opt-out of Activity then check the box above. If a user opts-out then activity that the user originates will not be recorded.'),
    '#default_value' => variable_get('activity_user_optout', 0),
  );
  if ($activity_info = activity_get_info()) {
    $form['module_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('Activity contrib modules'),
      '#description' => t('Click on the links below to configure the activity settings for the activity contrib modules you have installed.'),
      '#collapsible' => FALSE,
    );
    foreach ($activity_info as $module => $info) {
      if (!empty($info)) {
        $module_nice_name = drupal_ucfirst(str_replace('_', ' ', substr($module, 0, -8)));
        $form['module_settings'][$module] = array(
          '#type' => 'markup',
          '#value' => '<p>' . l($module_nice_name . ' activity settings page', 'admin/settings/activity/' . $module, array(
            'title' => 'Configure ' . $module_nice_name,
          )) . '</p>',
        );
      }
    }
  }
  else {
    drupal_set_message(t('No supported modules enabled. Check the !activity_section for supported modules.', array(
      '!activity_section' => l(t('Activity section'), 'admin/build/modules'),
    )));
  }
  return system_settings_form($form);
}