/** * Display family members with clickable links * * @param Family $family * @param Individual $individual */ function print_navigator_family(Family $family, Individual $individual) { foreach ($family->getSpouses() as $spouse) { ?> <tr class="fact_value"> <td class="facts_value"> <a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php echo $spouse->getXref(); ?> &gedcom=<?php echo $spouse->getTree()->getNameUrl(); ?> "> <i class="headimg vmiddle icon-button_head"></i> </a> </td> <td class="facts_value" > <a href="#" onclick="opener.insertRowToTable('<?php echo $spouse->getXref(); ?> ', '<?php echo Filter::escapeJs($spouse->getFullName()); ?> ', '', '', '', '', '', '', '', ''); return false;"> <?php echo $spouse === $individual ? '<b>' : ''; ?> <?php echo $spouse->getFullName(); ?> <?php echo $spouse->getLifeSpan(); ?> <?php echo $spouse === $individual ? '</b>' : ''; ?> </a> </td> <tr> <?php } foreach ($family->getChildren() as $child) { ?> <tr> <td class="facts_value" > <a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php echo $child->getXref(); ?> &gedcom=<?php echo $child->getTree()->getNameUrl(); ?> "> <i class="headimg vmiddle icon-button_head"></i> </a> </td> <td class="facts_value"> <a href="#" onclick="opener.insertRowToTable('<?php echo $child->getXref(); ?> ', '<?php echo Filter::escapeJs($child->getFullName()); ?> ', '', '', '', '', '', '', '', ''); return false;"> <?php echo $child === $individual ? '<b>' : ''; ?> <?php echo $child->getFullName(); ?> <?php echo $child->getLifeSpan(); ?> <?php echo $child === $individual ? '</b>' : ''; ?> </a> </td> </tr> <?php } }
?> " /><input type="button" value="<?php echo $pgv_lang["cancel"]; ?> " onclick="window.close();" /> </form> <?php break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case 'changefamily_update': require_once PGV_ROOT . 'includes/classes/class_family.php'; $family = new Family($gedrec); $father = $family->getHusband(); $mother = $family->getWife(); $children = $family->getChildren(); $updated = false; //-- add the new father link if (isset($_REQUEST['HUSB'])) { $HUSB = $_REQUEST['HUSB']; } if (!empty($HUSB) && (is_null($father) || $father->getXref() != $HUSB)) { if (strstr($gedrec, "1 HUSB") !== false) { $gedrec = preg_replace("/1 HUSB @.*@/", "1 HUSB @{$HUSB}@", $gedrec); } else { $gedrec .= "\n1 HUSB @{$HUSB}@\n"; } if (isset($pgv_changes[$HUSB . "_" . PGV_GEDCOM])) { $indirec = find_updated_record($HUSB, PGV_GED_ID); } else { $indirec = find_person_record($HUSB, PGV_GED_ID);
/** * Compairs familys and then returns true if the have 50% or more chance of being the same family. * Other wise it returns false. */ function CompairForUpdateFamily($family1, $family2) { // Values used to calculate the Percent of likley hood that the family is the same. $ChanceSameFamily = 0.0; $CountFamily1 = 0.0; $CountFamily2 = 0.0; $ChanceSame = 0.0; $firstTimeChildren = true; $famrec1 = find_family_record($family1); $ct = preg_match("/(\\w+):(.+)/", $family2, $match); if ($ct > 0) { $servid = trim($match[1]); $remoteid = trim($match[2]); $famrec2 = $this->getRemoteRecord($remoteid); } else { return false; } $family1 = Family::getInstance($family1); if (is_null($family1)) { return false; } $family2 = new Family($famrec2); if (!is_null($family1)) { // Creat the fathers if their is some $father1 = $family1->getHusband(); $CountFamily1 += 1.0; $mother1 = $family1->getWife(); $CountFamily1 += 1.0; } $father2 = $family2->getHusband(); $CountFamily2 += 1.0; if (empty($father1)) { unset($father1); $CountFamily1 -= 1.0; } if (empty($father2)) { unset($father2); $CountFamily2 -= 1.0; } // Creat the mothers if their is some $mother2 = $family2->getWife(); $CountFamily2 += 1.0; if (empty($mother1)) { unset($mother1); $CountFamily1 -= 1.0; } if (empty($mother2)) { unset($mother2); $CountFamily2 -= 1.0; } // Creat an array of Children $children1 = $family1->getChildren(); $children2 = $family2->getChildren(); // finds the probablity that they are the same family Bassed of both sites information $CountFamily1 += count($children1); $CountFamily2 += count($children2); foreach ($children1 as $childID1 => $Person1) { if (!empty($Person1)) { foreach ($children2 as $childID2 => $Person2) { if (!empty($Person2)) { if ($this->ComparePeople($Person1, $Person2)) { $ChanceSameFamily += 1.0; //print "<br />".$Person1->getXref()." equals ".$Person2->getXref(); break; } } } } } if (empty($father1)) { } elseif (empty($father2)) { } else { if ($this->ComparePeople($father1, $father2)) { $ChanceSameFamily += 1.0; } } if (empty($mother1)) { } elseif (empty($mother2)) { } else { if ($this->ComparePeople($mother1, $mother2)) { $ChanceSameFamily += 1.0; } } if ($CountFamily1 != 0 && $CountFamily2 != 0) { $ChanceSame = ($ChanceSameFamily / $CountFamily1 + $ChanceSameFamily / $CountFamily2) / 2; //print "<br />chancesame=".$ChanceSameFamily." count1=".$CountFamily1." count2=".$CountFamily2." ".$family1->getXref()." compared to ".$family2->getXref()." is ".$ChanceSame; } else { return false; } if ($ChanceSame < 0.5) { // If the probabilty is less then 0.5 or 50% then the current family is stored here to be added later return false; } else { return true; } }
/** * Draw the children for a family * @param Family $family The family to draw the children for * @param int $gen The number of generations of descendents to draw */ function drawChildren(&$family, $gen = 2) { if (!empty($family) && $gen > 0) { $children = $family->getChildren(); foreach ($children as $ci => $child) { $fam = null; $this->drawPerson($child, $gen - 1, -1, $fam); } } }