function nodehierarchy_callback_ajax in Node Hierarchy 5
Same name and namespace in other branches
- 6 nodehierarchy.module \nodehierarchy_callback_ajax()
Ajax callback.
1 string reference to 'nodehierarchy_callback_ajax'
- nodehierarchy_menu in ./
nodehierarchy.module - Implementation of hook_menu().
File
- ./
nodehierarchy.module, line 541 - A module to make nodes hierarchical.
Code
function nodehierarchy_callback_ajax() {
$nid = arg(2);
$action = arg(3);
$child = node_load(array(
'nid' => $nid,
));
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Look to see if we need to change node order in this list
if ($nid && $action) {
switch ($action) {
case "getchildren":
$node = node_load($nid);
$children = nodehierarchy_get_node_children_list($node->nid, TRUE, 20);
if ($node && node_access('view', $node)) {
print theme("nodehierarchy_children_list", $node, $children, FALSE);
print theme("nodehierarchy_children_list_more_link", $node, 20, _nodehierarchy_get_children_count($node->nid));
}
//print theme("nodehierarchy_new_child_links", $node);
break;
case "up":
case "down":
if (user_access('reorder children')) {
$node = node_load($nid);
nodehierarchy_movechild($node, $action);
}
break;
}
}
exit;
}