Exemplo n.º 1
0
 function getChildFamilyLabel(WT_Family $family)
 {
     if (preg_match('/\\n1 FAMC @' . $family->getXref() . '@(?:\\n[2-9].*)*\\n2 PEDI (.+)/', $this->getGedcom(), $match)) {
         // A specified pedigree
         return WT_Gedcom_Code_Pedi::getChildFamilyLabel($match[1]);
     } else {
         // Default (birth) pedigree
         return WT_Gedcom_Code_Pedi::getChildFamilyLabel('');
     }
 }
Exemplo n.º 2
0
 private function getDescendantsHtml(WT_Individual $individual, WT_Family $parents = null)
 {
     // A person has many names.  Select the one that matches the searched surname
     $person_name = '';
     foreach ($individual->getAllNames() as $name) {
         list($surn1) = explode(",", $name['sort']);
         if (stripos($surn1, $this->surname) !== false || stripos($this->surname, $surn1) !== false || $this->soundex_std && WT_Soundex::compare(WT_Soundex::soundex_std($surn1), WT_Soundex::soundex_std($this->surname)) || $this->soundex_dm && WT_Soundex::compare(WT_Soundex::soundex_dm($surn1), WT_Soundex::soundex_dm($this->surname))) {
             $person_name = $name['full'];
             break;
         }
     }
     // No matching name?  Typically children with a different surname.  The tree stops here.
     if (!$person_name) {
         return '<li title="' . strip_tags($individual->getFullName()) . '">' . $individual->getSexImage() . '…</li>';
     }
     // Is this individual one of our ancestors?
     $sosa = array_search($individual, $this->ancestors, true);
     if ($sosa) {
         $sosa_class = 'search_hit';
         $sosa_html = ' <a class="details1 ' . $individual->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $individual->getXref() . '">' . $sosa . '</a>' . self::sosaGeneration($sosa);
     } else {
         $sosa_class = '';
         $sosa_html = '';
     }
     // Generate HTML for this individual, and all their descendants
     $indi_html = $individual->getSexImage() . '<a class="' . $sosa_class . '" href="' . $individual->getHtmlUrl() . '">' . $person_name . '</a> ' . $individual->getLifeSpan() . $sosa_html;
     // If this is not a birth pedigree (e.g. an adoption), highlight it
     if ($parents) {
         $pedi = '';
         foreach ($individual->getFacts('FAMC') as $fact) {
             if ($fact->getTarget() === $parents) {
                 $pedi = $fact->getAttribute('PEDI');
                 break;
             }
         }
         if ($pedi && $pedi != 'birth') {
             $indi_html = '<span class="red">' . WT_Gedcom_Code_Pedi::getValue($pedi, $individual) . '</span> ' . $indi_html;
         }
     }
     // spouses and children
     $spouse_families = $individual->getSpouseFamilies();
     if ($spouse_families) {
         usort($spouse_families, array('WT_Family', 'compareMarrDate'));
         $fam_html = '';
         foreach ($spouse_families as $family) {
             $fam_html .= $indi_html;
             // Repeat the individual details for each spouse.
             $spouse = $family->getSpouse($individual);
             if ($spouse) {
                 $sosa = array_search($spouse, $this->ancestors, true);
                 if ($sosa) {
                     $sosa_class = 'search_hit';
                     $sosa_html = ' <a class="details1 ' . $spouse->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $spouse->getXref() . '"> ' . $sosa . ' </a>' . self::sosaGeneration($sosa);
                 } else {
                     $sosa_class = '';
                     $sosa_html = '';
                 }
                 $marriage_year = $family->getMarriageYear();
                 if ($marriage_year) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . strip_tags($family->getMarriageDate()->Display()) . '"><i class="icon-rings"></i>' . $marriage_year . '</a>';
                 } elseif ($family->getFirstFact('MARR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('MARR') . '"><i class="icon-rings"></i></a>';
                 } elseif ($family->getFirstFact('_NMR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('_NMR') . '"><i class="icon-rings"></i></a>';
                 }
                 $fam_html .= ' ' . $spouse->getSexImage() . '<a class="' . $sosa_class . '" href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a> ' . $spouse->getLifeSpan() . ' ' . $sosa_html;
             }
             $fam_html .= '<ol>';
             foreach ($family->getChildren() as $child) {
                 $fam_html .= $this->getDescendantsHtml($child, $family);
             }
             $fam_html .= '</ol>';
         }
         return '<li>' . $fam_html . '</li>';
     } else {
         // No spouses - just show the individual
         return '<li>' . $indi_html . '</li>';
     }
 }
Exemplo n.º 3
0
function edit_field_pedi($name, $selected = '', $extra = '', WT_Individual $individual = null)
{
    return select_edit_control($name, WT_Gedcom_Code_Pedi::getValues($individual), '', $selected, $extra);
}
Exemplo n.º 4
0
     exit;
 }
 $person = WT_Individual::getInstance($xref);
 $family = WT_Family::getInstance($famid);
 check_record_access($person);
 check_record_access($family);
 $controller->setPageTitle($person->getFullName() . ' - ' . WT_I18N::translate('Link this individual to an existing family as a child'))->pageHeader();
 // Replace any existing child->family link (we may be changing the PEDI);
 $fact_id = null;
 foreach ($person->getFacts('FAMC') as $fact) {
     if ($family === $fact->getTarget()) {
         $fact_id = $fact->getFactId();
         break;
     }
 }
 $gedcom = WT_Gedcom_Code_Pedi::createNewFamcPedi($PEDI, $famid);
 $person->updateFact($fact_id, $gedcom, true);
 // Only set the family->child link if it does not already exist
 $edit_fact = null;
 foreach ($family->getFacts('CHIL') as $fact) {
     if ($person === $fact->getTarget()) {
         $edit_fact = $fact;
         break;
     }
 }
 if (!$edit_fact) {
     $family->createFact('1 CHIL @' . $person->getXref() . '@', true);
 }
 $controller->addInlineJavascript('closePopupAndReloadParent();');
 break;
 ////////////////////////////////////////////////////////////////////////////////