Example #1
0
 /**
  * Extracts attribute contents FROM a parent tree object
  *
  * @param array  $tree an array containing an array FROM which the
  *                     object data should be extracted
  * @param string $ver  represents the version of the GEDCOM standard
  *                     data is being extracted from
  *
  * @return void
  *
  * @access public
  * @since Method available since Release 0.0.1
  */
 public function parse_tree_to_array($tree, $ver)
 {
     $facts = array();
     $keys = array_keys($this->_TYPES);
     foreach ($keys as $tag) {
         $off = 0;
         while (($i1 = parent::find_tag($tree, $tag, $off)) !== false) {
             $fact = new RP_Fact();
             $fact->ver = $ver;
             $fact->tag = $tag;
             $fact->descr = parent::parse_text($tree[$i1], $tag);
             //$tmp = $fact->TYPES;
             //$fact->Type = $tmp[$tag];
             if (isset($tree[$i1][1])) {
                 $fact->parse_tree_detail($tree[$i1][1], $ver);
             }
             $facts[] = $fact;
             $off = $i1 + 1;
         }
     }
     return $facts;
 }
 /**
  * Extracts attribute contents FROM a parent tree object
  *
  * @param array  $tree an array containing an array FROM which the
  *                     object data should be extracted
  * @param string $ver  represents the version of the GEDCOM standard
  *                     data is being extracted from
  *
  * @return void
  *
  * @access public
  * @since Method available since Release 0.0.1
  */
 public function parse_tree($tree, $ver)
 {
     $this->ver = $ver;
     $this->id = parent::parse_ref_id($tree[0], Rp_Tags::INDIVIDUAL);
     if (isset($tree[0][1])) {
         $sub2 = $tree[0][1];
         if (($i1 = parent::find_tag($sub2, Rp_Tags::RESTRICTION)) !== false) {
             $this->restriction = parent::parse_text($sub2[$i1], Rp_Tags::RESTRICTION);
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::FULL, $off)) !== false) {
             $tmp = new RP_Personal_Name();
             $tmp->parse_tree(array($sub2[$i1]), $ver);
             $this->names[] = $tmp;
             $off = $i1 + 1;
         }
         if (($i1 = parent::find_tag($sub2, Rp_Tags::GENDER)) !== false) {
             $this->gender = parent::parse_text($sub2[$i1], Rp_Tags::GENDER);
         }
         $tmp = new RP_Event();
         $this->events = $tmp->parse_tree_to_array($sub2, $ver);
         $tmp = new RP_Fact();
         $this->attributes = $tmp->parse_tree_to_array($sub2, $ver);
         //TODO add support for LdsOrdinances
         //$this->LdsOrdinances = LdsOrdinance::parseTreeToArray($sub2, $ver);
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::CHILDFAMILY, $off)) !== false) {
             $tmp = new RP_Family_Link();
             $tmp->parse_tree(array($sub2[$i1]), $ver, Rp_Tags::CHILDFAMILY);
             $this->child_family_links[] = $tmp;
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::SPOUSEFAMILY, $off)) !== false) {
             $tmp = new RP_Family_Link();
             $tmp->parse_tree(array($sub2[$i1]), $ver, Rp_Tags::SPOUSEFAMILY);
             $this->spouse_family_links[] = $tmp;
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::SUBMITTER, $off)) !== false) {
             $this->submitter_links[] = parent::parse_ptr_id($sub2[$i1], Rp_Tags::SUBMITTER);
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::ASSOCIATION, $off)) !== false) {
             $tmp = new RP_Association();
             $tmp->parse_tree(array($sub2[$i1]), $ver);
             $this->associations[] = $tmp;
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::ALIAS, $off)) !== false) {
             $this->aliases[] = parent::parse_ptr_id($sub2[$i1], Rp_Tags::ALIAS);
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::ANCI, $off)) !== false) {
             $this->ancestor_interests[] = parent::parse_ptr_id($sub2[$i1], Rp_Tags::ANCI);
             $off = $i1 + 1;
         }
         $off = 0;
         while (($i1 = parent::find_tag($sub2, Rp_Tags::DESI, $off)) !== false) {
             $this->descendant_interests[] = parent::parse_ptr_id($sub2[$i1], Rp_Tags::DESI);
             $off = $i1 + 1;
         }
         if (($i1 = parent::find_tag($sub2, Rp_Tags::PERMFILE)) !== false) {
             $this->perm_rec_file_nbr = parent::parse_text($sub2[$i1], Rp_Tags::PERMFILE);
         }
         if (($i1 = parent::find_tag($sub2, Rp_Tags::ANCFILE)) !== false) {
             $this->anc_file_nbr = parent::parse_text($sub2[$i1], Rp_Tags::ANCFILE);
         }
         $this->common_parse_tree($sub2, $ver);
     }
 }