当前位置: 首页>>代码示例>>PHP>>正文


PHP Individual::getSpouseFamilies方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\Individual::getSpouseFamilies方法的典型用法代码示例。如果您正苦于以下问题:PHP Individual::getSpouseFamilies方法的具体用法?PHP Individual::getSpouseFamilies怎么用?PHP Individual::getSpouseFamilies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\Individual的用法示例。


在下文中一共展示了Individual::getSpouseFamilies方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR') as $fact) {
             if ($fact->getDate()->julianDay() + 365 >= $this->date()->julianDay()) {
                 return 'Y';
             }
         }
     }
     return '';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:19,代码来源:CensusColumnMarriedWithinYear.php

示例2: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR') as $fact) {
             if ($fact->getDate()->julianDay() + 365 >= $this->date()->julianDay()) {
                 // Use the GEDCOM month, as we need this in English - for the US census
                 return ucfirst(strtolower($fact->getDate()->minimumDate()->format('%O')));
             }
         }
     }
     return '';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:CensusColumnMonthIfMarriedWithinYear.php

示例3: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getBirthDate()->isOK()) {
         foreach ($individual->getSpouseFamilies() as $family) {
             foreach ($family->getFacts('MARR', true) as $fact) {
                 if ($fact->getDate()->isOK()) {
                     return Date::getAge($individual->getBirthDate(), $fact->getDate(), 0);
                 }
             }
         }
     }
     return '';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:CensusColumnAgeMarried.php

示例4: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() !== 'F') {
         return '';
     }
     $count = 0;
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getChildren() as $child) {
             if ($child->getBirthDate()->isOK() && Date::compare($child->getBirthDate(), $this->date()) < 0 && $child->getBirthDate() != $child->getDeathDate() && (!$child->getDeathDate()->isOK() || Date::compare($child->getDeathDate(), $this->date()) > 0)) {
                 $count++;
             }
         }
     }
     return (string) $count;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:23,代码来源:CensusColumnChildrenLiving.php

示例5: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     $marriage_date = null;
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR', true) as $fact) {
             if ($fact->getDate()->isOK() && Date::compare($fact->getDate(), $this->date()) <= 0) {
                 $marriage_date = $fact->getDate();
             }
         }
     }
     if ($marriage_date === null) {
         return '';
     } else {
         return (string) Date::getAge($marriage_date, $this->date(), 0);
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:24,代码来源:CensusColumnYearsMarried.php

示例6: nameAtCensusDate

 /**
  * What was an individual's likely name on a given date, allowing
  * for marriages and married names.
  *
  * @param Individual $individual
  * @param Date       $census_date
  *
  * @return string[]
  */
 protected function nameAtCensusDate(Individual $individual, Date $census_date)
 {
     $names = $individual->getAllNames();
     $name = $names[0];
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR') as $marriage) {
             if ($marriage->getDate()->isOK() && Date::compare($marriage->getDate(), $census_date) < 0) {
                 $spouse = $family->getSpouse($individual);
                 foreach ($names as $individual_name) {
                     foreach ($spouse->getAllNames() as $spouse_name) {
                         if ($individual_name['type'] === '_MARNM' && $individual_name['surn'] === $spouse_name['surn']) {
                             return $individual_name;
                         }
                     }
                 }
             }
         }
     }
     return $name;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:29,代码来源:CensusColumnFullName.php

示例7: getLdsSummary

 /**
  * Summary of LDS ordinances.
  *
  * @param Individual $individual
  *
  * @return string
  */
 public static function getLdsSummary(Individual $individual)
 {
     $BAPL = $individual->getFacts('BAPL') ? 'B' : '_';
     $ENDL = $individual->getFacts('ENDL') ? 'E' : '_';
     $SLGC = $individual->getFacts('SLGC') ? 'C' : '_';
     $SLGS = '_';
     foreach ($individual->getSpouseFamilies() as $family) {
         if ($family->getFacts('SLGS')) {
             $SLGS = '';
         }
     }
     return $BAPL . $ENDL . $SLGS . $SLGC;
 }
