Definition

abuse_report_form($object, $user)
abuse/abuse.module, line 512

Description

A generated form to display to users for flagging an object

Code

<?php
function abuse_report_form($object, $user) {
  $form = array();
  $form['object_type'] = array(
    '#type' => 'value',
    '#value' => $object->type
  );
  $form['object_oid'] = array(
    '#type' => 'value',
    '#value' => $object->oid
  );
  $form['intro'] = array(
    '#type' => 'item',
    '#value' => variable_get('abuse_form_pre',''),
  );
  if ($user->uid) {
    $form['user'] = array(
      '#type' => 'item',
      '#title' => t('from'),
      '#value' => $user->name
    );
    $form['name'] = array(
      '#type' => 'value',
      '#value' => $user->name
    );
    $form['mail'] = array(
      '#type' => 'value',
      '#value' => $user->mail
    );
  } 
  else {
    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => t('from'),
      '#size' => 30,
      '#maxlength' => 30,
      '#required' => TRUE
    );
    $form['mail'] = array(
      '#type' => 'textfield',
      '#title' => t('email'),
      '#size' => 30,
      '#maxlength' => 30,
      '#required' => TRUE
    );
  }
  $form['about'] = array(
    '#type' => 'item',
    '#title' => t('about'),
    '#value' => $object->title
  );
  $reason_objects = _abuse_reasons();
  $reasons = array(0 => '');
  foreach ($reason_objects as $reason) {
    $reasons[$reason->arid] = t($reason->reason);
  }
  $form['reason'] = array(
    '#type' => 'select',
    '#title' => t('reason'),
    '#options' => $reasons,
    '#required' => TRUE
  );
  $form['body'] = array(
    '#type' => 'textarea',
    '#title' => t('message'),
    '#cols' => 30,
    '#rows' => 10
  );
  $form['op']['send'] = array(
    '#type' => 'submit',
    '#value' => t('send')
  );
  $form['op']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('cancel')
  );
  return $form;
}
?>