You are here

function nodehierarchy_movechild in Node Hierarchy 6

Same name and namespace in other branches
  1. 5 nodehierarchy.module \nodehierarchy_movechild()

Move a child up or down by the given ammount.

2 calls to nodehierarchy_movechild()
nodehierarchy_callback in ./nodehierarchy.module
Callback to perform actions such as move up and down.
nodehierarchy_callback_ajax in ./nodehierarchy.module
Ajax callback.

File

./nodehierarchy.module, line 642

Code

function nodehierarchy_movechild($node, $direction) {
  if ($direction == "up") {
    $node->order_by -= 1.5;
  }
  else {
    $node->order_by += 1.5;
  }
  db_query("UPDATE {nodehierarchy} SET order_by = %f WHERE nid = %d", $node->order_by, $node->nid);
  _nodehierarchy_normalize_child_order($node->parent);
}