You are here

function casetracker_settings in Case Tracker 5

Same name and namespace in other branches
  1. 6 casetracker_admin.inc \casetracker_settings()
  2. 7 casetracker_admin.inc \casetracker_settings()

Configures the various Case Tracker options; system_settings_form().

1 string reference to 'casetracker_settings'
casetracker_menu in ./casetracker.module
Implementation of hook_menu().

File

./casetracker.module, line 1329
Enables the handling of projects and their cases.

Code

function casetracker_settings() {
  $form = array();
  $form['casetracker_general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['casetracker_general']['casetracker_default_assign_to'] = array(
    '#type' => 'textfield',
    '#title' => t('Default assigned user'),
    '#autocomplete_path' => 'casetracker/autocomplete',
    '#required' => TRUE,
    '#default_value' => variable_get('casetracker_default_assign_to', variable_get('anonymous', t('Anonymous'))),
    '#description' => t('User to be assigned the case if one is not explicitly defined.'),
  );
  foreach (array(
    'priority',
    'status',
    'type',
  ) as $state) {
    $options = casetracker_case_state_load($state);
    $tempKeys = array_keys($options);
    $form['casetracker_general']['casetracker_default_case_' . $state] = array(
      '#type' => 'select',
      '#options' => $options,
      '#title' => t('Default case %state', array(
        '%state' => $state,
      )),
      '#default_value' => variable_get('casetracker_default_case_' . $state, array_shift($tempKeys)),
      '#description' => t('%state to be assigned the case if one is not explicitly defined.', array(
        '%state' => ucfirst($state),
      )),
    );
  }
  $node_types = node_get_types('names');
  $project_types = $node_types;
  unset($project_types['casetracker_basic_case']);
  $form['casetracker_general']['casetracker_project_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Project node types'),
    '#options' => $project_types,
    '#default_value' => variable_get('casetracker_project_node_types', array(
      'casetracker_basic_project',
    )),
    '#description' => t('Select the node types that will be considered Case Tracker projects.'),
  );
  $case_types = $node_types;
  unset($case_types['casetracker_basic_project']);
  $form['casetracker_general']['casetracker_case_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Case node types'),
    '#options' => $case_types,
    '#default_value' => variable_get('casetracker_case_node_types', array(
      'casetracker_basic_case',
    )),
    '#description' => t('Select the node types that will be considered Case Tracker cases.'),
  );
  return system_settings_form($form);
}