You are here

function casetracker_case_state_edit in Case Tracker 6

Same name and namespace in other branches
  1. 5 casetracker.module \casetracker_case_state_edit()
  2. 7 casetracker_admin.inc \casetracker_case_state_edit()

Displays a form for adding or editing a case state.

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

File

./casetracker_admin.inc, line 127

Code

function casetracker_case_state_edit($form_state, $case_state = NULL) {
  $form = array();
  $form['case_state'] = array(
    '#type' => 'fieldset',
    '#title' => t('Case state'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['case_state']['name'] = array(
    '#type' => 'textfield',
    '#title' => t('State name'),
    '#required' => TRUE,
    '#default_value' => isset($case_state) ? $case_state->name : NULL,
    '#description' => t('The name for this case state. Example: "Resolved".'),
  );
  $form['case_state']['realm'] = array(
    '#type' => 'select',
    '#title' => t('State realm'),
    '#required' => TRUE,
    '#default_value' => isset($case_state) ? $case_state->realm : NULL,
    '#description' => t('The realm in which this case state will appear.'),
    '#options' => array(
      'priority' => t('priority'),
      'status' => t('status'),
      'type' => t('type'),
    ),
  );
  $form['case_state']['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => isset($case_state) ? $case_state->weight : 0,
    '#description' => t('States are ordered first by weight and then by state name.'),
  );
  if ($case_state) {
    $form['csid'] = array(
      '#type' => 'value',
      '#value' => $case_state->csid,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}