77use PhpGedcom \Gedcom ;
88use PhpGedcom \Record \Fam ;
99use PhpGedcom \Record \Fam \Even ;
10+ use PhpGedcom \Record \Indi \Even as Personal ;
1011use PhpGedcom \Record \Fam \Slgs ;
1112use PhpGedcom \Record \Head ;
1213use PhpGedcom \Record \Head \Sour ;
@@ -76,22 +77,29 @@ public function addUpData($p_id, $nest = 0)
7677 return ;
7778 }
7879
79- $ person = Person::query ()->find ($ p_id );
80+ /* $person = Person::query()->find($p_id);
8081 if ($person == null) {
8182 return;
83+ } */
84+ $ persons = Person::query ()->get ();
85+ if ($ persons == null ) {
86+ return ;
87+ }
88+ foreach ($ persons as $ key => $ person ) {
89+ $ this ->setIndi ($ person ->id );
8290 }
8391
8492 // add self to indi
85- if (!in_array ($ p_id , $ this ->arr_indi_id )) {
93+ /* if (!in_array($p_id, $this->arr_indi_id)) {
8694 array_push($this->arr_indi_id, $p_id);
8795 $this->setIndi($p_id);
8896 } else {
8997 // already processed this person
9098 return;
91- }
99+ } */
92100
93101 // process family ( partner, children )
94- $ _families = Family::query ()->where ('husband_id ' , $ p_id )->orwhere ('wife_id ' , $ p_id )->get ();
102+ /* $_families = Family::query()->where('husband_id', $p_id)->orwhere('wife_id', $p_id)->get();
95103 foreach ($_families as $item) {
96104 // add family
97105 $f_id = $item->id;
@@ -118,9 +126,9 @@ public function addUpData($p_id, $nest = 0)
118126 $this->setIndi($child_id);
119127 }
120128 }
121- }
129+ } */
122130
123- $ parent_family_id = $ person ->child_in_family_id ;
131+ /* $parent_family_id = $person->child_in_family_id;
124132 $p_family = Family::query()->find($parent_family_id);
125133
126134 // there is not parent data.
@@ -143,7 +151,7 @@ public function addUpData($p_id, $nest = 0)
143151 $father_id = $p_family->husband_id;
144152 $mother_id = $p_family->wife_id;
145153 $this->addUpData($father_id, $nest);
146- $ this ->addUpData ($ mother_id , $ nest );
154+ $this->addUpData($mother_id, $nest); */
147155 }
148156
149157 public function addDownData ($ p_id , $ nest = 0 )
@@ -306,15 +314,28 @@ protected function setIndi($p_id)
306314 $ sex = $ person ->sex ;
307315 $ indi ->setSex ($ sex );
308316
317+ $ place = PersonEvent::query ()->find ($ p_id );
318+ $ _plac = new Personal ;
319+ if (!empty ($ place ->type )){
320+ $ _plac ->setType ($ place ->type );
321+ }
322+ if (!empty ($ place ->date )){
323+ $ date = \FamilyTree365 \LaravelGedcom \Utils \Importer \Date::read ("" , $ place ->date );
324+ $ _plac ->setDate ($ date );
325+ }
326+ if (!empty ($ place ->type ) && !empty ($ place ->date )){
327+ $ indi ->getAllEven ($ _plac );
328+ }
329+
309330 /**
310331 * @var Fams[]
311332 */
312- $ fams = Family::query ()->where ('husband_id ' , $ p_id )->orwhere ('wife_id ' , $ p_id )->get ();
333+ /* $fams = Family::query()->where('husband_id', $p_id)->orwhere('wife_id', $p_id)->get();
313334 foreach ($fams as $item) {
314335 $fam = new Fams();
315336 $fam->setFams($item->id);
316337 $indi->addFams($fam);
317- }
338+ } */
318339
319340 $ this ->_gedcom ->addIndi ($ indi );
320341 }
0 commit comments