You are here

function node_admin_nodes in Drupal 4

Same name and namespace in other branches
  1. 5 modules/node/node.module \node_admin_nodes()
  2. 6 modules/node/node.admin.inc \node_admin_nodes()
  3. 7 modules/node/node.admin.inc \node_admin_nodes()

Menu callback: content administration.

1 string reference to 'node_admin_nodes'
node_menu in modules/node.module
Implementation of hook_menu().

File

modules/node.module, line 1145
The core that allows content to be submitted to the site.

Code

function node_admin_nodes() {
  global $form_values;
  $output = node_filter_form();
  if ($_POST['edit']['operation'] == 'delete' && $_POST['edit']['nodes']) {
    return node_multiple_delete_confirm();
  }
  $filter = node_build_filter_query();
  $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n ' . $filter['join'] . ' INNER JOIN {users} u ON n.uid = u.uid ' . $filter['where'] . ' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
  $form['options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Update options'),
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $options = array();
  foreach (node_operations() as $key => $value) {
    $options[$key] = $value[0];
  }
  $form['options']['operation'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => 'approve',
  );
  $form['options']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );
  $destination = drupal_get_destination();
  while ($node = db_fetch_object($result)) {
    $nodes[$node->nid] = '';
    $form['title'][$node->nid] = array(
      '#value' => l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
    );
    $form['name'][$node->nid] = array(
      '#value' => node_get_name($node),
    );
    $form['username'][$node->nid] = array(
      '#value' => theme('username', $node),
    );
    $form['status'][$node->nid] = array(
      '#value' => $node->status ? t('published') : t('not published'),
    );
    $form['operations'][$node->nid] = array(
      '#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array(), $destination),
    );
  }
  $form['nodes'] = array(
    '#type' => 'checkboxes',
    '#options' => $nodes,
  );
  $form['pager'] = array(
    '#value' => theme('pager', NULL, 50, 0),
  );

  // Call the form first, to allow for the form_values array to be populated.
  $output .= drupal_get_form('node_admin_nodes', $form);
  return $output;
}