Exemplo n.º 1
0
                if ($rfact != $fact) {
                    $newreqd[] = $rfact;
                }
            }
            $reqdfacts = $newreqd;
            $indifacts[] = $event;
        }
    }
    foreach ($reqdfacts as $ind => $fact) {
        $e = new Event("1 {$fact}\n");
        $e->temp = true;
        $indifacts[] = $e;
    }
    sort_facts($indifacts);
    $sfams = find_families_in_record($gedrec, "FAMS");
    $cfams = find_families_in_record($gedrec, "FAMC");
    if (count($cfams) == 0) {
        $cfams[] = "";
    }
    $tabkey = 1;
    $person = Person::getInstance($pid);
    echo '<b>', PrintReady(stripLRMRLM($person->getFullName()));
    if ($SHOW_ID_NUMBERS) {
        echo PrintReady("&nbsp;&nbsp;(" . $pid . ")");
    }
    echo '</b><br />';
    ?>
<script language="JavaScript" type="text/javascript">
<!--
var tab_count = <?php 
    echo count($sfams) + count($cfams);
Exemplo n.º 2
0
/**
 * find all family ids in the given record that should be visible to the current user
 *
 * searches an individual gedcom record and returns an array of the FAMS|C ids that are visible
 * @param string $indirec the gedcom record for the person to look in
 * @param string $tag 	The family tag to look for, FAMS or FAMC
 * @return array array of family ids
 */
function find_visible_families_in_record($indirec, $tag)
{
    $allfams = find_families_in_record($indirec, $tag);
    $visiblefams = array();
    // select only those that are visible to current user
    foreach ($allfams as $key => $famid) {
        if (displayDetailsById($famid, "FAM")) {
            $visiblefams[] = $famid;
        }
    }
    return $visiblefams;
}
Exemplo n.º 3
0
 /**
  * Updates Family Records such as children, spouse, and parents
  */
 function UpdateFamily($record1, $record2)
 {
     // This makes sure there is a record in both the server and client else it returns the record that
     // exist if any
     if (empty($record1)) {
         return $record2;
     } elseif (empty($record2)) {
         return $record1;
     }
     $this->authenticate();
     //this makes sure that the person is the one that was clicked so that this methade is not called more then ti needs to be
     $ct = preg_match("/0 @(.*)@ (.*)/", $record1, $match);
     $personId1 = null;
     if ($ct > 0) {
         $personId1 = $match[1];
         $type1 = trim($match[2]);
         if ($type1 != "INDI") {
             return $record1;
         }
     }
     $ct = preg_match("/0 @(.*)@ (.*)/", $record2, $match);
     if ($ct > 0) {
         $personId2 = $match[1];
         $type2 = trim($match[2]);
         if ($type2 != "INDI") {
             return $record1;
         }
     }
     //-- remove all remote family links added in _merge() so that we can add them back in if we need to
     $record1 = preg_replace("/\\d FAM[SC] @" . $this->xref . ":[\\w\\d]+@\r?\n/", "", $record1);
     //debug_print_backtrace();
     // holds the arrays of the current individual Familys
     $List1FamilyChildID = find_families_in_record($record1, "FAMC");
     $List2FamilyChildID = find_families_in_record($record2, "FAMC");
     $List1FamilySpouseID = find_families_in_record($record1, "FAMS");
     $List2FamilySpouseID = find_families_in_record($record2, "FAMS");
     $FamilyListSpouse = array();
     $FamilyListChild = array();
     // bools used to make sure the same children and/or familys are not counted more then twice
     $firstTimeFamily = true;
     // starting the comparisons for family as child
     if (empty($List1FamilyChildID)) {
         //-- add all remote ids
         foreach ($List2FamilyChildID as $famc => $famCild2) {
             $FamilyListChild[] = $famCild2;
         }
     } elseif (empty($List2FamilyChildID)) {
         //-- nothing to do if there are no remote families
     } else {
         // Creating the first family
         foreach ($List1FamilyChildID as $famc => $famCild1) {
             if (!empty($famCild1)) {
                 // Creating the Secound Family
                 foreach ($List2FamilyChildID as $famc => $famCild2) {
                     if (!empty($famCild2)) {
                         if (!$this->CompairForUpdateFamily($famCild1, $famCild2)) {
                             if ($firstTimeFamily) {
                                 $FamilyListChild[] = $famCild2;
                             }
                         } else {
                             $this->MergeForUpdateFamily($famCild1, $famCild2, $FamilyListChild, $FamilyListChild);
                         }
                     }
                 }
             }
         }
     }
     // starting the comparisons for family as spouse
     if (empty($List1FamilySpouseID)) {
         //-- add all remote ids
         foreach ($List2FamilySpouseID as $fams => $famSpouse2) {
             if (!empty($famSpouse2)) {
                 $FamilyListSpouse[] = $famSpouse2;
             }
         }
     } elseif (empty($List2FamilySpouseID)) {
         //-- don't do anything if there are no remote families
     } else {
         // Creating the first family
         foreach ($List1FamilySpouseID as $fams => $famSpouse1) {
             if (!empty($famSpouse1)) {
                 // Creating the Secound Family
                 foreach ($List2FamilySpouseID as $fams => $famSpouse2) {
                     if (!empty($famSpouse2)) {
                         if (!$this->CompairForUpdateFamily($famSpouse1, $famSpouse2)) {
                             if ($firstTimeFamily) {
                                 $FamilyListSpouse[] = $famSpouse2;
                             }
                         } else {
                             $this->MergeForUpdateFamily($famSpouse1, $famSpouse2, $FamilyListSpouse, $FamilyListSpouse);
                         }
                     }
                 }
             }
         }
     }
     // This Adds any new familys to the person.
     if (count($FamilyListChild) > 0) {
         for ($i = 0; $i < count($FamilyListChild); $i++) {
             $record1 .= "\n1 FAMC @";
             if (strpos($FamilyListChild[$i], $this->xref) !== 0) {
                 $record1 .= $this->xref . ":";
             }
             $record1 .= $FamilyListChild[$i] . "@";
         }
     }
     if (count($FamilyListSpouse) > 0) {
         for ($i = 0; $i < count($FamilyListSpouse); $i++) {
             $record1 .= "\n1 FAMS @";
             if (strpos($FamilyListSpouse[$i], $this->xref) !== 0) {
                 $record1 .= $this->xref . ":";
             }
             $record1 .= $FamilyListSpouse[$i] . "@";
         }
     }
     return $record1;
 }