You are here

function library_admin_settings_overdue in Library 6

Same name and namespace in other branches
  1. 5.2 library.admin.inc \library_admin_settings_overdue()
  2. 6.2 library.admin.inc \library_admin_settings_overdue()
  3. 7 library.admin.inc \library_admin_settings_overdue()

Menu callback: Edit Library Overdue Settings.

1 string reference to 'library_admin_settings_overdue'
library_menu in ./library.module
Implementation of hook_menu().

File

./library.admin.inc, line 147
Administrative settings for the library module

Code

function library_admin_settings_overdue() {
  $form = array();
  foreach (library_get_item_types() as $type) {
    foreach (library_actions() as $aid => $action) {
      if ($action['status_change'] == LIBRARY_ACTION_TYPE_UNAVAILABLE) {
        $clean = library_clean_action_name($action['name']);
        $input_name = 'library_period_for_' . $type . '_' . $clean;
        $form[$input_name] = array(
          '#type' => 'fieldset',
          '#title' => t($type . ' ' . $action['name'] . ' Period'),
          '#description' => t('The maximum time a patron may %action a %type . Days and hours are combined into one value. Enter a whole number greater than 0 in days or hours if you want to have duedates for this item type with this action.', array(
            '%type' => $type,
            '%action' => $action['name'],
          )),
          '#attributes' => array(
            'class' => 'check-out-period-fieldset',
          ),
        );
        $input_name_days = 'library_days_for_' . $type . '_' . $clean;
        $form[$input_name][$input_name_days] = array(
          '#type' => 'textfield',
          '#title' => t('Days'),
          '#default_value' => variable_get('' . $input_name_days, 0),
          '#size' => 3,
          '#maxlength' => 3,
        );
        $input_name_hours = 'library_hours_for_' . $type . '_' . $clean;
        $form[$input_name][$input_name_hours] = array(
          '#type' => 'textfield',
          '#title' => t('Hours'),
          '#default_value' => variable_get('' . $input_name_hours, 0),
          '#size' => 3,
          '#maxlength' => 3,
        );
      }
    }
  }
  $form['library_send_automatic_email'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send Automatic Overdue Reminder Emails'),
    '#default_value' => variable_get('library_send_automatic_email', 0),
    '#description' => t('If this option is checked and due dates are enabled, Drupal will send a reminder email to each patron with overdue items the day after an item becomes overdue.'),
    '#return_value' => 1,
  );

  // Patron e-mail settings.
  $form['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('Patron Overdue Items Notification e-mail'),
    '#description' => t('Customize email sent to library patrons with overdue items. Available variables are: !patronname, !site, and !items.'),
  );
  $form['email']['library_mail_notify_overdue_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => _library_mail_text('notify_overdue_subject'),
    '#maxlength' => 180,
  );
  $form['email']['library_mail_notify_overdue_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => _library_mail_text('notify_overdue_body'),
    '#rows' => 15,
  );
  return system_settings_form($form);
}