/** * Opens (unfolds) the necessary nodes to access to a given node, and * returns the HTML of the first unfolded node and its children. */ public static function tree_find_node() { parent::$json_data += array('node_to_find' => '', 'node_to_replace' => '', 'tree_to_replace_node_with' => '', 'tree_nodes' => array()); $tree = new ApmTreeData(); $tree->load_last_tree(); $node_to_find = $_POST['node_to_find']; parent::$json_data['node_to_find'] = $node_to_find; $node_to_replace = $tree->open_the_way_to_node($node_to_find); if ($node_to_replace !== false) { parent::$json_data['node_to_replace'] = $node_to_replace; $tree_nodes = $tree->get_ready_to_display_tree($node_to_replace); parent::$json_data['tree_nodes'] = array_keys($tree_nodes); parent::$json_data['tree_to_replace_node_with'] = self::get_html_tree($tree_nodes); } else { parent::add_error("Node [{$node_to_find}] not found"); } parent::send_json(); }