You are here

function theme_antispam_moderation_form in AntiSpam 7

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

Theme callback; render the moderation queue form.

File

./antispam.admin.inc, line 830
The antispam admin theme.

Code

function theme_antispam_moderation_form($variables) {
  $form = $variables['form'];
  $mode = $form['mode']['#value'];
  $submode = $form['submode']['#value'];
  $output = drupal_render($form['submode_menu']);
  $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[] = render($form['items'][$key]);
      $row[] = render($form['title'][$key]['#value']);
      if ($mode == 'nodes') {
        $row[] = render($form['type'][$key]['#value']);
      }
      $row[] = render($form['author'][$key]['#value']);
      $row[] = render($form['status'][$key]['#value']);
      $row[] = render($form['created'][$key]['#value']);
      $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! ;-)');
    }
    elseif ($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.');
    }
    $rows[] = array(
      array(
        'data' => $message,
        'align' => 'center',
        'colspan' => $mode == 'nodes' ? '6' : '5',
      ),
    );
  }
  $output .= theme('table', array(
    'header' => $form['header']['#value'],
    'rows' => $rows,
  ));
  $output .= render($form['pager']['#value']);
  return $output;
}