开发者ID:jflash,项目名称:webtrees,代码行数:20,代码来源:FunctionsPrint.php

示例8: buildIndividualMap

    /**
     * Build a map for an individual.
     *
     * @param Individual $indi
     */
    private function buildIndividualMap(Individual $indi)
    {
        $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
        $indifacts = $indi->getFacts();
        foreach ($indi->getSpouseFamilies() as $family) {
            $indifacts = array_merge($indifacts, $family->getFacts());
        }
        Functions::sortFacts($indifacts);
        // Create the markers list array
        $gmarks = array();
        $i = 0;
        foreach ($indifacts as $fact) {
            if (!$fact->getPlace()->isEmpty()) {
                $ctla = preg_match("/\\d LATI (.*)/", $fact->getGedcom(), $match1);
                $ctlo = preg_match("/\\d LONG (.*)/", $fact->getGedcom(), $match2);
                if ($fact->getParent() instanceof Family) {
                    $spouse = $fact->getParent()->getSpouse($indi);
                } else {
                    $spouse = null;
                }
                if ($ctla && $ctlo) {
                    $i++;
                    $gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => '', 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $fact->getPlace()->getGedcomName());
                } else {
                    $latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($fact->getPlace()->getGedcomName());
                    if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
                        $i++;
                        $gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => $latlongval->pl_icon, 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $fact->getPlace()->getGedcomName());
                        if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
                            $GM_MAX_ZOOM = $latlongval->pl_zoom;
                        }
                    }
                }
            }
        }
        // Add children to the markers list array
        foreach ($indi->getSpouseFamilies() as $family) {
            foreach ($family->getChildren() as $child) {
                $birth = $child->getFirstFact('BIRT');
                if ($birth) {
                    $birthrec = $birth->getGedcom();
                    if (!$birth->getPlace()->isEmpty()) {
                        $ctla = preg_match('/\\n4 LATI (.+)/', $birthrec, $match1);
                        $ctlo = preg_match('/\\n4 LONG (.+)/', $birthrec, $match2);
                        if ($ctla && $ctlo) {
                            $i++;
                            $gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => '', 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $birth->getPlace()->getGedcomName());
                            switch ($child->getSex()) {
                                case 'F':
                                    $gmarks[$i]['fact_label'] = I18N::translate('daughter');
                                    $gmarks[$i]['class'] = 'person_boxF';
                                    break;
                                case 'M':
                                    $gmarks[$i]['fact_label'] = I18N::translate('son');
                                    $gmarks[$i]['class'] = 'person_box';
                                    break;
                                default:
                                    $gmarks[$i]['fact_label'] = I18N::translate('child');
                                    $gmarks[$i]['class'] = 'person_boxNN';
                                    break;
                            }
                        } else {
                            $latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($birth->getPlace()->getGedcomName());
                            if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
                                $i++;
                                $gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => $latlongval->pl_icon, 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $birth->getPlace()->getGedcomName());
                                switch ($child->getSex()) {
                                    case 'M':
                                        $gmarks[$i]['fact_label'] = I18N::translate('son');
                                        $gmarks[$i]['class'] = 'person_box';
                                        break;
                                    case 'F':
                                        $gmarks[$i]['fact_label'] = I18N::translate('daughter');
                                        $gmarks[$i]['class'] = 'person_boxF';
                                        break;
                                    default:
                                        $gmarks[$i]['fact_label'] = I18N::translate('child');
                                        $gmarks[$i]['class'] = 'option_boxNN';
                                        break;
                                }
                                if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
                                    $GM_MAX_ZOOM = $latlongval->pl_zoom;
                                }
                            }
                        }
                    }
                }
            }
        }
        // *** ENABLE STREETVIEW ***
        $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW');
        ?>

		<script>
			// this variable will collect the html which will eventually be placed in the side_bar
