function comment_admin_overview

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)
cle7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)
elmsmedia7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)
icor7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)
meedjum_blog7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)
mooc7 comment.admin.inc comment_admin_overview($form, &$form_state, $arg)

Form builder for the comment overview administration form.

Parameters

$arg: Current path's fourth component: the type of overview form ('approval' or 'new').

See also

comment_admin_overview_validate()

comment_admin_overview_submit()

theme_comment_admin_overview()

Related topics

1 string reference to 'comment_admin_overview'
comment_admin in modules/comment/comment.admin.inc
Menu callback; present an administrative comment listing.

File

modules/comment/comment.admin.inc, line 34
Admin page callbacks for the comment module.

Code

function comment_admin_overview($form, &$form_state, $arg) {
  // Build an 'Update options' form.
  $form['options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Update options'),
    '#attributes' => array('class' => array('container-inline')),
  );

  if ($arg == 'approval') {
    $options['publish'] = t('Publish the selected comments');
  }
  else {
    $options['unpublish'] = t('Unpublish the selected comments');
  }
  $options['delete'] = t('Delete the selected comments');

  $form['options']['operation'] = array(
    '#type' => 'select',
    '#title' => t('Operation'),
    '#title_display' => 'invisible',
    '#options' => $options,
    '#default_value' => 'publish',
  );
  $form['options']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );

  // Load the comments that need to be displayed.
  $status = ($arg == 'approval') ? COMMENT_NOT_PUBLISHED : COMMENT_PUBLISHED;
  $header = array(
    'subject' => array(
      'data' => t('Subject'),
      'field' => 'subject',
    ),
    'author' => array(
      'data' => t('Author'),
      'field' => 'name',
    ),
    'posted_in' => array(
      'data' => t('Posted in'),
      'field' => 'node_title',
    ),
    'changed' => array(
      'data' => t('Updated'),
      'field' => 'c.changed',
      'sort' => 'desc',
    ),
    'operations' => array('data' => t('Operations')),
  );

  $query = db_select('comment', 'c')->extend('PagerDefault')->extend('TableSort');
  $query->join('node', 'n', 'n.nid = c.nid');
  $query->addField('n', 'title', 'node_title');
  $query->addTag('node_access');
  $result = $query->fields('c', array('cid', 'subject', 'name', 'changed'))->condition('c.status', $status)->limit(50)->orderByHeader($header)->execute();

  $cids = array();

  // We collect a sorted list of node_titles during the query to attach to the
  // comments later.
  foreach ($result as $row) {
    $cids[] = $row->cid;
    $node_titles[] = $row->node_title;
  }
  $comments = comment_load_multiple($cids);

  // Build a table listing the appropriate comments.
  $options = array();
  $destination = drupal_get_destination();

  foreach ($comments as $comment) {
    // Remove the first node title from the node_titles array and attach to
    // the comment.
    $comment->node_title = array_shift($node_titles);
    $comment_body = field_get_items('comment', $comment, 'comment_body');
    $options[$comment->cid] = array(
      'subject' => array(
        'data' => array(
          '#type' => 'link',
          '#title' => $comment->subject,
          '#href' => 'comment/' . $comment->cid,
          '#options' => array(
            'attributes' => array('title' => truncate_utf8($comment_body[0]['value'], 128)),
            'fragment' => 'comment-' . $comment->cid,
          ),
        ),
      ),
      'author' => theme('username', array('account' => $comment)),
      'posted_in' => array(
        'data' => array(
          '#type' => 'link',
          '#title' => $comment->node_title,
          '#href' => 'node/' . $comment->nid,
        ),
      ),
      'changed' => format_date($comment->changed, 'short'),
      'operations' => array(
        'data' => array(
          '#type' => 'link',
          '#title' => t('edit'),
          '#href' => 'comment/' . $comment->cid . '/edit',
          '#options' => array('query' => $destination),
        ),
      ),
    );
  }

  $form['comments'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#empty' => t('No comments available.'),
  );

  $form['pager'] = array('#theme' => 'pager');

  return $form;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.