/** * Flattens the object into a GEDCOM compliant format * * This method guarantees compliance, not re-creation of * the original order of the records. * * @param int $lvl indicates the level at which this record * should be generated * @param string $ver represents the version of the GEDCOM standard * * @return string a return character delimited string of gedcom records * * @access public * @since Method available since Release 0.0.1 */ public function to_gedcom($lvl, $ver) { $ged_rec = ''; if (isset($this->system_id) && $this->system_id != '') { $ged_rec .= $lvl . ' ' . Rp_Tags::SOURCE . ' ' . $this->system_id; } $lvl2 = $lvl + 1; if (isset($this->ver_nbr) && $this->ver_nbr != '') { $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::VERSION . ' ' . $this->ver_nbr; } if (isset($this->product_name) && $this->product_name != '') { $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::NAME . ' ' . $this->product_name; } $str = $this->corporation->to_gedcom($lvl2, null); if (isset($str) && $str != '') { $ged_rec .= "\n" . $str; } $str = $this->rp_data->to_gedcom($lvl2, null); if (isset($str) && $str != '') { $ged_rec .= "\n" . $str; } return $ged_rec; }