//.........这里部分代码省略.........
开发者ID:bxbroze,项目名称:webtrees,代码行数:101,代码来源:GoogleMapsModule.php

示例9: getRelationshipNameFromPath

 /**
  * Convert a relationship path into a relationship name.
  *
  * @param string $path
  * @param Individual $person1
  * @param Individual $person2
  *
  * @return string
  */
 public static function getRelationshipNameFromPath($path, Individual $person1 = null, Individual $person2 = null)
 {
     if (!preg_match('/^(mot|fat|par|hus|wif|spo|son|dau|chi|bro|sis|sib)*$/', $path)) {
         // TODO: Update all the “3 RELA ” values in class_person
         return '<span class="error">' . $path . '</span>';
     }
     // The path does not include the starting person.  In some languages, the
     // translation for a man’s (relative) is different from a woman’s (relative),
     // due to inflection.
     $sex1 = $person1 ? $person1->getSex() : 'U';
     // The sex of the last person in the relationship determines the name in
     // many cases.  e.g. great-aunt / great-uncle
     if (preg_match('/(fat|hus|son|bro)$/', $path)) {
         $sex2 = 'M';
     } elseif (preg_match('/(mot|wif|dau|sis)$/', $path)) {
         $sex2 = 'F';
     } else {
         $sex2 = 'U';
     }
     switch ($path) {
         case '':
             return I18N::translate('self');
             //  Level One relationships
         //  Level One relationships
         case 'mot':
             return I18N::translate('mother');
         case 'fat':
             return I18N::translate('father');
         case 'par':
             return I18N::translate('parent');
         case 'hus':
             if ($person1 && $person2) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('MALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('MALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-husband');
                         }
                     }
                 }
             }
             return I18N::translate('husband');
         case 'wif':
             if ($person1 && $person1) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('FEMALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('FEMALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-wife');
                         }
                     }
                 }
             }
             return I18N::translate('wife');
         case 'spo':
             if ($person1 && $person2) {
                 foreach ($person1->getSpouseFamilies() as $family) {
                     if ($person2 === $family->getSpouse($person1)) {
                         if ($family->getFacts('_NMR')) {
                             if ($family->getFacts(WT_EVENTS_DIV)) {
                                 return I18N::translateContext('MALE/FEMALE', 'ex-partner');
                             } else {
                                 return I18N::translateContext('MALE/FEMALE', 'partner');
                             }
                         } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                             return I18N::translate('ex-spouse');
                         }
                     }
                 }
             }
             return I18N::translate('spouse');
         case 'son':
             return I18N::translate('son');
         case 'dau':
             return I18N::translate('daughter');
         case 'chi':
             return I18N::translate('child');
         case 'bro':
             if ($person1 && $person2) {
                 $dob1 = $person1->getBirthDate();
                 $dob2 = $person2->getBirthDate();
//.........这里部分代码省略.........
开发者ID:jflash,项目名称:webtrees,代码行数:101,代码来源:Functions.php

示例10: addFamily

 /**
  * Add a person (and optionally their immediate family members) to the pids array
  *
  * @param Individual $person
  * @param bool $add_family
  *
  * @return array
  */
 private function addFamily(Individual $person, $add_family)
 {
     $xrefs = array();
     $xrefs[] = $person->getXref();
     if ($add_family) {
         foreach ($person->getSpouseFamilies() as $family) {
             $spouse = $family->getSpouse($person);
             if ($spouse) {
                 $xrefs[] = $spouse->getXref();
                 foreach ($family->getChildren() as $child) {
                     $xrefs[] = $child->getXref();
                 }
             }
         }
         foreach ($person->getChildFamilies() as $family) {
             foreach ($family->getSpouses() as $parent) {
                 $xrefs[] = $parent->getXref();
             }
             foreach ($family->getChildren() as $sibling) {
                 if ($person !== $sibling) {
                     $xrefs[] = $sibling->getXref();
                 }
             }
         }
     }
     return $xrefs;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:35,代码来源:LifespanController.php

示例11: printFamilyBook

 /**
  * Print a “Family Book” for an individual
  *
  * @param Individual $person
  * @param int    $descent_steps
  */
 public function printFamilyBook(Individual $person, $descent_steps)
 {
     if ($descent_steps == 0 || !$person->canShowName()) {
         return;
     }
     $families = $person->getSpouseFamilies();
     if ($families) {
         echo '<h3>', I18N::translate('Family of %s', $person->getFullName()), '</h3>', '<table class="t0"><tr><td class="tdmid">';
         $this->dgenerations = $this->generations;
         $this->printDescendency($person, 1);
         echo '</td><td class="tdmid">';
         $this->printPersonPedigree($person, 1);
         echo '</td></tr></table><br><br><hr style="page-break-after:always;"><br><br>';
         foreach ($families as $family) {
             foreach ($family->getChildren() as $child) {
                 $this->printFamilyBook($child, $descent_steps - 1);
             }
         }
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:26,代码来源:FamilyBookController.php

示例12: maxDescendencyGenerations

 /**
  * Calculates number of generations a person has
  *
  * @param Individual $individual Start individual
  * @param int        $depth      Pass in 0 and it calculates how far down descendency goes
  *
  * @return int Number of generations the descendency actually goes
  */
 private function maxDescendencyGenerations(Individual $individual, $depth)
 {
     if ($depth > $this->generations) {
         return $depth;
     }
     $maxdc = $depth;
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getChildren() as $child) {
             $dc = $this->maxDescendencyGenerations($child, $depth + 1);
             if ($dc >= $this->generations) {
                 return $dc;
             }
             if ($dc > $maxdc) {
                 $maxdc = $dc;
             }
         }
     }
     $maxdc++;
     if ($maxdc == 1) {
         $maxdc++;
     }
     return $maxdc;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:HourglassController.php

示例13: individualBoxMenuFamilyLinks

 /**
  * Family links, to show in chart boxes.
  *
  * @param Individual $individual
  *
  * @return Menu[]
  */
 protected function individualBoxMenuFamilyLinks(Individual $individual)
 {
     $menus = array();
     foreach ($individual->getSpouseFamilies() as $family) {
         $menus[] = new Menu('<strong>' . I18N::translate('Family with spouse') . '</strong>', $family->getHtmlUrl());
         $spouse = $family->getSpouse($individual);
         if ($spouse && $spouse->canShowName()) {
             $menus[] = new Menu($spouse->getFullName(), $spouse->getHtmlUrl());
         }
         foreach ($family->getChildren() as $child) {
             if ($child->canShowName()) {
                 $menus[] = new Menu($child->getFullName(), $child->getHtmlUrl());
             }
         }
     }
     return $menus;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:24,代码来源:AbstractTheme.php

示例14: loadSpouses

 /**
  * Display spouses.
  *
  * @param Individual $person
  * @param int        $generations
  *
  * @return string
  */
 public function loadSpouses(Individual $person, $generations)
 {
     $out = '';
     if ($person && $person->canShow()) {
         foreach ($person->getSpouseFamilies() as $family) {
             $out .= $this->getFamilyLi($family, $person, $generations - 1);
         }
     }
     if ($out) {
         return '<ul>' . $out . '</ul>';
     } else {
         return '';
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:22,代码来源:DescendancyModule.php

示例15: familyDescendancy

 /**
  * Find all the families that are descended from an individual.
  *
  * @param Individual $person
  * @param int        $n
  * @param Family[]   $array
  *
  * @return Family[]
  */
 public function familyDescendancy($person, $n, $array)
 {
     if ($n < 1) {
         return $array;
     }
     foreach ($person->getSpouseFamilies() as $family) {
         $array[$family->getXref()] = $family;
         foreach ($family->getChildren() as $child) {
             $array = $this->familyDescendancy($child, $n - 1, $array);
         }
     }
     return $array;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:22,代码来源:DescendancyController.php


注:本文中的Fisharebest\Webtrees\Individual::getSpouseFamilies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。