function node_admin_nodes in Drupal 6
Same name and namespace in other branches
- 4 modules/node.module \node_admin_nodes()
- 5 modules/node/node.module \node_admin_nodes()
- 7 modules/node/node.admin.inc \node_admin_nodes()
Form builder: Builds the node administration overview.
1 call to node_admin_nodes()
- node_admin_content in modules/
node/ node.admin.inc - Menu callback: content administration.
File
- modules/
node/ node.admin.inc, line 451 - Content administration and module settings UI.
Code
function node_admin_nodes() {
$filter = node_build_filter_query();
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name 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']);
// Enable language column if locale is enabled or if we have any node with language
$count = db_result(db_query("SELECT COUNT(*) FROM {node} n WHERE language != ''"));
$multilanguage = module_exists('locale') || $count;
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$options = array();
foreach (module_invoke_all('node_operations') as $operation => $array) {
$options[$operation] = $array['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 'approve',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#submit' => array(
'node_admin_nodes_submit',
),
);
$languages = language_list();
$destination = drupal_get_destination();
$nodes = array();
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = '';
$options = empty($node->language) ? array() : array(
'language' => $languages[$node->language],
);
$form['title'][$node->nid] = array(
'#value' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
);
$form['name'][$node->nid] = array(
'#value' => check_plain(node_get_types('name', $node)),
);
$form['username'][$node->nid] = array(
'#value' => theme('username', $node),
);
$form['status'][$node->nid] = array(
'#value' => $node->status ? t('published') : t('not published'),
);
if ($multilanguage) {
$form['language'][$node->nid] = array(
'#value' => empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name),
);
}
$form['operations'][$node->nid] = array(
'#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array(
'query' => $destination,
)),
);
}
$form['nodes'] = array(
'#type' => 'checkboxes',
'#options' => $nodes,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0),
);
$form['#theme'] = 'node_admin_nodes';
return $form;
}