You are here

function spam_admin_filters in Spam 5.3

Same name and namespace in other branches
  1. 6 spam.module \spam_admin_filters()
1 string reference to 'spam_admin_filters'
spam_admin_filter_overview in ./spam.module
Spam filter overview page. Allows enabling/disabling, ordering, and tuning of individual filters, on a per-content-type-group basis. This allows you to enable different filters for different content types.

File

./spam.module, line 669

Code

function spam_admin_filters() {
  $result = pager_query('SELECT fid, gid, name, status, weight, gain FROM {spam_filters} WHERE gid = %d ORDER BY weight ASC', 50, 0, NULL, 0);
  $counter = 0;
  while ($filter = db_fetch_object($result)) {
    $form['status']["status-{$counter}"] = array(
      '#type' => 'checkbox',
      '#default_value' => $filter->status,
    );
    $form['name'][$counter] = array(
      '#value' => $filter->name,
    );
    $form['gain']["gain-{$counter}"] = array(
      '#type' => 'select',
      '#options' => drupal_map_assoc(spam_range(0, 250, 10)),
      '#default_value' => $filter->gain,
    );
    $form['weight']["weight-{$counter}"] = array(
      '#type' => 'weight',
      '#default_value' => $filter->weight,
    );
    $form['fid']["fid-{$counter}"] = array(
      '#type' => 'hidden',
      '#value' => $filter->fid,
    );
    $form['gid']["gid-{$counter}"] = array(
      '#type' => 'hidden',
      '#value' => $filter->gid,
    );
    $counter++;
  }
  $form['pager'] = array(
    '#value' => theme('pager', NULL, 50, 0),
  );
  $form['counter'] = array(
    '#type' => 'hidden',
    '#value' => $counter,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update filters'),
  );
  return $form;
}