You are here

function heartbeat_admin_settings in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.2 heartbeat.admin.inc \heartbeat_admin_settings()
  2. 6.3 heartbeat.admin.inc \heartbeat_admin_settings()
  3. 7 modules/heartbeat_ui/heartbeat_ui.admin.inc \heartbeat_admin_settings()

Function to maintain and administer heartbeat settings.

Return value

settingsform

3 string references to 'heartbeat_admin_settings'
friendlist_activity_form_alter in modules/friendlist_activity/friendlist_activity.module
Implementation of hook_form_alter().
heartbeat_comments_form_alter in modules/heartbeat_comments/heartbeat_comments.module
Implementation of hook_form_alter().
heartbeat_menu in ./heartbeat.module
Implementation of hook_menu().

File

./heartbeat.admin.inc, line 202
Admnistration tasks for heartbeat.

Code

function heartbeat_admin_settings() {
  $form = array();
  $templates = array();
  foreach (heartbeat_messages('all', TRUE, FALSE) as $template) {
    $templates[$template['message_id']] = $template['message_id'];
  }

  // log settings
  $form['hb_logging'] = array(
    '#type' => 'fieldset',
    '#weight' => -5,
    '#title' => t('Global heartbeat log settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['hb_logging']['heartbeat_enabled'] = array(
    '#title' => t('Display heartbeat activity streams'),
    '#description' => t('This is a quick way to deny the stream from display.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_enabled', 1),
    '#weight' => -5,
  );
  $form['hb_logging']['heartbeat_skip_admin'] = array(
    '#title' => t('Skip the admin user'),
    '#description' => t('Note that the admin user will be logged but retained from display in the query.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_skip_admin', 0),
    '#weight' => -5,
  );
  $form['hb_logging']['heartbeat_debug'] = array(
    '#title' => t('Run the heartbeat message builder in debug mode'),
    '#description' => t('This is not for production sites. It\'s a developer tool to see which messages are blocked for which reason. Note that this needs to show for all user roles!'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_debug', 0),
    '#weight' => -5,
  );
  $cron_delete_options = array(
    0 => t('Never, my queries are limited manually'),
    600 => t('Older than 10 minutes'),
    3600 => t('Older than an hour'),
    86400 => t('Older than a day'),
    604800 => t('Older than a week'),
    2678400 => t('Older than a month'),
    5270400 => t('Older than two months'),
    7948800 => t('Older than three months'),
  );
  $form['hb_logging']['heartbeat_activity_log_cron_delete'] = array(
    '#title' => 'Delete messages older than ... (by cron)',
    '#type' => 'select',
    '#options' => $cron_delete_options,
    '#default_value' => variable_get('heartbeat_activity_log_cron_delete', 2678400),
  );
  $form['hb_logging']['heartbeat_activity_records_per_user'] = array(
    '#title' => t('Keep activity for each user'),
    '#description' => t('Keep activity for each user. While cron removes the activity older than T, we make sure that there is still some activity left per user so the personal heartbeat is not empty.'),
    '#type' => 'select',
    '#options' => array(
      '10' => t('@recs records', array(
        '@recs' => 10,
      )),
      '20' => t('@recs records', array(
        '@recs' => 20,
      )),
      '30' => t('@recs records', array(
        '@recs' => 30,
      )),
      '50' => t('@recs records', array(
        '@recs' => 50,
      )),
      '100' => t('@recs records', array(
        '@recs' => 100,
      )),
    ),
    '#default_value' => variable_get('heartbeat_activity_records_per_user', 10),
  );
  $form['hb_logging']['heartbeat_activity_templates_unlimited'] = array(
    '#title' => t('Select the templates where activity can never be deleted'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => $templates,
    '#default_value' => variable_get('heartbeat_activity_templates_unlimited', array()),
  );

  // display settings
  $form['hb_fields'] = array(
    '#type' => 'fieldset',
    '#weight' => -4,
    '#title' => t('Global heartbeat display settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['hb_fields']['heartbeat_allowed_tags'] = array(
    '#title' => t('Filter the messages with for these tags only'),
    '#type' => 'textfield',
    '#default_value' => heartbeat_allowed_tags(FALSE),
  );
  $form['hb_fields']['heartbeat_show_message_times'] = array(
    '#title' => t('Show the time of action in message displays'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_show_message_times', 1),
    '#description' => t('Disabling the display overrules all other settings.'),
  );
  $form['hb_fields']['heartbeat_show_time_grouped_items'] = array(
    '#title' => t('Show the time of action with messages are grouped together'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_show_time_grouped_items', 1),
  );
  $form['hb_fields']['heartbeat_activity_stream_delete'] = array(
    '#title' => t('Show edit/delete buttons in the stream (role based)'),
    '#description' => t('Allow users with permission "delete heartbeat activity logs" to edit and delete activity stream.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_activity_stream_delete', 1),
  );
  $form['hb_fields']['heartbeat_activity_stream_actor_delete'] = array(
    '#title' => t('Show delete buttons in the stream for actors'),
    '#description' => t('Allow actors to delete their own message activity stream.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_activity_stream_actor_delete', 1),
  );
  $form['hb_fields']['heartbeat_activity_display_tags'] = array(
    '#title' => t('Show heartbeat tags under the messages'),
    '#description' => t('Tags are shown per activity message.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_activity_display_tags', 0),
  );
  $value = variable_get('heartbeat_activity_grouping_seconds', 7200);
  $form['hb_fields']['heartbeat_activity_grouping_seconds'] = array(
    '#title' => t('Maximum gap (in seconds)'),
    '#type' => 'textfield',
    '#size' => 40,
    '#default_value' => $value,
    '#description' => t('Currently set @value.', array(
      '@value' => _heartbeat_activity_get_time($value),
    )) . '<br />' . t('Maximum gap for the same activity to be grouped together and before an identical activity can be logged again'),
    '#prefix' => '<div id="heartbeat-tabs-2">',
    '#suffix' => '</div>',
    '#ahah' => array(
      'path' => 'heartbeat/ahah/heartbeat_activity_grouping_seconds',
      'wrapper' => 'heartbeat-tabs-2',
      'event' => 'change',
      'method' => 'replace',
      'effect' => 'fade',
    ),
  );
  $form['hb_fields']['heartbeat_activity_grouping_how_many'] = array(
    '#title' => 'Maximum number of messages to group',
    '#type' => 'textfield',
    '#size' => 20,
    '#default_value' => variable_get('heartbeat_activity_grouping_how_many', 5),
    '#description' => 'Maximum number of items that can be grouped. This can be overruled for each heartbeat message specific.',
  );
  $form['hb_fields']['heartbeat_context_perm'] = array(
    '#title' => t('Allow messages where the node or user being used lead to access denied page'),
    '#description' => t(' heartbeat does not know about links being used in the messages. For
    this reason you can choose whether to show the links anyway. Note that when you don\'t even
     use links for nodes and/or users, you should enable this.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('heartbeat_context_perm', 0),
  );

  // profile settings
  $form['hb_profile'] = array(
    '#type' => 'fieldset',
    '#weight' => -3,
    '#title' => t('User profile settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['hb_profile']['heartbeat_profile_message_templates'] = array(
    '#title' => t('Select the templates to show on the profile page'),
    '#description' => t('The enduser can have the possibility to set the restriction level of message types. Here the administrator can select and expose those message templates you want to display on the profile page.'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => $templates,
    '#default_value' => variable_get('heartbeat_profile_message_templates', array()),
  );
  $form = system_settings_form($form);
  return $form;
}