abuse_admin_reason_settings

Definition

abuse_admin_reason_settings(&$form_state)
abuse/abuse.admin.inc, line 126

Code

<?php
function abuse_admin_reason_settings(&$form_state) {
  $form = array();
  $form['add_reason'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add new reason'),
    '#weight' => -1,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['add_reason']['short_form'] = array(
    '#type' => 'textfield',
    '#title' => t('Reason'),
    '#description' => t('Provide a short form of what the reason is'),
    '#size' => 35,
    '#maxlength' => 35,
  );
  $form['add_reason']['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t('A more details description of what the reason is'),
    '#rows' => 5,
    '#cols' => 50,
  );
  $form['add_reason']['email_notice'] = array(
    '#type' => 'textarea',
    '#title' => t('Email Notice addition'),
    '#description' => t('Text that will automatically be included in the warning email.'),
    '#rows' => 5,
    '#cols' => 50,
  );
  $form['add_reason']['add'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $num_reasons = db_result(db_query('SELECT COUNT(arid) FROM {abuse_reasons}'));
  if ($num_reasons > 0) {
    $form['reason_list'] = array(
      '#type' => 'fieldset',
      '#title' => t('Current list of reasons - check items that you wish to remove'),
      '#weight' => 5,
      '#collapsible' => FALSE,
    );
    $reasons = _abuse_reasons();
    $count = 0;
    foreach ($reasons as $reason) {
      $count++;
      $form['reason_list']['field'. $count] = array(
        '#type' => 'fieldset',
        '#title' => t($reason->reason),
      );
      $form['reason_list']['field'. $count]['arid'. $reason->arid] = array(
        '#type' => 'checkbox',
        '#title' => t('Remove from of list of reasons')
      );
      $form['reason_list']["field$count"]['edit'] = array(
        '#type' => 'item',
        '#value' => l('Edit reason', "admin/settings/abuse/reasons/edit/$reason->arid"),
      );
      $form['reason_list']['field'. $count]['reason'] = array(
        '#type' => 'item',
        '#value' => t('Description') .': '. $reason->description,
      );
      $form['reason_list']['field'. $count]['argumentation'] = array(
        '#type' => 'item',
        '#value' => t('Email content') .': '. check_markup($reason->argumentation),
      );
    }
    $form['reason_list']['remove'] = array(
      '#type' => 'submit',
      '#value' => t('Remove'),
    );
  }
  return $form;
}
?>