예제 #1
0
 /**
  * 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)
 {
     if (!isset($ver) || $ver === '') {
         $ver = $this->ver;
     }
     $ged_rec = '';
     if (strpos($ver, '5.5.1') == 0) {
         if (isset($this->id) && $this->id != '') {
             $ged_rec .= $lvl . ' ' . Rp_Tags::NOTE . ' @' . $this->id . '@';
         } else {
             if (isset($this->text) && $this->text != '') {
                 $ged_rec .= parent::to_con_tag($this->text, Rp_Tags::NOTE, $lvl);
             }
         }
     }
     return $ged_rec;
 }
예제 #2
0
 /**
  * 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->source_name) && $this->source_name != '') {
         $ged_rec .= $lvl . ' ' . Rp_Tags::DATA . ' ' . $this->source_name;
     }
     $lvl2 = $lvl + 1;
     if (isset($this->date) && $this->date != '') {
         if ($ged_rec != '') {
             $ged_rec .= "\n";
         }
         $ged_rec .= $lvl2 . ' ' . Rp_Tags::DATE . ' ' . $this->date;
     }
     if (isset($this->copyright) && $this->copyright != '') {
         $ged_rec .= "\n" . parent::to_con_tag($this->copyright, Rp_Tags::COPYRIGHT, $lvl2);
     }
     return $ged_rec;
 }
예제 #3
0
 /**
  * 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)
 {
     if (!isset($ver) || $ver === '') {
         $ver = $this->ver;
     }
     $ged_rec = '';
     if (strpos($ver, '5.5.1') == 0) {
         if (isset($this->source_id) && $this->source_id != '') {
             $ged_rec .= $lvl . ' ' . Rp_Tags::CITE . ' @' . $this->source_id . '@';
         }
         $lvl2 = $lvl + 1;
         if (isset($this->page) && $this->page != '') {
             $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::PAGE . ' ' . $this->page;
         }
         if (isset($this->event_type) && $this->event_type != '') {
             $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::EVENTTYPE . ' ' . $this->event_type;
             if (isset($this->rile_in_event) && $this->role_in_event != '') {
                 $ged_rec .= "\n" . ($lvl2 + 1) . ' ' . Rp_Tags::ROLE . ' ' . $this->role_in_event;
             }
         }
         if (isset($this->entry_date) && $this->entry_date != '' || count($this->texts) > 0) {
             $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::DATA;
             $lvl3 = $lvl2 + 1;
             if (isset($this->entry_date) && $this->entry_date != '') {
                 $ged_rec .= "\n" . $lvl3 . ' ' . Rp_Tags::DATE . ' ' . $this->entry_date;
             }
             for ($i = 0; $i < count($this->texts); $i++) {
                 $ged_rec .= "\n" . parent::to_con_tag($this->texts[$i], Rp_Tags::TEXT, $lvl3);
             }
         }
         if (isset($this->quay) && $this->quay != '') {
             $ged_rec .= "\n" . $lvl2 . ' ' . Rp_Tags::QUAY . ' ' . $this->quay;
         }
         for ($i = 0; $i < count($this->media_links); $i++) {
             $ged_rec .= "\n" . $this->media_links[$i]->to_gedcom($lvl2, $ver);
         }
         for ($i = 0; $i < count($this->notes); $i++) {
             $ged_rec .= "\n" . $this->notes[$i]->to_gedcom($lvl2, $ver);
         }
     }
     return $ged_rec;
 }