children = $isRoot ? array($item) : $item->children(); print $view; } public function move($source_id, $target_id) { $source = ORM_MPTT::factory("item", $source_id); $target = ORM_MPTT::factory("item", $target_id); try { $source->move_to($target); print "success"; } catch (Exception $e) { Kohana::log("error", $e->getMessage() . "\n" + $e->getTraceAsString()); header("HTTP/1.1 500"); print $e->getMessage(); } } }