You are here

counter.settings.inc in Counter 6.2

Same filename and directory in other branches
  1. 7 counter.settings.inc

Settings page callback file for the counter module.

File

counter.settings.inc
View source
<?php

/**
 * @file
 * Settings page callback file for the counter module.
 */

/**
 * Menu callback;
 */
function counter_admin_settings() {
  $form = array();

  // only administrators can access this function
  // Generate the form - settings applying to all patterns first
  $form['counter_settings'] = array(
    '#type' => 'fieldset',
    '#weight' => -30,
    '#title' => t('Basic settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['counter_settings']['counter_save_details'] = array(
    '#type' => 'checkbox',
    '#title' => t('Save details'),
    '#default_value' => variable_get('counter_save_details', 0),
    '#description' => t('Enable this option to save visitor details, including: IP, Data dan Page. Caution: This will your counter table size very big if your website has huge traffic.'),
  );
  $form['counter_settings']['counter_show_site_counter'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Site Counter'),
    '#default_value' => variable_get('counter_show_site_counter', 1),
  );
  $form['counter_settings']['counter_show_unique_visitor'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Unique Visitors'),
    '#default_value' => variable_get('counter_show_unique_visitor', 1),
    '#description' => t('Show Unique Visitors based on their IP'),
  );
  $form['counter_settings']['counter_registered_user'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Registered Users'),
    '#default_value' => variable_get('counter_registered_user', 1),
  );
  $form['counter_settings']['counter_unregistered_user'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Unregistered Users'),
    '#default_value' => variable_get('counter_unregistered_user', 1),
  );
  $form['counter_settings']['counter_blocked_user'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Blocked Users'),
    '#default_value' => variable_get('counter_blocked_user', 1),
  );
  $form['counter_settings']['counter_published_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Published Nodes'),
    '#default_value' => variable_get('counter_published_node', 1),
  );
  $form['counter_settings']['counter_unpublished_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Unpublished Nodes'),
    '#default_value' => variable_get('counter_unpublished_node', 1),
  );
  $form['counter_settings']['counter_show_server_ip'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Web Server IP'),
    '#default_value' => variable_get('counter_show_server_ip', 1),
  );
  $form['counter_settings']['counter_show_ip'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Client IP'),
    '#default_value' => variable_get('counter_show_ip', 1),
  );
  $form['counter_settings']['counter_show_counter_since'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Site Counter Since'),
    '#default_value' => variable_get('counter_show_counter_since', 1),
    '#description' => t('Show the first entry date in the Site Counter'),
  );
  $form['counter_statistic'] = array(
    '#type' => 'fieldset',
    '#weight' => -20,
    '#title' => t('Statistic settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['counter_statistic']['counter_statistic_today'] = array(
    '#type' => 'checkbox',
    '#title' => t('Visitors Today'),
    '#default_value' => variable_get('counter_statistic_today', 1),
  );
  $form['counter_statistic']['counter_statistic_week'] = array(
    '#type' => 'checkbox',
    '#title' => t('Visitors This Week'),
    '#default_value' => variable_get('counter_statistic_week', 1),
  );
  $form['counter_statistic']['counter_statistic_month'] = array(
    '#type' => 'checkbox',
    '#title' => t('Visitors This Month'),
    '#default_value' => variable_get('counter_statistic_month', 1),
  );
  $form['counter_statistic']['counter_statistic_year'] = array(
    '#type' => 'checkbox',
    '#title' => t('Visitors This Year'),
    '#default_value' => variable_get('counter_statistic_year', 1),
  );
  return system_settings_form($form);
}
function counter_settings_advanced() {
  $form['counter_advanced'] = array(
    '#type' => 'fieldset',
    '#weight' => -20,
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['counter_advanced']['counter_skip_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip admin'),
    '#default_value' => variable_get('counter_skip_admin', 0),
    '#description' => t("Do not count when visitor is admin (uid=1)."),
  );
  $form['counter_advanced']['counter_refresh_delay'] = array(
    '#type' => 'textfield',
    '#title' => t('Delay before refresh counter data (in second)'),
    '#default_value' => variable_get('counter_refresh_delay', 10),
    '#description' => t("Delay before re-calculate counter data, otherwise read from previous value."),
  );
  return system_settings_form($form);
}
function counter_settings_initial() {
  $form['counter_initial'] = array(
    '#type' => 'fieldset',
    '#weight' => -10,
    '#title' => t('Initial Values'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t("Set initial values for Site Counter."),
  );
  $form['counter_initial']['counter_initial_counter'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial value of Site Counter'),
    '#default_value' => variable_get('counter_initial_counter', 0),
    '#description' => t('Initial value of Site Counter'),
  );
  $form['counter_initial']['counter_initial_unique_visitor'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial value of Unique Visitor'),
    '#default_value' => variable_get('counter_initial_unique_visitor', 0),
    '#description' => t('Initial value of Unique Visitor'),
  );
  $form['counter_initial']['counter_initial_since'] = array(
    '#type' => 'textfield',
    '#title' => t("Initial value of Since"),
    '#default_value' => variable_get('counter_initial_since', date('Y-m-d H:i:s', time())),
  );
  return system_settings_form($form);
}