abuse_admin_configure_reasons

Definition

abuse_admin_configure_reasons()
abuse/abuse.module, line 240

Code

<?php
function abuse_admin_configure_reasons() {
  $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('Abuse category name'),
    '#description' => t('Enter a short name for the abuse reporting category. This name will appear in a drop-down menu of abuse reporting categories when a user reports abusive content.'),
    '#size' => 35,
    '#maxlength' => 35,
  );
  $form['add_reason']['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Abuse category description'),
    '#description' => t('Enter a detailed description of the abuse category.'),
    '#rows' => 5,
    '#cols' => 50,
  );
  $form['add_reason']['email_notice'] = array(
    '#type' => 'textarea',
    '#title' => t('Abuse warning email text'),
    '#description' => t('The text entered here will automatically be included in the abuse warning email sent to the author of content reported as abuse.'),
    '#rows' => 5,
    '#cols' => 50,
  );
  $form['add_reason']['add'] = array(
    '#type' => 'submit',
    '#value' => t('add'),
  );
  //TODO: Figure out a way to make these fields editable!
  $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',
      );
      $form['reason_list']['field'. $count]['reason'] = array(
        '#type' => 'item',
        '#value' => t('Description') .': '. t($reason->description)
      );
      $form['reason_list']['field'. $count]['argumentation'] = array(
        '#type' => 'item',
        '#value' => t('Email content') .': '. t($reason->argumentation)
      );
    }
    $form['reason_list']['remove'] = array(
      '#type' => 'submit',
      '#value' => t('remove'),
    );
  }
  return $form;
}
?>