You are here

function node_expire_settings_form in Node expire 5

Same name and namespace in other branches
  1. 6 node_expire.admin.inc \node_expire_settings_form()

Configuration form for node_expire

1 string reference to 'node_expire_settings_form'
node_expire_menu in ./node_expire.module
Implementation of hook_menu().

File

./node_expire.module, line 204
Alerts administrators of possibly outdated materials and optionally unpublishes them.

Code

function node_expire_settings_form() {

  // Publishing settings section
  $form['general'] = array(
    '#title' => t('General Settings'),
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $expireperiod = drupal_map_assoc(array(
    0,
    1,
    86400,
    172800,
    259200,
    345600,
    432000,
    518400,
    604800,
    1209600,
    1814400,
    2419200,
    3024000,
    3628800,
    4233600,
    4838400,
    5443200,
    6048000,
    6652800,
    7257600,
    7862400,
    8467200,
    9072000,
    9676800,
    10281600,
    10886400,
  ), 'format_interval');
  $expireperiod[0] = t('Never');
  $expireperiod[1] = t('Instantly');
  $form['general']['unpublishtime'] = array(
    '#title' => t('Timeout for automatic unpublishing'),
    '#description' => t('The duration of time when a node is expired for it to become automatically unpublished. Notice: ' . 'Unpublished documents won\'t trigger any expiration notices.'),
    '#type' => 'select',
    '#options' => $expireperiod,
    '#default_value' => variable_get('node-expire-unpublishtime', 0),
  );

  // Only allow inheritance for book pages.
  if (module_exists('book')) {
    $form['general']['book_inherit'] = array(
      '#title' => t('Book pages - Inheritance'),
      '#description' => t('Enable inheritance/propagation of expiration times amongst child books.'),
      '#type' => 'select',
      '#options' => array(
        1 => 'Yes',
        0 => 'No',
      ),
      '#default_value' => variable_get('node-expire-book-props', 1),
    );
  }

  // Notification settings section
  $form['notify'] = array(
    '#title' => t('Notifications'),
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('node-expire-enable-email', 1) == 0,
  );
  $form['notify']['enabled'] = array(
    '#title' => t('Enable email notifications'),
    '#description' => t('Whether or not to e-mail out about expired nodes.'),
    '#type' => 'select',
    '#options' => array(
      1 => 'Yes',
      0 => 'No',
    ),
    '#default_value' => variable_get('node-expire-enable-email', 1),
  );
  $period = drupal_map_assoc(array(
    86400,
    172800,
    259200,
    345600,
    432000,
    518400,
    604800,
  ), 'format_interval');
  $form['notify']['renotify'] = array(
    '#title' => t('Re-notify user every'),
    '#description' => t('The length of time before the user is renotified of old content.'),
    '#type' => 'select',
    '#options' => $period,
    '#default_value' => variable_get('node-expire-renotify', 259200),
  );
  $form['notify']['cc'] = array(
    '#title' => t('Carbon Copy Address'),
    '#description' => t('An e-mail address to carbon copy on all notifications.'),
    '#type' => 'textfield',
    '#size' => 50,
    '#default_value' => variable_get('node-expire-cc', ''),
  );

  // E-mail content settings
  $form['emlcontent'] = array(
    '#title' => t('E-mail Content'),
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('node-expire-enable-email', 1) == 0,
  );
  $form['emlcontent']['subject'] = array(
    '#title' => t('Subject'),
    '#description' => t('The subject of the automated alerts. Available variables are: !site'),
    '#type' => 'textfield',
    '#size' => 60,
    '#maxlength' => 180,
    '#default_value' => variable_get('node-expire-subject', '!site - Article Update Needed'),
  );
  $form['emlcontent']['body'] = array(
    '#title' => t('Body'),
    '#description' => t('The body of the automated alerts. Available variables are: !username !start_section! !stop_section! ' . '!section_article !section_timesinceupdate !section_lastupdate !section_expirydate !section_unpublishdate !section_nodelink ' . '!section_editlink'),
    '#type' => 'textarea',
    '#rows' => 11,
    '#cols' => 60,
    '#default_value' => variable_get('node-expire-body', "Hello !username,\r\n\r\nThe following article(s) are in " . "need for reviewing and updating. Please update these at your earliest convenience. If no changes are necessary, " . "simply open the editor and press 'Save'.\r\n\r\n!start_section!\r\nArticle: !section_article\r\nTime since " . "update: !section_timesinceupdate\r\nEdit Link: !section_editlink\r\n\r\n!stop_section!\r\n--  !site team"),
  );
  return system_settings_form($form);
}