You are here

function theme_antispam_moderation_form in AntiSpam 6

Same name and namespace in other branches
  1. 7 antispam.admin.inc \theme_antispam_moderation_form()

Theme callback; render the moderation queue form.

File

./antispam.admin.inc, line 789

Code

function theme_antispam_moderation_form($form) {
  $mode = $form['mode']['#value'];
  $submode = $form['submode']['#value'];
  $output = drupal_render($form['options']);
  $rows = array();
  if (isset($form['author']) && is_array($form['author'])) {
    foreach (element_children($form['author']) as $key) {
      $row = array();
      $row[] = drupal_render($form['items'][$key]);
      $row[] = drupal_render($form['title'][$key]);
      if ($mode == 'nodes') {
        $row[] = drupal_render($form['type'][$key]);
      }
      $row[] = drupal_render($form['author'][$key]);
      $row[] = drupal_render($form['status'][$key]);
      if (antispam_get_service_provider() == DEFENSIO_SERVICE) {
        $row[] = drupal_render($form['spaminess'][$key]);
      }
      $row[] = drupal_render($form['created'][$key]);
      $rows[] = $row;
    }
  }
  else {
    if ($submode == 'spam') {
      $message = ($mode == 'nodes' ? t('There is no spam in the nodes moderation queue.') : t('There is no spam in the comments moderation queue.')) . '<br />' . t('It must be your lucky day! ;-)');
    }
    else {
      if ($submode == 'unpublished') {
        $message = $mode == 'nodes' ? t('There are no unpublished nodes in the moderation queue.') : t('There are no unpublished comments in the moderation queue.');
      }
      else {

        // published
        $message = $mode == 'nodes' ? t('There are no published nodes.') : t('There are no published comments.');
      }
    }
    if (antispam_get_service_provider() == DEFENSIO_SERVICE) {
      $rows[] = array(
        array(
          'data' => $message,
          'align' => 'center',
          'colspan' => $mode == 'nodes' ? '7' : '6',
        ),
      );
    }
    else {
      $rows[] = array(
        array(
          'data' => $message,
          'align' => 'center',
          'colspan' => $mode == 'nodes' ? '6' : '5',
        ),
      );
    }
  }
  $output .= theme('table', $form['header']['#value'], $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}