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


PHP Individual::getChildStepFamilies方法代码示例

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


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

示例1: getParents

 /**
  * Forat the parents of an individual.
  *
  * @param Individual $person
  *
  * @return string
  */
 private function getParents(Individual $person)
 {
     $father = null;
     $mother = null;
     $html = sprintf(self::TTL, I18N::translate('Parents'));
     $family = $person->getPrimaryChildFamily();
     if ($person->canShowName() && $family !== null) {
         $father = $family->getHusband();
         $mother = $family->getWife();
         $html .= $this->getHTML($father) . $this->getHTML($mother);
         // Can only have a step parent if one & only one parent found at this point
         if ($father instanceof Individual xor $mother instanceof Individual) {
             $stepParents = '';
             foreach ($person->getChildStepFamilies() as $family) {
                 if (!$father instanceof Individual) {
                     $stepParents .= $this->getHTML($family->getHusband());
                 } else {
                     $stepParents .= $this->getHTML($family->getWife());
                 }
             }
             if ($stepParents) {
                 $relationship = $father instanceof Individual ? I18N::translateContext("father’s wife", "step-mother") : I18N::translateContext("mother’s husband", "step-father");
                 $html .= sprintf(self::TTL, $relationship) . $stepParents;
             }
         }
     }
     if (!($father instanceof Individual || $mother instanceof Individual)) {
         $html .= sprintf(self::MSG, I18N::translateContext('unknown family', 'unknown'));
     }
     return $html;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:38,代码来源:FamilyNavigatorModule.php


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