/** * Unfolds a node and returns the HTML of the unfolded node and its children. */ public static function tree_unfold_node() { parent::$json_data += array('unfolded_node' => '', 'unfolded_sub_tree_nodes' => array(), 'unfolded_sub_tree' => '', 'total_displayed_nodes' => 0); $tree = new ApmTreeData(); $tree->load_last_tree(); if (isset($_POST['node_to_unfold']) && is_numeric($_POST['node_to_unfold'])) { $tree->unfold_node($_POST['node_to_unfold']); parent::$json_data['unfolded_node'] = $_POST['node_to_unfold']; //Retrieve unfolded subtree to return it: $tree_nodes = $tree->get_ready_to_display_tree($_POST['node_to_unfold']); parent::$json_data['unfolded_sub_tree_nodes'] = array_keys($tree_nodes); parent::$json_data['unfolded_sub_tree'] = self::get_html_tree($tree_nodes); parent::$json_data['total_displayed_nodes'] = $tree->get_visible_nodes_number(); } else { parent::add_error("Please send a \"node_to_unfold\" as POST variable."); } parent::send_json(); }