You are here

function _auto_expire_admin_settings in Auto Expire 7

Same name and namespace in other branches
  1. 5 auto_expire.module \_auto_expire_admin_settings()

Admin Settings.

1 string reference to '_auto_expire_admin_settings'
auto_expire_menu in ./auto_expire.module
Implements hook_menu().

File

./auto_expire.module, line 244

Code

function _auto_expire_admin_settings() {
  $form = array();
  foreach (node_type_get_types() as $type => $name) {
    $code = AUTO_EXPIRE_NODE_TYPE . $type;
    $form['nodetypes'][$type] = array(
      '#type' => 'fieldset',
      '#title' => $name->name,
      '#collapsible' => TRUE,
      '#collapsed' => !variable_get($code . '_e', 0),
    );
    $form['nodetypes'][$type][$code . '_e'] = array(
      '#type' => 'checkbox',
      '#title' => t('Expire'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_e', 0),
    );
    $form['nodetypes'][$type][$code . '_d'] = array(
      '#type' => 'textfield',
      '#title' => t('Days'),
      '#field_suffix' => t('days'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_d', AUTO_EXPIRE_DAYS),
      '#description' => t('Number of days after an item was created when it will be automatically expired.'),
    );
    $form['nodetypes'][$type][$code . '_w'] = array(
      '#type' => 'textfield',
      '#title' => t('Warn'),
      '#field_suffix' => t('days'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_w', AUTO_EXPIRE_WARN),
      '#description' => t('Number of days before the items expiration when a warning message is sent to the user. Set to 0 (zero) for no warnings.'),
    );
    $form['nodetypes'][$type][$code . '_p'] = array(
      '#type' => 'textfield',
      '#title' => t('Purge'),
      '#field_suffix' => t('days'),
      '#return_value' => 1,
      '#default_value' => variable_get($code . '_p', AUTO_EXPIRE_PURGE),
      '#description' => t('Number of days after an item has expired when it will be purged from the database. Set to 0 (zero) for no purge.'),
    );
  }
  $form['email']['warn'] = array(
    '#type' => 'fieldset',
    '#title' => t('Expiration Warning Notification Email'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t("Template of email sent when content is about to expire. You can use the following variables: !type - content type, @title - title of content, !url - URL of content, !days - number of days before items expire, !date - the expiration date of the item, !daysleft - time left until the expiration date, !site - site name, !siteurl - site URL"),
  );
  $form['email']['warn'][AUTO_EXPIRE_EMAIL . 'warn_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Email Subject'),
    '#description' => t('Leave empty to disable Expiration Warning Notifications.'),
    '#return_value' => 1,
    '#default_value' => variable_get(AUTO_EXPIRE_EMAIL . 'warn_subject', t('!type about to expire')),
  );
  $form['email']['warn'][AUTO_EXPIRE_EMAIL . 'warn_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Email Body'),
    '#return_value' => 1,
    '#default_value' => variable_get(AUTO_EXPIRE_EMAIL . 'warn_body', t("Your !type listing '@title' will expire in !daysleft.\n\nPlease visit !site if you want to renew:\n!url")),
  );
  $form['email']['expired'] = array(
    '#type' => 'fieldset',
    '#title' => t('Expired Notification Email'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t("Template of email sent right after the content has expired. You can use the following variables: !type - content type, @title - title of content, !url - URL of content, !days - number of days before items expire, !date - the expiration date of the item, !site - site name, !siteurl - site URL"),
  );
  $form['email']['expired'][AUTO_EXPIRE_EMAIL . 'expired_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Email Subject'),
    '#description' => t('Leave empty to disable Expired Notifications.'),
    '#return_value' => 1,
    '#default_value' => variable_get(AUTO_EXPIRE_EMAIL . 'expired_subject', t('!type has expired')),
  );
  $form['email']['expired'][AUTO_EXPIRE_EMAIL . 'expired_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Email Body'),
    '#return_value' => 1,
    '#default_value' => variable_get(AUTO_EXPIRE_EMAIL . 'expired_body', t("Your !type listing '@title' has expired.\n\nPlease visit !site to add new content:\n!siteurl")),
  );
  $form['email']['cc'][AUTO_EXPIRE_EMAIL . 'bcc'] = array(
    '#type' => 'textfield',
    '#title' => t('BCC Address'),
    '#description' => t('An e-mail address to blind carbon copy notifications.'),
    '#return_value' => 1,
    '#default_value' => variable_get(AUTO_EXPIRE_EMAIL . 'bcc', ''),
  );
  return system_settings_form($form);
}