echo $pgv_lang["save"]; ?> " /><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 {
/** * 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; } }
/** * returns a marriage anniversary iCalendar event for a family marriage. * If there is no date for the event, or either of the spouses is not alive, * no iCalendar event will be returned * @param Family $family the Family Object used as the source of the marriage anniversary info * @return the marriage anniversary iCalendar event. */ function getFamilyAnniversaryIcalEvent($family) { $anniversaryDate = $family->getMarriageDate(); if ($anniversaryDate == "") { return; } if ($family->isDivorced()) { return; } $wife = $family->getWife(); $husband = $family->getHusband(); if ($wife->isDead() || $husband->isDead()) { return; } $anniversaryDate = new GedcomDate($anniversaryDate); $summary = "Anniversary of " . $husband->getFullName() . " and " . $wife->getFullName(); $place = $family->getMarriagePlace(); $description = "Married on " . $anniversaryDate->Display(false) . ($place == "" ? "" : "in " . $place) . "\n" . encode_url($family->getAbsoluteLinkUrl()); $iCalRecord = getIcalRecord($anniversaryDate, $summary, $description, encode_url($family->getAbsoluteLinkUrl())); return $iCalRecord; }