You are here

function ARC_erdf_parser::index_nodes_by_parent in Taxonomy import/export via XML 5.2

Same name and namespace in other branches
  1. 5 arc/ARC_erdf_parser.php \ARC_erdf_parser::index_nodes_by_parent()
  2. 6.2 arc/ARC_erdf_parser.php \ARC_erdf_parser::index_nodes_by_parent()
  3. 6 arc/ARC_erdf_parser.php \ARC_erdf_parser::index_nodes_by_parent()
1 call to ARC_erdf_parser::index_nodes_by_parent()
ARC_erdf_parser::get_triple_infos in arc/ARC_erdf_parser.php

File

arc/ARC_erdf_parser.php, line 457

Class

ARC_erdf_parser

Code

function index_nodes_by_parent() {
  if (!isset($this->nodes_by_parent)) {

    /* index by parent */
    $nodes_by_p = array();
    for ($i = 0, $i_max = count($this->nodes); $i < $i_max; $i++) {
      $cur_node = $this->nodes[$i];
      $cur_node["id"] = $i;
      $cur_p_id = $cur_node["p_id"];
      if ($cur_p_id != -1) {

        /* ignore root tag */
        if (!isset($nodes_by_p[$cur_p_id])) {
          $nodes_by_p[$cur_p_id] = array();
        }
        $cur_pos = $cur_node["pos"];
        $nodes_by_p[$cur_p_id][$cur_pos] = $cur_node;
      }
    }
    $this->nodes_by_parent = $nodes_by_p;
  }
}