function cmf_admin_nodes_form in Content Management Filter 6.2
Same name and namespace in other branches
- 5 node.inc \cmf_admin_nodes_form()
- 6 node.inc \cmf_admin_nodes_form()
- 7 node.inc \cmf_admin_nodes_form()
Defines the form for nodes administration filter results.
Parameters
$user_page_user: if we are on a user page, the user that page belongs to, not the current user
Return value
array with forms properties
1 string reference to 'cmf_admin_nodes_form'
- cmf_admin_content_page in ./
cmf.module - Called when user goes to example.com/admin/content/filter
File
- ./
node.inc, line 22 - @brief Content management filter node operations file,
Code
function cmf_admin_nodes_form($form_state, $user_page_user = NULL) {
global $user;
$destination = drupal_get_destination();
$lang_codes = array(
'' => t('Neutral'),
);
if (module_exists('locale')) {
$locale_available = TRUE;
$lang_codes += locale_language_list('name');
}
else {
$locale_available = FALSE;
}
// Build an 'Update options' form.
if (user_access('filter and manage site content')) {
$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'),
);
}
// Load the nodes that we want to display.
$form['header'] = array(
'#type' => 'value',
'#value' => cmf_build_header($user_page_user),
);
$result = cmf_perform_query($form['header']['#value'], NULL, $user_page_user);
// Build a table listing the appropriate nodes.
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = '';
if ($_SESSION['cmf_show_nid']) {
$form['cmf_id'][$node->nid] = array(
'#value' => l($node->nid, 'node/' . $node->nid, array(
'attributes' => array(
'title' => t('Node !nid', array(
'!nid' => $node->nid,
)),
),
)),
);
}
// Don't mark it if it is the current user.
$mark = $node->uid == $user->uid ? NULL : ' ' . theme('mark', node_mark($node->nid, $node->changed));
$form['title'][$node->nid] = array(
'#value' => l($node->title, 'node/' . $node->nid, array(
'attributes' => array(
'title' => check_plain($node->body),
),
'fragment' => 'node-' . $node->nid,
)) . $mark,
);
$form['kind'][$node->nid] = array(
'#value' => _cmf_get_img('node', t('node')),
);
$form['type'][$node->nid] = $node->type == 'forum' ? array(
'#value' => '<p title="' . _cmf_get_forum($node->nid) . '">' . check_plain(node_get_types('name', $node)) . '</p>',
) : array(
'#value' => check_plain(node_get_types('name', $node)),
);
if (!_cmf_valid_user($user_page_user)) {
$form['username'][$node->nid] = array(
'#value' => theme('cmf_user', $node->uid),
);
}
$status = array();
$status[] = $node->status ? t('published') : t('not published');
if ($node->promote) {
$status[] = t('promoted');
}
// >0 allows for sticky-encoded weighting.
if ($node->sticky > 0) {
$status[] = t('sticky');
}
if ($node->moderate) {
$status[] = t('moderated');
}
$form['status'][$node->nid] = array(
'#value' => implode(', ', $status),
);
$form['created'][$node->nid] = array(
'#value' => format_date($node->created, 'small'),
);
if (user_access('filter and manage site content')) {
$form['operations'][$node->nid] = array(
'#value' => l(_cmf_get_img('edit', t('edit')) . ' ' . t('edit'), 'node/' . $node->nid . '/edit', array(
'query' => $destination,
'html' => TRUE,
)),
);
}
if ($locale_available) {
$form['language'][$node->nid] = array(
'#value' => $lang_codes[$node->language],
);
}
}
if (user_access('filter and manage site content')) {
$form['nodes'] = array(
'#type' => 'checkboxes',
'#options' => $nodes,
);
}
$form['pager'] = array(
'#value' => theme('pager', NULL, $_SESSION['cmf_max_rows'], 0),
);
return $form;
}