/** * Retrieves the total number of nodes. Warning : it includes the root node. * Note : $this->apm_tree must be loaded before calling this. * @param boolean $only_first_level Set to true to count only first level nodes (the ones just under the root). */ private function get_apm_tree_nb_nodes($only_first_level = false) { $nb_nodes = 0; if (!empty($this->apm_tree)) { if ($only_first_level) { $nb_nodes = $this->apm_tree->count_node_direct_children(self::root_id); } else { $nb_nodes = $this->apm_tree->count_nodes(); } } return $nb_nodes; }